![]() |
Gaia-ECS v0.9.3
A simple and powerful entity component system
|
Lightweight non-owning string view over a character sequence. More...
#include <str.h>
Public Member Functions | |
| str_view ()=default | |
| Constructs an empty string view. | |
| constexpr | str_view (const char *data, uint32_t size) |
| Constructs a string view from a pointer and an explicit length. | |
| template<size_t N> | |
| constexpr | str_view (const char(&lit)[N]) |
| Constructs a string view from a literal, excluding its trailing null terminator. | |
| GAIA_NODISCARD constexpr const char * | data () const |
| Returns the underlying character pointer. | |
| GAIA_NODISCARD constexpr uint32_t | size () const |
| Returns the number of characters in the view. | |
| GAIA_NODISCARD constexpr bool | empty () const |
| Checks whether the view contains no characters. | |
| GAIA_NODISCARD constexpr uint32_t | find (str_view value, uint32_t pos=0) const |
| Finds the first occurrence of substring value starting at index pos. | |
| GAIA_NODISCARD constexpr 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 constexpr 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 constexpr uint32_t | find (char ch, uint32_t pos=0) const |
| Finds the first occurrence of character ch starting at index pos. | |
| GAIA_NODISCARD constexpr 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 constexpr 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 constexpr 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 constexpr 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 constexpr 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 constexpr 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 constexpr 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 constexpr 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 constexpr 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 constexpr 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 constexpr 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 constexpr 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. | |
| template<size_t N> | |
| GAIA_NODISCARD constexpr bool | operator== (const char(&lit)[N]) const |
| Compares this view with literal lit for exact byte equality. | |
| GAIA_NODISCARD constexpr bool | operator== (str_view other) const |
| Compares this view with view other for exact byte equality. | |
| GAIA_NODISCARD constexpr bool | operator!= (str_view other) const |
| Compares this view with view other for exact byte inequality. | |
Public Attributes | |
| const char * | m_data = nullptr |
| uint32_t | m_size = 0 |
Lightweight non-owning string view over a character sequence.
|
inlineconstexpr |
Constructs a string view from a pointer and an explicit length.
| data | Pointer to the first character. Can be nullptr if size is 0. |
| size | Number of characters in the view. |
|
inlineconstexpr |
Constructs a string view from a literal, excluding its trailing null terminator.
| N | Number of characters in the literal including the trailing null terminator. |
| lit | String literal. |
|
inlineconstexpr |
Returns the underlying character pointer.
|
inlineconstexpr |
Checks whether the view contains no characters.
|
inlineconstexpr |
Finds the first occurrence of character ch starting at index pos.
| ch | Needle character. |
| pos | Start position in this view. |
|
inlineconstexpr |
Finds the first occurrence of a character sequence starting at index pos.
| value | Needle pointer. |
| len | Number of characters in value. |
| pos | Start position in this view. |
|
inlineconstexpr |
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 view. |
|
inlineconstexpr |
Finds the first occurrence of substring value starting at index pos.
| value | Needle string view. |
| pos | Start position in this view. |
|
inlineconstexpr |
Finds the first character that is different from ch.
| ch | Excluded character. |
| pos | Start position in this view. |
|
inlineconstexpr |
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 view. |
|
inlineconstexpr |
Finds the first character that is NOT present in set chars.
| chars | Set of excluded characters. |
| pos | Start position in this view. |
|
inlineconstexpr |
Finds the first occurrence of character ch.
| ch | Needle character. |
| pos | Start position in this view. |
|
inlineconstexpr |
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 view. |
|
inlineconstexpr |
Finds the first character that is present in set chars.
| chars | Set of accepted characters. |
| pos | Start position in this view. |
|
inlineconstexpr |
Finds the last character that is different from ch.
| ch | Excluded character. |
| pos | Maximum position to consider, BadIndex means end of view. |
|
inlineconstexpr |
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 view. |
|
inlineconstexpr |
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 view. |
|
inlineconstexpr |
Finds the last occurrence of character ch.
| ch | Needle character. |
| pos | Maximum position to consider, BadIndex means end of view. |
|
inlineconstexpr |
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 view. |
|
inlineconstexpr |
Finds the last character that is present in set chars.
| chars | Set of accepted characters. |
| pos | Maximum position to consider, BadIndex means end of view. |
|
inlineconstexpr |
Compares this view with view other for exact byte inequality.
| other | View to compare with. |
|
inlineconstexpr |
Compares this view with literal lit for exact byte equality.
| N | Number of characters in the literal including the trailing null terminator. |
| lit | Literal to compare with. |
|
inlineconstexpr |
Compares this view with view other for exact byte equality.
| other | View to compare with. |
|
inlineconstexpr |
Returns the number of characters in the view.