![]() |
ToyGine2 26.2.0
Game Engine for retro consoles
|
Template string class with fixed-size character buffer. More...
Public Types | |
| using | value_type = char |
| Type of characters stored in the string. | |
| using | size_type = size_t |
| Type used for string size and capacity. | |
| using | difference_type = std::ptrdiff_t |
| Type used for pointer differences. | |
| using | reference = value_type & |
| Reference to string character. | |
| using | const_reference = const value_type & |
| Const reference to string character. | |
| using | pointer = value_type * |
| Pointer to string character. | |
| using | const_pointer = const value_type * |
| Const pointer to string character. | |
| using | iterator = value_type * |
| Iterator type for string characters. | |
| using | const_iterator = const value_type * |
| Const iterator type for string characters. | |
| using | reverse_iterator = std::reverse_iterator<iterator> |
| Reverse iterator type for string characters. | |
| using | const_reverse_iterator = std::reverse_iterator<const_iterator> |
| Const reverse iterator type for string characters. | |
Public Member Functions | |
| constexpr | FixedString () noexcept=default |
| Default constructor. | |
| constexpr | FixedString (size_type count, char character) noexcept |
| Constructs a string of the given count of character. | |
| template<StringLike stringType> | |
| constexpr | FixedString (const stringType &string) noexcept |
| Constructs a string initialized with a toy::StringLike object. | |
| template<StringLike stringType> | |
| constexpr | FixedString (stringType &&string) noexcept |
| constexpr | FixedString (const char *string) noexcept |
| Constructs a string initialized with the C string. | |
| template<StringLike stringType> | |
| constexpr FixedString< allocatedSize > & | operator= (const stringType &string) noexcept |
| Copy assigns a toy::StringLike object to this string. | |
| constexpr FixedString< allocatedSize > & | operator= (const char *string) noexcept |
| Copy assigns the C string to this string. | |
| constexpr FixedString< allocatedSize > & | operator= (char character) noexcept |
| Character assignment to this string. | |
| constexpr FixedString< allocatedSize > & | assign (const FixedString< allocatedSize > &string) noexcept |
| Copy assigns other string to this string. | |
| template<StringLike stringType> | |
| constexpr FixedString< allocatedSize > & | assign (const stringType &string) noexcept |
| Copy assigns a toy::StringLike object to this string. | |
| constexpr FixedString< allocatedSize > & | assign (const char *string) noexcept |
| Copy assigns the C string to this string. | |
| constexpr FixedString< allocatedSize > & | assign (char character, size_t count=1) noexcept |
| Character fill assign method for the string. | |
| constexpr char & | at (size_t offset) noexcept |
| Access a character in the string at a given offset. | |
| constexpr const char & | at (size_t offset) const noexcept |
| Access a character in the string at a given offset. | |
| constexpr char & | operator[] (size_t offset) noexcept |
| Access a character in the string at a given offset. | |
| constexpr const char & | operator[] (size_t offset) const noexcept |
| Access a character in the string at a given offset. | |
| constexpr char & | front () noexcept |
| Returns a reference to the first character of the string. | |
| constexpr const char & | front () const noexcept |
| Returns a const reference to the first character of the string. | |
| constexpr char & | back () noexcept |
| Returns a reference to the last character of the string. | |
| constexpr const char & | back () const noexcept |
| Returns a const reference to the last character of the string. | |
| constexpr char * | data () noexcept |
| Returns a pointer to the data of the string. | |
| constexpr const char * | data () const noexcept |
| Returns a constant pointer to the data of the string. | |
| constexpr const char * | c_str () const noexcept |
| Returns a constant pointer to the C string representation of this string. | |
| constexpr bool | empty () const noexcept |
| Checks if the string is empty. | |
| constexpr size_t | size () const noexcept |
| Returns the size of the string. | |
| size_t | utf8_size () const noexcept |
| Returns the size of the Unicode string in UTF-8 encoding. | |
| constexpr size_t | length () const noexcept |
| Returns the size of the string. | |
| constexpr size_t | max_size () const noexcept |
| Returns the maximum size of the string. | |
| constexpr size_t | capacity () const noexcept |
| Returns the capacity of the string. | |
| constexpr void | clear () noexcept |
| Clears the contents of the string. | |
| constexpr FixedString< allocatedSize > & | insert (size_t index, const FixedString< allocatedSize > &string) noexcept |
| Inserts other string at the specified index. | |
| template<StringLike stringType> | |
| constexpr FixedString< allocatedSize > & | insert (size_t index, const stringType &string) noexcept |
| Inserts a toy::StringLike object at the specified index. | |
| constexpr FixedString< allocatedSize > & | insert (size_t index, const char *string) noexcept |
| Inserts the C string at the specified index. | |
| constexpr FixedString< allocatedSize > & | insert (size_t index, char character, size_t count=1) noexcept |
| Inserts a character repeated the given count times at the specified index. | |
| constexpr FixedString< allocatedSize > & | erase (size_t offset, size_t count=npos) noexcept |
| Erases characters from the string starting at the specified offset. | |
| constexpr void | push_back (char character) noexcept |
| Appends a single character to the end of the string. | |
| constexpr void | pop_back () noexcept |
| Removes the last character from the string. | |
| constexpr void | utf8_pop_back () noexcept |
| Removes the last UTF-8 encoded character from the string. | |
| constexpr FixedString< allocatedSize > & | append (size_type count, char character) noexcept |
| Appends a character repeated the given count times to the end of this string. | |
| constexpr FixedString< allocatedSize > & | append (const char *string, size_type count) noexcept |
| Appends the first count characters from the C string to the end of this string. | |
| constexpr FixedString< allocatedSize > & | append (const char *string) noexcept |
| Appends the C string to the end of this string. | |
| constexpr FixedString< allocatedSize > & | append (const FixedString< allocatedSize > &string) noexcept |
| Appends other string to the end of this string. | |
| template<StringLike stringType> | |
| constexpr FixedString< allocatedSize > & | append (const stringType &string) noexcept |
| Appends a toy::StringLike object to the end of this string. | |
| constexpr FixedString< allocatedSize > & | operator+= (const FixedString< allocatedSize > &string) noexcept |
| Appends other string to the end of this string. | |
| template<StringLike stringType> | |
| constexpr FixedString< allocatedSize > & | operator+= (const stringType &string) noexcept |
| Appends a toy::StringLike object to the end of this string. | |
| constexpr FixedString< allocatedSize > & | operator+= (const char *string) noexcept |
| Appends the C string to the end of this string. | |
| constexpr FixedString< allocatedSize > & | operator+= (char character) noexcept |
| Appends a character to the end of this string. | |
| constexpr FixedString< allocatedSize > & | replace (size_t pos, size_t count, const FixedString< allocatedSize > &string) noexcept |
| Replaces a portion of the string with another string. | |
| template<StringLike stringType> | |
| constexpr FixedString< allocatedSize > & | replace (size_t pos, size_t count, const stringType &string) noexcept |
| Replaces a portion of the string with a toy::StringLike object. | |
| constexpr FixedString< allocatedSize > & | replace (size_t pos, size_t count, const char *string) noexcept |
| Replaces a portion of the string with the C string. | |
| constexpr FixedString< allocatedSize > & | replace (size_t pos, size_t count, char character, size_t charactersCount=1) noexcept |
| Replaces a portion of the string with a character repeated the given count of times. | |
| constexpr size_t | copy (char *dest, size_t count, size_t pos=0) const noexcept |
| Copies characters from the string to a destination buffer. | |
| constexpr void | swap (FixedString< allocatedSize > &string) noexcept |
| Swaps the contents of this string with another string. | |
| constexpr size_t | find (const FixedString< allocatedSize > &string, size_t position=0) const noexcept |
| Finds the first occurrence of other string in the string. | |
| template<StringLike stringType> | |
| constexpr size_t | find (const stringType &string, size_t position=0) const noexcept |
| Finds the first occurrence of a toy::StringLike object in the string. | |
| constexpr size_t | find (const char *string, size_t position=0) const noexcept |
| Finds the first occurrence of the C string in the string. | |
| constexpr size_t | find (char character, size_t position=0) const noexcept |
| Finds the first occurrence of a character in the string. | |
| constexpr size_t | rfind (const FixedString< allocatedSize > &string, size_t position=npos) const noexcept |
| Finds the last occurrence of other string in the string. | |
| template<StringLike stringType> | |
| constexpr size_t | rfind (const stringType &string, size_t position=npos) const noexcept |
| Finds the last occurrence of a toy::StringLike object in the string. | |
| constexpr size_t | rfind (const char *string, size_t position=npos) const noexcept |
| Finds the last occurrence of the C string in the string. | |
| constexpr size_t | rfind (char character, size_t position=npos) const noexcept |
| Finds the last occurrence of a character in the string. | |
| constexpr size_t | find_first_of (const FixedString< allocatedSize > &string, size_t position=0) const noexcept |
| Finds the first occurrence of any character from the specified string. | |
| template<StringLike stringType> | |
| constexpr size_t | find_first_of (const stringType &string, size_t position=0) const noexcept |
| Finds the first occurrence of any character from a toy::StringLike object. | |
| constexpr size_t | find_first_of (const char *string, size_t position=0) const noexcept |
| Finds the first occurrence of any character from the C string. | |
| constexpr size_t | find_first_of (char character, size_t position=0) const noexcept |
| Finds the first occurrence of the specified character. | |
| constexpr size_t | find_first_not_of (const FixedString< allocatedSize > &string, size_t position=0) const noexcept |
| Finds the first occurrence of any character not from the specified string. | |
| template<StringLike stringType> | |
| constexpr size_t | find_first_not_of (const stringType &string, size_t position=0) const noexcept |
| Finds the first occurrence of any character not from a toy::StringLike object. | |
| constexpr size_t | find_first_not_of (const char *string, size_t position=0) const noexcept |
| Finds the first occurrence of any character not from the C string. | |
| constexpr size_t | find_first_not_of (char character, size_t position=0) const noexcept |
| Finds the first occurrence of any character not equal to the specified character. | |
| constexpr size_t | find_last_of (const FixedString< allocatedSize > &string, size_t position=npos) const noexcept |
| Finds the last occurrence of any character from the specified string. | |
| template<StringLike stringType> | |
| constexpr size_t | find_last_of (const stringType &string, size_t position=npos) const noexcept |
| Finds the last occurrence of any character from a toy::StringLike object. | |
| constexpr size_t | find_last_of (const char *string, size_t position=npos) const noexcept |
| Finds the last occurrence of any character from the C string. | |
| constexpr size_t | find_last_of (char character, size_t position=npos) const noexcept |
| Finds the last occurrence of the specified character. | |
| constexpr size_t | find_last_not_of (const FixedString< allocatedSize > &string, size_t position=npos) const noexcept |
| Finds the last occurrence of any character not from the specified string. | |
| template<StringLike stringType> | |
| constexpr size_t | find_last_not_of (const stringType &string, size_t position=npos) const noexcept |
| Finds the last occurrence of any character not from a toy::StringLike object. | |
| constexpr size_t | find_last_not_of (const char *string, size_t position=npos) const noexcept |
| Finds the last occurrence of any character not from the C string. | |
| constexpr size_t | find_last_not_of (char character, size_t position=npos) const noexcept |
| Finds the last occurrence of any character not equal to the specified character. | |
| constexpr int | compare (const FixedString< allocatedSize > &string) const noexcept |
| Compares this string with another string lexicographically. | |
| template<StringLike stringType> | |
| constexpr int | compare (const stringType &string) const noexcept |
| Compares this string with a toy::StringLike object lexicographically. | |
| constexpr int | compare (const char *string) const noexcept |
| Compares this string with the C string lexicographically. | |
| constexpr bool | starts_with (const FixedString< allocatedSize > &string) const noexcept |
| Checks if the string starts with the specified string. | |
| template<StringLike stringType> | |
| constexpr bool | starts_with (const stringType &string) const noexcept |
| Checks if the string starts with a toy::StringLike object. | |
| constexpr bool | starts_with (const char *string) const noexcept |
| Checks if the string starts with the specified C string. | |
| constexpr bool | starts_with (char character) const noexcept |
| Checks if the string starts with the specified character. | |
| constexpr bool | ends_with (const FixedString< allocatedSize > &string) const noexcept |
| Checks if the string ends with the specified string. | |
| template<StringLike stringType> | |
| constexpr bool | ends_with (const stringType &string) const noexcept |
| Checks if the string ends with a toy::StringLike object. | |
| constexpr bool | ends_with (const char *string) const noexcept |
| Checks if the string ends with the C string. | |
| constexpr bool | ends_with (char character) const noexcept |
| Checks if the string ends with the specified character. | |
| constexpr bool | contains (const FixedString< allocatedSize > &string) const noexcept |
| Checks if the string contains the specified string. | |
| template<StringLike stringType> | |
| constexpr bool | contains (const stringType &string) const noexcept |
| Checks if the string contains a toy::StringLike object. | |
| constexpr bool | contains (const char *string) const noexcept |
| Checks if the string contains the C string. | |
| constexpr bool | contains (char character) const noexcept |
| Checks if the string contains the specified character. | |
| constexpr FixedString< allocatedSize > | substr (size_t position=0, size_t count=npos) const noexcept |
| Returns a substring of this string. | |
Static Public Attributes | |
| static constexpr size_t | npos = size_t(-1) |
| The special value, its exact meaning depends on the context. | |
Private Member Functions | |
| constexpr void | _insert_raw (size_t position, const char *data, size_t dataSize) noexcept |
| Helper method for inserting data at a specific position. | |
| constexpr void | _append_raw (const char *data, size_t dataSize) noexcept |
| Helper method for appending data to the end of the string. | |
| constexpr void | _replace_raw (size_t position, size_t oldCount, const char *data, size_t dataSize) noexcept |
| Helper method for replacing data at a specific position. | |
| constexpr size_t | _find_raw (size_t position, const char *data, size_t dataSize) const noexcept |
| Helper method for finding data in the string. | |
| constexpr size_t | _rfind_raw (size_t position, const char *data, size_t dataSize) const noexcept |
| Helper method for finding data in the string backwards. | |
| constexpr size_t | _find_first_of_raw (size_t position, const char *data, size_t dataSize) const noexcept |
| Helper method for finding the first occurrence of any character from data. | |
| constexpr size_t | _find_first_not_of_raw (size_t position, const char *data, size_t dataSize) const noexcept |
| Helper method for finding the first occurrence of any character not from data. | |
| constexpr size_t | _find_last_of_raw (size_t position, const char *data, size_t dataSize) const noexcept |
| Helper method for finding the last occurrence of any character from data. | |
| constexpr size_t | _find_last_not_of_raw (size_t position, const char *data, size_t dataSize) const noexcept |
| Helper method for finding the last occurrence of any character not from data. | |
Private Attributes | |
| FixedStringStorage< allocatedSize > | _storage |
| Internal character buffer storing the string data. | |
Template string class with fixed-size character buffer.
FixedString is a lightweight, high-performance string class that uses a fixed-size character buffer allocated on the stack. It provides a std::string-like interface while avoiding dynamic memory allocation, making it suitable for embedded systems, real-time applications, and performance-critical code where memory allocation overhead must be minimized.
| allocatedSize | The size of the internal character buffer, including space for the null terminator. Must be greater than zero. |
std::string-like interface| using toy::FixedString< allocatedSize >::const_iterator = const value_type * |
Const iterator type for string characters.
| using toy::FixedString< allocatedSize >::const_pointer = const value_type * |
Const pointer to string character.
| using toy::FixedString< allocatedSize >::const_reference = const value_type & |
Const reference to string character.
| using toy::FixedString< allocatedSize >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Const reverse iterator type for string characters.
| using toy::FixedString< allocatedSize >::difference_type = std::ptrdiff_t |
Type used for pointer differences.
| using toy::FixedString< allocatedSize >::iterator = value_type * |
Iterator type for string characters.
| using toy::FixedString< allocatedSize >::pointer = value_type * |
Pointer to string character.
| using toy::FixedString< allocatedSize >::reference = value_type & |
Reference to string character.
| using toy::FixedString< allocatedSize >::reverse_iterator = std::reverse_iterator<iterator> |
Reverse iterator type for string characters.
| using toy::FixedString< allocatedSize >::size_type = size_t |
Type used for string size and capacity.
| using toy::FixedString< allocatedSize >::value_type = char |
Type of characters stored in the string.
|
constexprdefaultnoexcept |
Default constructor.
|
constexprnoexcept |
Constructs a string of the given count of character.
This constructor initializes a string with a character repeated the given count of times.
| count | The number of times to repeat the character. |
| character | The character to repeat. |
|
explicitconstexprnoexcept |
Constructs a string initialized with a toy::StringLike object.
This constructor initializes a string by copying the content from a toy::StringLike object.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The source toy::StringLike object to copy content from. |
|
explicitconstexprnoexcept |
|
explicitconstexprnoexcept |
Constructs a string initialized with the C string.
This constructor initializes a string by copying the content from the C string. The constructor automatically determines the length of the source string and copies the content up to the allocated capacity.
| string | The source C string to copy content from. |
|
constexprprivatenoexcept |
Helper method for appending data to the end of the string.
This private method performs the common append logic used by all append methods. It copies new data to the end of the string and updates the size accordingly.
| data | The data to append. |
| dataSize | The size of the data to append. |
|
constexprprivatenoexcept |
Helper method for finding the first occurrence of any character not from data.
This private method performs the common search logic used by all find_first_not_of methods. It searches for the first occurrence of any character that is not present in the specified data starting from the given position.
| position | The position to start searching from. |
| data | The data containing characters to exclude from search. |
| dataSize | The size of the data containing characters to exclude from search. |
|
constexprprivatenoexcept |
Helper method for finding the first occurrence of any character from data.
This private method performs the common search logic used by all find_first_of methods. It searches for the first occurrence of any character from the specified data starting from the given position.
| position | The position to start searching from. |
| data | The data containing characters to search for. |
| dataSize | The size of the data containing characters to search for. |
|
constexprprivatenoexcept |
Helper method for finding the last occurrence of any character not from data.
This private method performs the common reverse search logic used by all find_last_not_of methods. It searches for the last occurrence of any character that is not present in the specified data starting from the given position and searching backwards.
| position | The position to start searching from. If npos, searches from the end. |
| data | The data containing characters to exclude from search. |
| dataSize | The size of the data containing characters to exclude from search. |
|
constexprprivatenoexcept |
Helper method for finding the last occurrence of any character from data.
This private method performs the common reverse search logic used by all find_last_of methods. It searches for the last occurrence of any character from the specified data starting from the given position and searching backwards.
| position | The position to start searching from. If npos, searches from the end. |
| data | The data containing characters to search for. |
| dataSize | The size of the data containing characters to search for. |
|
constexprprivatenoexcept |
Helper method for finding data in the string.
This private method performs the common search logic used by all find methods. It searches for the specified data starting from the given position.
| position | The position to start searching from. |
| data | The data to search for. |
| dataSize | The size of the data to search for. |
|
constexprprivatenoexcept |
Helper method for inserting data at a specific position.
This private method performs the common insertion logic used by all insert methods. It shifts existing data to the right and inserts new data at the specified position.
| position | The position where to insert the data. |
| data | The data to insert. |
| dataSize | The size of the data to insert. |
|
constexprprivatenoexcept |
Helper method for replacing data at a specific position.
This private method performs the common replacement logic used by all replace methods. It handles the shifting of existing data and insertion of new data at the specified position.
| position | The position where to replace the data. |
| oldCount | The number of characters to replace. |
| data | The new data to insert. |
| dataSize | The size of the new data. |
|
constexprprivatenoexcept |
Helper method for finding data in the string backwards.
This private method performs the common reverse search logic used by all rfind methods. It searches for the specified data starting from the given position and searching backwards.
| position | The position to start searching from. |
| data | The data to search for. |
| dataSize | The size of the data to search for. |
|
constexprnoexcept |
Appends the C string to the end of this string.
This method appends the contents of the C string to the end of this string.
| string | The source C string to append content from. |
|
constexprnoexcept |
Appends the first count characters from the C string to the end of this string.
This method appends the first count characters from the C string to the end of this string.
| string | The source C string to append content from. |
| count | The number of characters to append from the C string. |
|
constexprnoexcept |
Appends other string to the end of this string.
This method appends the contents of another string to the end of this string.
| string | The source string to append content from. |
|
constexprnoexcept |
Appends a toy::StringLike object to the end of this string.
This method appends the contents of a toy::StringLike object to the end of this string.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The source toy::StringLike object to append content from. |
|
constexprnoexcept |
Appends a character repeated the given count times to the end of this string.
This method appends a character repeated the given count of times to the end of this string.
| count | The number of times to repeat the character. |
| character | The character to append. |
|
constexprnoexcept |
Character fill assign method for the string.
This method assigns a character repeated the given count of times to this string.
| character | The character to repeat. |
| count | The number of times to repeat the character (default: 1). |
|
constexprnoexcept |
Copy assigns the C string to this string.
This method assigns the content from the C string to this string. The assignment operation automatically determines the length of the source content and performs a deep copy of the string data and updates the size accordingly.
| string | The source C string to copy content from. |
|
constexprnoexcept |
Copy assigns other string to this string.
This method assigns the contents of another string to this string. The assignment operation performs a deep copy of the string data and updates the size accordingly.
| string | The source string to copy content from. |
|
constexprnoexcept |
Copy assigns a toy::StringLike object to this string.
This method assigns the content from a toy::StringLike object to this string. The assignment operation performs a deep copy of the string data and updates the size accordingly.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The source toy::StringLike object to copy content from. |
|
nodiscardconstexprnoexcept |
Access a character in the string at a given offset.
This method provides read-only access to a character at the specified offset within the string.
| offset | The offset of the character to access in the string. |
|
nodiscardconstexprnoexcept |
Access a character in the string at a given offset.
This method provides direct access to a character at the specified offset within the string.
| offset | The offset of the character to access in the string. |
|
nodiscardconstexprnoexcept |
Returns a const reference to the last character of the string.
This method provides read-only access to the last character of the string.
|
nodiscardconstexprnoexcept |
Returns a reference to the last character of the string.
This method provides direct access to the last character of the string.
|
nodiscardconstexprnoexcept |
Returns a constant pointer to the C string representation of this string.
This method returns a constant pointer to the C string representation of this string. The returned pointer provides read-only access to the string contents and can be used with C functions that require a char pointer.
|
nodiscardconstexprnoexcept |
Returns the capacity of the string.
This method returns the capacity of the allocated buffer for the string, which is determined by the template parameter allocatedSize.
|
constexprnoexcept |
Clears the contents of the string.
This method resets the size of the string to zero and effectively clears the string.
0).
|
nodiscardconstexprnoexcept |
Compares this string with the C string lexicographically.
This method performs a lexicographic comparison between this string and the C string. The comparison is performed character by character using the character's numeric value.
| string | The C string to compare with this string. |
|
nodiscardconstexprnoexcept |
Compares this string with another string lexicographically.
This method performs a lexicographic comparison between this string and another string. The comparison is performed character by character using the character's numeric value.
| string | The string to compare with this string. |
|
nodiscardconstexprnoexcept |
Compares this string with a toy::StringLike object lexicographically.
This method performs a lexicographic comparison between this string and a toy::StringLike object. The comparison is performed character by character using the character's numeric value.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The toy::StringLike object to compare with this string. |
|
nodiscardconstexprnoexcept |
Checks if the string contains the specified character.
This method checks if the current string contains the specified character anywhere within it.
| character | The character to search for within this string. |
true if this string contains the specified character, false otherwise.false.
|
nodiscardconstexprnoexcept |
Checks if the string contains the C string.
This method checks if the current string contains the C string anywhere within it.
| string | The C string to search for within this string. |
true if this string contains the C string, false otherwise.true. false.
|
nodiscardconstexprnoexcept |
Checks if the string contains the specified string.
This method checks if the current string contains the specified string anywhere within it.
| string | The string to search for within this string. |
true if this string contains the specified string, false otherwise.true. false.
|
nodiscardconstexprnoexcept |
Checks if the string contains a toy::StringLike object.
This method checks if the current string contains a toy::StringLike object anywhere within it.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The toy::StringLike object to search for within this string. |
true if this string contains a toy::StringLike object, false otherwise.true. false.
|
constexprnoexcept |
Copies characters from the string to a destination buffer.
This method copies up to count characters from the string starting at position pos to the destination buffer. The method returns the actual number of characters copied, which may be less than count if the end of the string is reached.
| dest | The destination buffer to copy characters to. |
| count | The maximum number of characters to copy. |
| pos | The starting position in the string to copy from (default: 0). |
|
nodiscardconstexprnoexcept |
Returns a constant pointer to the data of the string.
This method returns a constant pointer to the internal character array that stores the string data. The returned pointer provides read-only access to the string contents and can be used for low-level operations.
|
nodiscardconstexprnoexcept |
Returns a pointer to the data of the string.
This method returns a pointer to the internal character array that stores the string data. The returned pointer provides direct access to the string contents and can be used for low-level operations.
|
nodiscardconstexprnoexcept |
Checks if the string is empty.
This method checks if the string is empty, i.e. its size is zero. An empty string contains no characters and has a length of zero.
true if the string is empty (size is 0), false otherwise.
|
nodiscardconstexprnoexcept |
Checks if the string ends with the specified character.
This method checks if the current string ends with the specified character. The comparison is performed on the last character of the string.
| character | The character to check if this string ends with. |
true if this string ends with the specified character, false otherwise.false.
|
nodiscardconstexprnoexcept |
Checks if the string ends with the C string.
This method checks if the current string ends with the C string. The comparison is performed character by character from the end of the string.
| string | The C string to check if this string ends with. |
true if this string ends with the C string, false otherwise.true. false.
|
nodiscardconstexprnoexcept |
Checks if the string ends with the specified string.
This method checks if the current string ends with the specified string. The comparison is performed character by character from the end of the string.
| string | The string to check if this string ends with. |
true if this string ends with the specified string, false otherwise.true. false.
|
nodiscardconstexprnoexcept |
Checks if the string ends with a toy::StringLike object.
This method checks if the current string ends with a toy::StringLike object. The comparison is performed character by character from the end of the string.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The toy::StringLike object to check if this string ends with. |
true if this string ends with a toy::StringLike object, false otherwise.true. false.
|
constexprnoexcept |
Erases characters from the string starting at the specified offset.
This method removes characters from the string starting at the specified offset. The method can remove a specific number of characters or all characters from the offset to the end of the string. The remaining characters are shifted left to fill the gap, and the string size is updated accordingly.
| offset | The starting position for erasing characters. |
| count | The number of characters to erase (default: npos). If count is npos or equal to the remaining length, then all characters from offset to the end are removed. |
npos, all characters from offset to the end are removed. 0, the operation is a no-op.
|
nodiscardconstexprnoexcept |
Finds the first occurrence of a character in the string.
This method searches for the first occurrence of the specified character within this string, starting from the given position.
| character | The character to search for. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the first occurrence of the C string in the string.
This method searches for the first occurrence of the C string within this string, starting from the given position.
| string | The source C string to search for. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the first occurrence of other string in the string.
This method searches for the first occurrence of the specified string within this string, starting from the given position.
| string | The source string to search for. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the first occurrence of a toy::StringLike object in the string.
This method searches for the first occurrence of a toy::StringLike object within this string, starting from the given position.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The source toy::StringLike object to search for. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the first occurrence of any character not equal to the specified character.
This method searches for the first occurrence of any character that is not equal to the specified character within this string, starting from the given position.
| character | The character to exclude from search. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the first occurrence of any character not from the C string.
This method searches for the first occurrence of any character that is not present in the C string within this string, starting from the given position.
| string | The C string containing characters to exclude from search. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the first occurrence of any character not from the specified string.
This method searches for the first occurrence of any character that is not present in the specified string within this string, starting from the given position.
| string | The string containing characters to exclude from search. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the first occurrence of any character not from a toy::StringLike object.
This method searches for the first occurrence of any character that is not present in a toy::StringLike object within this string, starting from the given position.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The toy::StringLike object containing characters to exclude from search. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the first occurrence of the specified character.
This method searches for the first occurrence of the specified character within this string, starting from the given position.
| character | The character to search for. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the first occurrence of any character from the C string.
This method searches for the first occurrence of any character from the C string within this string, starting from the given position.
| string | The C string containing characters to search for. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the first occurrence of any character from the specified string.
This method searches for the first occurrence of any character from the specified string within this string, starting from the given position.
| string | The string containing characters to search for. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the first occurrence of any character from a toy::StringLike object.
This method searches for the first occurrence of any character from a toy::StringLike object within this string, starting from the given position.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The toy::StringLike object containing characters to search for. |
| position | The position to start searching from (default: 0). |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of any character not equal to the specified character.
This method searches for the last occurrence of any character that is not equal to the specified character within this string, starting from the given position and searching backwards.
| character | The character to exclude from search. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of any character not from the C string.
This method searches for the last occurrence of any character that is not present in the C string within this string, starting from the given position and searching backwards.
| string | The C string containing characters to exclude from search. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of any character not from the specified string.
This method searches for the last occurrence of any character that is not present in the specified string within this string, starting from the given position and searching backwards.
| string | The string containing characters to exclude from search. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of any character not from a toy::StringLike object.
This method searches for the last occurrence of any character that is not present in a toy::StringLike object within this string, starting from the given position and searching backwards.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The toy::StringLike object containing characters to exclude from search. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of the specified character.
This method searches for the last occurrence of the specified character within this string, starting from the given position and searching backwards.
| character | The character to search for. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of any character from the C string.
This method searches for the last occurrence of any character from the C string within this string, starting from the given position and searching backwards.
| string | The C string containing characters to search for. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of any character from the specified string.
This method searches for the last occurrence of any character from the specified string within this string, starting from the given position and searching backwards.
| string | The string containing characters to search for. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of any character from a toy::StringLike object.
This method searches for the last occurrence of any character from a toy::StringLike object within this string, starting from the given position and searching backwards.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The toy::StringLike object containing characters to search for. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Returns a const reference to the first character of the string.
This method provides read-only access to the first character of the string.
|
nodiscardconstexprnoexcept |
Returns a reference to the first character of the string.
This method provides direct access to the first character of the string.
|
constexprnoexcept |
Inserts a character repeated the given count times at the specified index.
This method inserts a character repeated the given count of times at the specified position. The insertion shifts existing characters to the right to make room for the new content.
| index | The position where the characters should be inserted. |
| character | The character to insert. |
| count | The number of times to repeat the character (default: 1). |
|
constexprnoexcept |
Inserts the C string at the specified index.
This method inserts the contents of the C string at the specified position. The insertion shifts existing characters to the right to make room for the new content.
| index | The position where the C string should be inserted. |
| string | The source C string to insert content from. |
|
constexprnoexcept |
Inserts other string at the specified index.
This method inserts the contents from another string at the specified position. The insertion shifts existing characters to the right to make room for the new content.
| index | The position where the string should be inserted. |
| string | The source string to insert content from. |
|
constexprnoexcept |
Inserts a toy::StringLike object at the specified index.
This method inserts the contents from a toy::StringLike object at the specified position. The insertion shifts existing characters to the right to make room for the new content.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| index | The position where the toy::StringLike object should be inserted. |
| string | The source toy::StringLike object to insert content from. |
|
nodiscardconstexprnoexcept |
Returns the size of the string.
This method returns the current number of characters in the string, excluding the terminating null character. The length represents the actual length of the string content.
|
nodiscardconstexprnoexcept |
Returns the maximum size of the string.
This method returns the maximum possible size for the string, which is determined by the template parameter allocatedSize. The maximum size represents the size of the allocated buffer.
|
constexprnoexcept |
Appends a character to the end of this string.
This operator appends a character to the end of this string.
| character | The character to append. |
1.
|
constexprnoexcept |
Appends the C string to the end of this string.
This operator appends the contents of the C string to the end of this string.
| string | The source C string to append content from. |
|
constexprnoexcept |
Appends other string to the end of this string.
This operator appends the contents of another string to the end of this string.
| string | The source string to append content from. |
|
constexprnoexcept |
Appends a toy::StringLike object to the end of this string.
This operator appends the contents of a toy::StringLike object to the end of this string.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The source toy::StringLike object to append content from. |
|
constexprnoexcept |
Character assignment to this string.
This operator assigns a single character to this string, creating a string of length 1.
| character | The character to assign. |
1.
|
constexprnoexcept |
Copy assigns the C string to this string.
This operator assigns the content from the C string to this string. The assignment operation automatically determines the length of the source content and performs a deep copy of the string data and updates the size accordingly.
| string | The source C string to copy content from. |
|
constexprnoexcept |
Copy assigns a toy::StringLike object to this string.
This operator assigns the content from a toy::StringLike object to this string. The assignment operation performs a deep copy of the string data and updates the size accordingly.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The source toy::StringLike object to copy content from. |
|
nodiscardconstexprnoexcept |
Access a character in the string at a given offset.
This operator provides read-only access to a character at the specified offset within the string.
| offset | The offset of the character to access in the string. |
|
nodiscardconstexprnoexcept |
Access a character in the string at a given offset.
This operator provides direct access to a character at the specified offset within the string.
| offset | The offset of the character to access in the string. |
|
constexprnoexcept |
Removes the last character from the string.
This method removes the last character from the current string, decreasing its size by one.
|
constexprnoexcept |
Appends a single character to the end of the string.
This method appends a single character to the end of the current string, increasing its size by one.
| character | The character to append. |
|
constexprnoexcept |
Replaces a portion of the string with a character repeated the given count of times.
This method replaces a specified range of characters in the current string with a character repeated the given count of times. The replacement operation shifts existing characters as needed to accommodate the new content.
| pos | The starting position for the replacement. |
| count | The number of characters to replace. |
| character | The character to replace with. |
| charactersCount | The number of times to repeat the character (default: 1). |
|
constexprnoexcept |
Replaces a portion of the string with the C string.
This method replaces a specified range of characters in the current string with the contents of the C string. The replacement operation shifts existing characters as needed to accommodate the new content.
| pos | The starting position for the replacement. |
| count | The number of characters to replace. |
| string | The source C string to replace content from. |
|
constexprnoexcept |
Replaces a portion of the string with another string.
This method replaces a specified range of characters in the current string with the contents of another string. The replacement operation shifts existing characters as needed to accommodate the new content.
| pos | The starting position for the replacement. |
| count | The number of characters to replace. |
| string | The source string to replace content from. |
|
constexprnoexcept |
Replaces a portion of the string with a toy::StringLike object.
This method replaces a specified range of characters in the current string with the contents of a toy::StringLike object. The replacement operation shifts existing characters as needed to accommodate the new content.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| pos | The starting position for the replacement. |
| count | The number of characters to replace. |
| string | The source toy::StringLike object to replace content from. |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of a character in the string.
This method searches for the last occurrence of the specified character within this string, starting from the given position and searching backwards.
| character | The character to search for. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of the C string in the string.
This method searches for the last occurrence of the C string within this string, starting from the given position and searching backwards.
| string | The source C string to search for. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of other string in the string.
This method searches for the last occurrence of the specified string within this string, starting from the given position and searching backwards.
| string | The source string to search for. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Finds the last occurrence of a toy::StringLike object in the string.
This method searches for the last occurrence of a toy::StringLike object within this string, starting from the given position and searching backwards.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The source toy::StringLike object to search for. |
| position | The position to start searching from (default: npos). If npos, searches from the end. |
|
nodiscardconstexprnoexcept |
Returns the size of the string.
This method returns the current number of characters in the string, excluding the terminating null character. The size represents the actual length of the string content.
|
nodiscardconstexprnoexcept |
Checks if the string starts with the specified character.
This method checks if the current string starts with the specified character. The comparison is performed on the first character of the string.
| character | The character to check if this string starts with. |
true if this string starts with the specified character, false otherwise.false.
|
nodiscardconstexprnoexcept |
Checks if the string starts with the specified C string.
This method checks if the current string starts with the C string. The comparison is performed character by character from the beginning of the string.
| string | The C string to check if this string starts with. |
true if this string starts with the C string, false otherwise.true. false.
|
nodiscardconstexprnoexcept |
Checks if the string starts with the specified string.
This method checks if the current string starts with the specified string. The comparison is performed character by character from the beginning of the string.
| string | The string to check if this string starts with. |
true if this string starts with the specified string, false otherwise.true. false.
|
nodiscardconstexprnoexcept |
Checks if the string starts with a toy::StringLike object.
This method checks if the current string starts with a toy::StringLike object. The comparison is performed character by character from the beginning of the string.
| stringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The toy::StringLike object to check if this string starts with. |
true if this string starts with a toy::StringLike object, false otherwise.true. false.
|
nodiscardconstexprnoexcept |
Returns a substring of this string.
This method creates and returns a new FixedString object containing a substring of this string, starting at the specified position and containing up to count characters.
| position | The starting position of the substring (default: 0). |
| count | The maximum number of characters to include in the substring (default: npos). If npos or exceeds the remaining characters, all characters from position to the end are included. |
|
constexprnoexcept |
Swaps the contents of this string with another string.
This method exchanges the contents of this string with another string of the same type. Both strings must have the same allocated size. The operation is performed efficiently by swapping the internal data and size information.
| string | The string to swap contents with. |
|
constexprnoexcept |
Removes the last UTF-8 encoded character from the string.
This method removes the last UTF-8 encoded character from the current string. Unlike pop_back() which removes a single character, this method removes the complete UTF-8 encoded character, which may consist of multiple bytes.
|
inlinenodiscardnoexcept |
Returns the size of the Unicode string in UTF-8 encoding.
This method returns the number of Unicode characters in the UTF-8 encoded string, excluding the terminating null character. For ASCII strings, this value equals the size() method. For UTF-8 encoded strings, this method counts the number of Unicode characters rather than bytes. The method validates UTF-8 encoding and counts only complete, well-formed Unicode characters.
|
private |
Internal character buffer storing the string data.
|
staticconstexpr |
The special value, its exact meaning depends on the context.