Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::ISOLatin1 Class Reference

Conversion routines to support the ISOLatin1 text encoding scheme. More...

Inheritance diagram for Burger::ISOLatin1:
Collaboration diagram for Burger::ISOLatin1:

Static Public Member Functions

static uint32_t translate_from_UTF8 (const char *pInput) noexcept
 Convert a single UTF8 stream character into a ISOLatin1 8 bit char.
 
static uintptr_t translate_from_UTF8 (char *pOutput, uintptr_t uOutputSize, const char *pInput) noexcept
 Convert a UTF8 stream into a ISOLatin1 "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 ISOLatin1 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 ISOLatin1 to UTF8.
 
static const uint16_t g_ToUTF16Table [128]
 Table to convert ISOLatin1 to UTF16.
 
- Static Public Attributes inherited from Burger::CodePage
static const uint32_t kInvalid = UINT32_MAX
 Value returned if a routine failed.
 

Detailed Description

Conversion routines to support the ISOLatin1 text encoding scheme.


ISOLatin1 is a high ASCII encoding that's used by the ISO 9660 file system for CD-ROM and DVD-ROMs. This class will allow the conversion of other character mappings to ISOLatin1 for use obtaining the proper filenames on read only media.

The character map for ISOLatin1 looks like this. Click here.

Note
Windows considers this code page 28591
This is the filename charset for the Xbox 360
See also
Win437, Win1252, or MacRomanUS

Member Function Documentation

◆ translate_from_UTF8() [1/3]

uintptr_t BURGER_API Burger::ISOLatin1::translate_from_UTF8 ( char * pOutput,
uintptr_t uOutputSize,
const char * pInput )
staticnoexcept

Convert a UTF8 stream into a ISOLatin1 "C" string.


Take a "C" string that is using UTF8 encoding and convert it into a ISOLatin1 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.

Note
This function will ensure that the string is always zero terminated, even if truncation is necessary to get it to fit in the output buffer. Under no circumstances will the output buffer be overrun.
Parameters
pOutputPointer to byte buffer to receive the ISOLatin1 encoded string. nullptr is okay if uOutputSize is zero, otherwise it will page fault.
uOutputSizeSize of the output buffer in bytes.
pInputA UTF8 encoded "C" string. nullptr will page fault.
Returns
Burger::StringLength() of the potential output. It is valid, even if the output buffer wasn't large enough to contain everything.

◆ translate_from_UTF8() [2/3]

uintptr_t BURGER_API Burger::ISOLatin1::translate_from_UTF8 ( char * pOutput,
uintptr_t uOutputSize,
const char * pInput,
uintptr_t uInputSize )
staticnoexcept

Convert a UTF8 stream into a ISOLatin1 byte array.


Take a byte array that is using UTF8 encoding and convert it to a ISOLatin1 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.

Note
This function will ensure that the string is always zero terminated, even if truncation is necessary to get it to fit in the output buffer. Under no circumstances will the output buffer be overrun.
Zeros can be encoded into the stream. This function will not early out if a zero was parsed. Zeros will be placed in the ISOLatin1 stream as is.
Parameters
pOutputPointer to a byte buffer to receive the ISOLatin1 string. nullptr is okay if uOutputSize is zero, otherwise a page fault will occur.
uOutputSizeSize of the output buffer in bytes.
pInputUTF8 encoded byte array. nullptr is okay if uInputSize is zero.
uInputSizeSize of the input byte array.
Returns
Burger::StringLength() of the potential output. It is valid, even if the output buffer wasn't large enough to contain everything.

◆ translate_from_UTF8() [3/3]

uint32_t BURGER_API Burger::ISOLatin1::translate_from_UTF8 ( const char * pInput)
staticnoexcept

Convert a single UTF8 stream character into a ISOLatin1 8 bit char.


Take up 3 bytes from a UTF8 stream and return the unsigned 8 bit value of the ISOLatin1 character. Codes 0 through 0x7f are considered ASCII while codes 0x80 through 0xFF are mapped to ISOLatin1. If the UTF8 character cannot be mapped to ISOLatin1 encoding, Burger::CodePage::kInvalid will be returned instead.

Note
This function will not return the number of bytes decoded. Use Burger::UTF8::NextToken(const char *) to get the pointer to the next UTF8 entry.
Parameters
pInputPointer to UTF8 buffer that contains the 1 to 2 byte buffer to convert. nullptr will page fault.
Returns
The unsigned 8 bit character code (0x00-0xFF) or Burger::CodePage::kInvalid if the UTF8 value wasn't low ASCII and couldn't be mapped to ISOLatin1.
See also
Burger::UTF8::NextToken(const char *) or Burger::UTF8::GetTokenSize(const char *)

Member Data Documentation

◆ g_LowerCaseTable

const uint8_t Burger::ISOLatin1::g_LowerCaseTable
static

Table to convert all characters to lower case.


Using ISOLatin1 mapping, this table will convert all 256 codes into their lower case equivalents.

◆ g_ToUTF16Table

const uint16_t Burger::ISOLatin1::g_ToUTF16Table
static

Table to convert ISOLatin1 to UTF16.


Since no Unicode token is larger than 16 bits, an array of uint16_t values holds the 128 high ascii codes for ISOLatin1 converted to UTF16. All 128 codes are present since they are a 1-to-1 mapping to Unicode.

The character map for ISOLatin1 looks like this. Click here.

◆ g_ToUTF8Table

const uint8_t Burger::ISOLatin1::g_ToUTF8Table
static

Table to convert ISOLatin1 to UTF8.


This 128x4 array holds the 128 high ascii codes for ISOLatin1 converted to UTF8. All 128 codes are present since they are a 1-to-1 mapping to Unicode.

The character map for ISOLatin1 looks like this. Click here.

◆ g_UpperCaseTable

const uint8_t Burger::ISOLatin1::g_UpperCaseTable
static

Table to convert all characters to upper case.


Using ISOLatin1 mapping, this table will convert all 256 codes into their upper case equivalents.