power_play/src/base/base_uni.h
2025-10-22 03:22:23 -05:00

65 lines
1.2 KiB
C

////////////////////////////////////////////////////////////
//~ Utf8 types
Struct(Utf8DecodeResult)
{
u32 advance8;
u32 codepoint;
};
Struct(Utf8EncodeResult)
{
u32 count8;
u8 chars8[4];
};
////////////////////////////////////////////////////////////
//~ Utf16 types
Struct(Utf16DecodeResult)
{
u32 advance16;
u32 codepoint;
};
Struct(Utf16EncodeResult)
{
u32 count16;
u16 chars16[2];
};
////////////////////////////////////////////////////////////
//~ Utf32 types
Struct(Utf32DecodeResult)
{
u32 advance32;
u32 codepoint;
};
Struct(Utf32EncodeResult)
{
u32 chars32;
};
////////////////////////////////////////////////////////////
//~ Utf8 operations
Utf8DecodeResult DecodeUtf8(String str);
Utf8EncodeResult EncodeUtf8(u32 codepoint);
////////////////////////////////////////////////////////////
//~ Utf16 operations
Utf16DecodeResult DecodeUtf16(String16 str);
Utf16EncodeResult EncodeUtf16(u32 codepoint);
b32 IsUtf16HighSurrogate(u16 c);
b32 IsUtf16LowSurrogate(u16 c);
////////////////////////////////////////////////////////////
//~ Utf32 operations
Utf32DecodeResult DecodeUtf32(String32 str);
Utf32EncodeResult EncodeUtf32(u32 codepoint);