Conversion routines to support the MacRomanUS text encoding scheme. More...
Static Public Member Functions | |
static uint32_t | translate_from_UTF8 (const char *pInput) noexcept |
Convert a single UTF8 stream character into a MacRomanUS 8 bit char. | |
static uintptr_t | translate_from_UTF8 (char *pOutput, uintptr_t uOutputSize, const char *pInput) noexcept |
Convert a UTF8 stream into a MacRomanUS "C" string. | |
static uintptr_t | translate_from_UTF8 (char *pOutput, uintptr_t uOutputSize, const char *pInput, uintptr_t uInputSize) noexcept |
Convert a UTF8 stream into a MacRomanUS byte array. | |
Static Public Attributes | |
static const uint8_t | g_UpperCaseTable [256] |
Table to convert all characters to upper case. | |
static const uint8_t | g_LowerCaseTable [256] |
Table to convert all characters to lower case. | |
static const uint8_t | g_ToUTF8Table [128][4] |
Table to convert MacRomanUS to UTF8. | |
static const uint16_t | g_ToUTF16Table [128] |
Table to convert MacRomanUS to UTF16. | |
Static Public Attributes inherited from Burger::CodePage | |
static const uint32_t | kInvalid = UINT32_MAX |
Value returned if a routine failed. | |
Conversion routines to support the MacRomanUS text encoding scheme.
MacRomanUS is a high ASCII encoding that's used by the MacOS classic and Carbon environments. This class will allow the conversion of other character mappings to MacRomanUS for use in calling MacOS API functions.
The character map for MacRomanUS looks like this. Click here.
|
staticnoexcept |
Convert a UTF8 stream into a MacRomanUS "C" string.
Take a "C" string that is using UTF8 encoding and convert it into a MacRomanUS encoded "C" string. The function will return the size of the string after encoding. This size is valid, even if it exceeded the output buffer size. The output pointer and size can be nullptr to have this routine calculate the size of the possible output so the application can allocate a buffer large enough to hold it.
pOutput | Pointer to byte buffer to receive the MacRomanUS encoded string. nullptr is okay if uOutputSize is zero, otherwise it will page fault. |
uOutputSize | Size of the output buffer in bytes. |
pInput | A UTF8 encoded "C" string. nullptr will page fault. |
|
staticnoexcept |
Convert a UTF8 stream into a MacRomanUS byte array.
Take a byte array that is using UTF8 encoding and convert it to a MacRomanUS encoded "C" string. The function will return the size of the string after encoding. This size is valid, even if it exceeded the output buffer size. The output pointer and size can be nullptr to have this routine calculate the size of the possible output so the application can allocate a buffer large enough to hold it.
pOutput | Pointer to a byte buffer to receive the MacRomanUS string. nullptr is okay if uOutputSize is zero, otherwise a page fault will occur. |
uOutputSize | Size of the output buffer in bytes. |
pInput | UTF8 encoded byte array. nullptr is okay if uInputSize is zero. |
uInputSize | Size of the input byte array. |
|
staticnoexcept |
Convert a single UTF8 stream character into a MacRomanUS 8 bit char.
Take up 3 bytes from a UTF8 stream and return the unsigned 8 bit value of the MacRomanUS character. Codes 0 through 0x7f are considered ASCII while codes 0x80 through 0xFF are mapped to MacRomanUS. If the UTF8 character cannot be mapped to MacRomanUS encoding, Burger::CodePage::kInvalid will be returned instead.
pInput | Pointer to UTF8 buffer that contains the 1 to 3 byte buffer to convert. nullptr will page fault. |
|
static |
Table to convert all characters to lower case.
Using MacRomanUS mapping, this table will convert all 256 codes into their lower case equivalents.
|
static |
Table to convert MacRomanUS to UTF16.
Since no Unicode token is larger than 16 bits, an array of uint16_t values holds the 128 high ascii codes for MacRomanUS converted to UTF16. All 128 codes are present in Unicode except for code 0xF0 which is the closed Apple symbol.
The character map for MacRomanUS looks like this. Click here.
|
static |
Table to convert MacRomanUS to UTF8.
This 128x4 array holds the 128 high ascii codes for MacRomanUS converted to UTF8. All 128 codes are present in Unicode except for code 0xF0 which is the closed Apple logo. The Apple logo is mapped to Unicode 0xF8FF which appears to be the Apple default for Unicode.
The character map for MacRomanUS looks like this. Click here.
|
static |
Table to convert all characters to upper case.
Using MacRomanUS mapping, this table will convert all 256 codes into their upper case equivalents.