![]() |
Gaia-ECS v0.9.3
A simple and powerful entity component system
|
Lightweight owning string container with explicit length semantics (no implicit null terminator). More...
#include <str.h>
Public Member Functions | |
| str ()=default | |
| Constructs an empty string. | |
| str (str_view view) | |
| Constructs a string by copying view contents. | |
| template<size_t N> | |
| str (const char(&lit)[N]) | |
| Constructs a string from literal lit, excluding trailing null terminator. | |
| void | clear () |
| Removes all characters from the string. | |
| void | reserve (uint32_t len) |
| Reserves capacity for at least len characters. | |
| void | assign (const char *data, uint32_t size) |
| Replaces contents with size characters from data. | |
| void | assign (str_view view) |
| Replaces contents with view contents. | |
| template<size_t N> | |
| void | assign (const char(&lit)[N]) |
| Replaces contents with literal lit. | |
| void | append (const char *data, uint32_t size) |
| Appends size characters from data. | |
| void | append (str_view view) |
| Appends view contents. | |
| template<size_t N> | |
| void | append (const char(&lit)[N]) |
| Appends literal lit. | |
| void | append (char ch) |
| Appends a single character. | |
| GAIA_NODISCARD const char * | data () const |
| Returns read-only pointer to internal data. | |
| GAIA_NODISCARD char * | data () |
| Returns mutable pointer to internal data. | |
| GAIA_NODISCARD uint32_t | size () const |
| Returns number of characters stored in the string. | |
| GAIA_NODISCARD bool | empty () const |
| Checks whether the string contains no characters. | |
| GAIA_NODISCARD str_view | view () const |
| Returns a non-owning view over the current contents. | |
| GAIA_NODISCARD | operator str_view () const |
| Implicit conversion to non-owning view. | |
| template<size_t N> | |
| GAIA_NODISCARD bool | operator== (const char(&lit)[N]) const |
| Compares this string with literal lit for exact byte equality. | |
| GAIA_NODISCARD bool | operator== (str_view other) const |
| Compares this string with view other for exact byte equality. | |
| GAIA_NODISCARD bool | operator== (const str &other) const |
| Compares this string with string other for exact byte equality. | |
| GAIA_NODISCARD uint32_t | find (str_view value, uint32_t pos=0) const |
| Finds the first occurrence of substring value starting at index pos. | |
| GAIA_NODISCARD uint32_t | find (const char *value, uint32_t len, uint32_t pos) const |
| Finds the first occurrence of a character sequence starting at index pos. | |
| template<size_t N> | |
| GAIA_NODISCARD uint32_t | find (const char(&lit)[N], uint32_t pos=0) const |
| Finds the first occurrence of literal lit starting at index pos. | |
| GAIA_NODISCARD uint32_t | find (char ch, uint32_t pos=0) const |
| Finds the first occurrence of character ch starting at index pos. | |
| GAIA_NODISCARD uint32_t | find_first_of (str_view chars, uint32_t pos=0) const |
| Finds the first character that is present in set chars. | |
| GAIA_NODISCARD uint32_t | find_first_of (char ch, uint32_t pos=0) const |
| Finds the first occurrence of character ch. | |
| template<size_t N> | |
| GAIA_NODISCARD uint32_t | find_first_of (const char(&lit)[N], uint32_t pos=0) const |
| Finds the first character that is present in literal set lit. | |
| GAIA_NODISCARD uint32_t | find_last_of (str_view chars, uint32_t pos=BadIndex) const |
| Finds the last character that is present in set chars. | |
| GAIA_NODISCARD uint32_t | find_last_of (char ch, uint32_t pos=BadIndex) const |
| Finds the last occurrence of character ch. | |
| template<size_t N> | |
| GAIA_NODISCARD uint32_t | find_last_of (const char(&lit)[N], uint32_t pos=BadIndex) const |
| Finds the last character that is present in literal set lit. | |
| GAIA_NODISCARD uint32_t | find_first_not_of (str_view chars, uint32_t pos=0) const |
| Finds the first character that is NOT present in set chars. | |
| GAIA_NODISCARD uint32_t | find_first_not_of (char ch, uint32_t pos=0) const |
| Finds the first character that is different from ch. | |
| template<size_t N> | |
| GAIA_NODISCARD uint32_t | find_first_not_of (const char(&lit)[N], uint32_t pos=0) const |
| Finds the first character that is NOT present in literal set lit. | |
| GAIA_NODISCARD uint32_t | find_last_not_of (str_view chars, uint32_t pos=BadIndex) const |
| Finds the last character that is NOT present in set chars. | |
| GAIA_NODISCARD uint32_t | find_last_not_of (char ch, uint32_t pos=BadIndex) const |
| Finds the last character that is different from ch. | |
| template<size_t N> | |
| GAIA_NODISCARD uint32_t | find_last_not_of (const char(&lit)[N], uint32_t pos=BadIndex) const |
| Finds the last character that is NOT present in literal set lit. | |
Public Attributes | |
| cnt::darray< char > | m_data |
Lightweight owning string container with explicit length semantics (no implicit null terminator).
|
inlineexplicit |
Constructs a string by copying view contents.
| view | Source view. |
|
inlineexplicit |
Constructs a string from literal lit, excluding trailing null terminator.
| N | Number of characters in the literal including the trailing null terminator. |
| lit | Source literal. |
|
inline |
Appends a single character.
| ch | Character to append. |
|
inline |
Appends size characters from data.
| data | Source pointer. |
| size | Number of characters to append. |
|
inline |
Appends literal lit.
| N | Number of characters in the literal including the trailing null terminator. |
| lit | Source literal. |
|
inline |
Appends view contents.
| view | Source view. |
|
inline |
Replaces contents with size characters from data.
| data | Source pointer. |
| size | Number of characters to copy. |
|
inline |
Replaces contents with literal lit.
| N | Number of characters in the literal including the trailing null terminator. |
| lit | Source literal. |
|
inline |
Replaces contents with view contents.
| view | Source view. |
|
inline |
Returns mutable pointer to internal data.
|
inline |
Returns read-only pointer to internal data.
|
inline |
Checks whether the string contains no characters.
|
inline |
Finds the first occurrence of character ch starting at index pos.
| ch | Needle character. |
| pos | Start position in this string. |
|
inline |
Finds the first occurrence of a character sequence starting at index pos.
| value | Needle pointer. |
| len | Number of needle characters. |
| pos | Start position in this string. |
|
inline |
Finds the first occurrence of literal lit starting at index pos.
| N | Number of characters in the literal including the trailing null terminator. |
| lit | Needle literal. |
| pos | Start position in this string. |
|
inline |
Finds the first occurrence of substring value starting at index pos.
| value | Needle view. |
| pos | Start position in this string. |
|
inline |
Finds the first character that is different from ch.
| ch | Excluded character. |
| pos | Start position in this string. |
|
inline |
Finds the first character that is NOT present in literal set lit.
| N | Number of characters in the literal including the trailing null terminator. |
| lit | Set literal. |
| pos | Start position in this string. |
|
inline |
Finds the first character that is NOT present in set chars.
| chars | Set of excluded characters. |
| pos | Start position in this string. |
|
inline |
Finds the first occurrence of character ch.
| ch | Needle character. |
| pos | Start position in this string. |
|
inline |
Finds the first character that is present in literal set lit.
| N | Number of characters in the literal including the trailing null terminator. |
| lit | Set literal. |
| pos | Start position in this string. |
|
inline |
Finds the first character that is present in set chars.
| chars | Set of accepted characters. |
| pos | Start position in this string. |
|
inline |
Finds the last character that is different from ch.
| ch | Excluded character. |
| pos | Maximum position to consider, BadIndex means end of string. |
|
inline |
Finds the last character that is NOT present in literal set lit.
| N | Number of characters in the literal including the trailing null terminator. |
| lit | Set literal. |
| pos | Maximum position to consider, BadIndex means end of string. |
|
inline |
Finds the last character that is NOT present in set chars.
| chars | Set of excluded characters. |
| pos | Maximum position to consider, BadIndex means end of string. |
|
inline |
Finds the last occurrence of character ch.
| ch | Needle character. |
| pos | Maximum position to consider, BadIndex means end of string. |
|
inline |
Finds the last character that is present in literal set lit.
| N | Number of characters in the literal including the trailing null terminator. |
| lit | Set literal. |
| pos | Maximum position to consider, BadIndex means end of string. |
|
inline |
Finds the last character that is present in set chars.
| chars | Set of accepted characters. |
| pos | Maximum position to consider, BadIndex means end of string. |
|
inline |
Implicit conversion to non-owning view.
|
inline |
Compares this string with literal lit for exact byte equality.
| N | Number of characters in the literal including the trailing null terminator. |
| lit | Literal to compare with. |
|
inline |
Compares this string with string other for exact byte equality.
| other | String to compare with. |
|
inline |
Compares this string with view other for exact byte equality.
| other | View to compare with. |
|
inline |
Reserves capacity for at least len characters.
| len | Target character capacity. |
|
inline |
Returns number of characters stored in the string.
|
inline |
Returns a non-owning view over the current contents.