From a88f043623feae7f52116451634eff99328fcaa3 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sun, 1 Feb 2026 16:45:09 -0600 Subject: [PATCH] StringUtil: Add UTF-32 no-op decoder and encoder classes. --- Source/Core/Common/StringUtil.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index 0b89807535..46eaeab5e2 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -438,6 +438,27 @@ private: const CharType* const m_end_ptr; }; +template CharType> +class UTF32Decoder : public CodeUnitReader +{ +public: + using CodeUnitReader::CodeUnitReader; + + constexpr char32_t operator()() { return this->ReadCodeUnit(); } +}; + +class UTF32Encoder +{ +public: + static constexpr u32 GetMaxUnitsPerCodePoint() { return 1; } + + constexpr u32 operator()(char32_t code_point, SizedIntegral<4> auto* ptr) + { + *ptr = code_point; + return 1; + } +}; + template CharType> class CP1252Decoder : public CodeUnitReader {