mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-08-26 12:50:44 -05:00
StringUtil: Add UTF-32 no-op decoder and encoder classes.
This commit is contained in:
@@ -438,6 +438,27 @@ private:
|
||||
const CharType* const m_end_ptr;
|
||||
};
|
||||
|
||||
template <SizedIntegral<4> CharType>
|
||||
class UTF32Decoder : public CodeUnitReader<CharType>
|
||||
{
|
||||
public:
|
||||
using CodeUnitReader<CharType>::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 <SizedIntegral<1> CharType>
|
||||
class CP1252Decoder : public CodeUnitReader<CharType>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user