UTF 32 bit string class. More...
Public Member Functions | |
String32 (void) noexcept | |
Creates an empty string. | |
String32 (const String32 &rInput) | |
Initialize a Burger::String32 with a Burger::String32. | |
String32 (const String32 &rInput, uintptr_t uStart, uintptr_t uEnd=UINTPTR_MAX) | |
Initialize a Burger::String32 by using a subsection of a different Burger::String32. | |
String32 (const char *pInput) noexcept | |
Initialize with a UTF8 "C" string. | |
String32 (const char *pInput, uintptr_t uPadding) | |
Initialize with a UTF8 "C" string with padding. | |
String32 (const uint16_t *pInput) | |
String32 (const uint32_t *pInput) | |
Initialize with a UTF32 string. | |
~String32 () | |
Release memory, if any. | |
operator uint32_t * () noexcept | |
Return the pointer to the string. | |
operator const uint32_t * () const noexcept | |
Return the const pointer to the string. | |
const uint32_t * | c_str () const noexcept |
Return the const pointer to the string. | |
uint32_t * | c_str () noexcept |
Return the pointer to the string. | |
const uint32_t * | data (void) const noexcept |
uint32_t * | data (void) noexcept |
operator uint32_t () const noexcept | |
Return the first character of the UTF32 "C" string. | |
uintptr_t | length (void) const noexcept |
Return the length of the "C" string. | |
uint_t | empty (void) const noexcept |
uintptr_t | GetLength (void) const noexcept |
Return the length of the UTF32 "C" string. | |
uint32_t * | GetPtr () noexcept |
Return the pointer to the string. | |
const uint32_t * | GetPtr () const noexcept |
Return the const pointer to the string. | |
eError | assign (const char *pInput) noexcept |
Copy an 8 bit "C" string to a Burger::String32. | |
eError | assign (const uint32_t *pInput) noexcept |
Copy a "C" string to a Burger::String. | |
eError | SetBufferSize (uintptr_t uSize) noexcept |
Force a buffer size. | |
eError | resize (uintptr_t uSize) noexcept |
String32 & | operator= (const String32 &rInput) |
Assign a Burger::String32. | |
String32 & | operator= (const uint32_t *pInput) |
Assign a "C" string to a Burger::String32. | |
String32 & | operator= (const char *pInput) |
Assign a "C" string to a Burger::String32. | |
String32 & | operator= (char cInput) |
Assign a single character length string to this Burger::String. | |
String32 | operator() (uintptr_t uStart, uintptr_t uEnd) const noexcept |
Create a new Burger::String32 from a substring. | |
uint32_t & | operator() (uintptr_t uInput) noexcept |
Return the reference to a location in the string. | |
uint32_t const & | operator() (uintptr_t uInput) const noexcept |
Return the reference to a location in the string. | |
uint32_t & | operator[] (uintptr_t uInput) noexcept |
Return the reference to a location in the string. | |
uint32_t const & | operator[] (uintptr_t uInput) const noexcept |
Return the reference to a location in the string. | |
uint_t | operator! () const noexcept |
Return TRUE if the string is empty. | |
uint_t | is_valid (void) const noexcept |
Return TRUE if the string has characters. | |
void | clear (void) noexcept |
Clear out the data. | |
Static Public Attributes | |
static const uintptr_t | BUFFERSIZE |
Ensures the structure is 128 bytes in size on all platforms. | |
Private Attributes | |
uint32_t * | m_pData |
Pointer to the string. | |
uintptr_t | m_uLength |
Length of the string. | |
uint32_t | m_Raw [BUFFERSIZE] |
Temp preallocated buffer for most strings Structure size is 128 bytes. | |
UTF 32 bit string class.
This commonly used string class was designed for performance in mind. Each instance takes 128 bytes to contain data for the string and a pointer to allocated memory if the internal string buffer is too large. Since most strings rarely exceed 120 bytes in length, this class will be able to allocate and free strings with no calls to a memory manager. Only when the string exceeds the internal buffer will Burger::allocate_memory() and Burger::free_memory() be used.
Functions exist to convert UTF8 and UTF16 data into UTF32 format, which this string class uses internally for data storage.
|
inlinenoexcept |
Creates an empty string.
Burger::String32::String32 | ( | const String32 & | rInput | ) |
Initialize a Burger::String32 with a Burger::String32.
rInput | Reference to a Burger::String32 |
Burger::String32::String32 | ( | const String32 & | rInput, |
uintptr_t | uStart, | ||
uintptr_t | uEnd = UINTPTR_MAX ) |
Initialize a Burger::String32 by using a subsection of a different Burger::String32.
Given a starting (inclusive) and ending (exclusive) offset, grab the sub string and use it to create a new Burger::String32
rInput | Burger::String32 to receive input from |
uStart | Offset to the first character to read from |
uEnd | Offset beyond the last character to read from |
|
noexcept |
Initialize with a UTF8 "C" string.
Initialize the Burger::String32 with a copy of the passed string. The original string can be discarded after the call returns.
Burger::String32::String32 | ( | const char * | pInput, |
uintptr_t | uPadding ) |
Initialize with a UTF8 "C" string with padding.
Initialize the Burger::String32 with a copy of the passed string. The original string can be discarded after the call returns. Allocate a buffer that can hold the initialization string + the uPadding number of bytes so the programmer can manually append data to the end of the string with Burger::string_copy() or equivalent
Burger::String32::String32 | ( | const uint16_t * | pInput | ) |
Burger::String32::String32 | ( | const uint32_t * | pInput | ) |
|
inline |
Release memory, if any.
Releases any allocated memory for the string. Under most cases, this performs no operation.
|
noexcept |
Copy an 8 bit "C" string to a Burger::String32.
|
noexcept |
Copy a "C" string to a Burger::String.
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
Clear out the data.
Set the string to an empty string
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Return the reference to a location in the string.
Given an offset into the string, return the reference to the character. If the offset exceeds the length of the string, it will be clamped to the terminating zero.
uInput | Offset to the starting character of the new string |
|
inlinenoexcept |
Return the reference to a location in the string.
Given an offset into the string, return the reference to the character. If the offset exceeds the length of the string, it will be clamped to the terminating zero.
uInput | Offset to the starting character of the new string |
|
inlinenoexcept |
Create a new Burger::String32 from a substring.
Given the start and end offsets of a string, create a new string with those offsets and return the resulting string
uStart | Offset to the starting character of the new string |
uEnd | Offset to the character AFTER the last character of the new string |
Burger::String32 & Burger::String32::operator= | ( | char | cInput | ) |
Assign a single character length string to this Burger::String.
If the input is zero, the string is empty.
cInput | Single low ASCII character to create a string. |
Burger::String32 & Burger::String32::operator= | ( | const char * | pInput | ) |
Assign a "C" string to a Burger::String32.
Copy the contents of a UTF8 "C" string into this Burger::String32
Burger::String32 & Burger::String32::operator= | ( | const String32 & | rInput | ) |
Assign a Burger::String32.
Copy the contents of a Burger::String32 into this Burger::String32
rInput | Reference to a Burger::String32 to copy from |
Burger::String32 & Burger::String32::operator= | ( | const uint32_t * | pInput | ) |
Assign a "C" string to a Burger::String32.
Copy the contents of a UTF8 "C" string into this Burger::String32
|
inlinenoexcept |
Return the reference to a location in the string.
Given an offset into the string, return the reference to the character. If the offset exceeds the length of the string, it will be clamped to the terminating zero.
uInput | Offset to the starting character of the new string |
|
inlinenoexcept |
Return the reference to a location in the string.
Given an offset into the string, return the reference to the character. If the offset exceeds the length of the string, it will be clamped to the terminating zero.
uInput | Offset to the starting character of the new string |
|
inlinenoexcept |
|
noexcept |
Force a buffer size.
Set the buffer to a specific size while retaining the existing string. If the preexisting string is too long for the new buffer, it will be truncated. The buffer size will be padded to reserve two bytes for the terminating zero.
uSize | Number of characters to set the buffer to |
|
static |
Ensures the structure is 128 bytes in size on all platforms.
|
private |
Pointer to the string.
|
private |
Temp preallocated buffer for most strings Structure size is 128 bytes.
|
private |
Length of the string.