Clarisse 5.0 SP8 SDK
5.0.5.8.0
|
Public Member Functions | |
CoreBasicString (void) | |
CoreBasicString (const char *data, size_t length=CORE_INVALID_INDEX_64) | |
bool | is_empty () const |
unsigned int | get_length () const |
unsigned int | get_count () const |
unsigned int | get_capacity () const |
const char * | get_data () const |
const char & | front () const |
const char & | first () const |
const char & | back () const |
const char & | last () const |
const char & | operator[] (unsigned int index) const |
bool | start_with (const CoreBasicString &str) const |
bool | end_with (const CoreBasicString &str) const |
bool | contains (const CoreBasicString &str) const |
unsigned int | count_occurences (char token) const |
unsigned int | find (const CoreBasicString &str, unsigned int start_index=0) const |
unsigned int | find (char str, unsigned int start_index=0) const |
unsigned int | rev_find (const CoreBasicString &str, unsigned int start_index=CORE_INVALID_INDEX) const |
unsigned int | rev_find (char c, unsigned int start_index=CORE_INVALID_INDEX) const |
bool | start_with (const char *str) const |
bool | end_with (const char *str) const |
bool | contains (const char *str) const |
unsigned int | find (const char *str, unsigned int start_index=0) const |
unsigned int | rev_find (const char *str, unsigned int start_index=CORE_INVALID_INDEX) const |
CoreBasicStringIterator< true > | begin (void) const |
CoreBasicStringIterator< true > | end (void) const |
bool | operator== (const CoreBasicString &str) const |
bool | operator== (const char *str) const |
bool | operator!= (const CoreBasicString &str) const |
bool | operator!= (const char *str) const |
bool | operator< (const CoreBasicString &str) const |
bool | operator< (const char *str) const |
Static Public Attributes | |
static constexpr unsigned int | INVALID_INDEX = CORE_INVALID_INDEX |
For backward compatibility only. Please use CORE_INVALID_INDEX instead. | |
Protected Member Functions | |
constexpr | CoreBasicString (const char *data, size_t length, unsigned int capacity) |
Protected Attributes | |
char * | m_data |
Pointer to the first element of the string. | |
unsigned int | m_length |
The length of the string. | |
unsigned int | m_capacity |
Base interface for string manipulation. Only provides a read-only API. This class does not own the string data and all of its methods are const and do not provide any mean to modify its value.
For write operations, use CoreString. For constexpr strings, use CoreStringView.
|
inline |
Empty constructor
|
inline |
Public string literal constructor. See CoreBasicString(const char *, size_t, unsigned int)
|
explicitprotected |
Private constructor used by the default CoreString constructor, and the CoreStringView constructors.
data | The string data. CoreBasicString will NOT own this data. Make sure it persists during the lifetime of this instance. |
length | Number of characters in the string. |
capacity | When inherited by CoreString, set the capacity of the data buffer. |
|
inline |
Get the last char. Asserts if the data is null.
|
inline |
Get a pointer to the beginning of the string. Asserts if the string is empty.
|
inline |
Check if the string contains another one.
|
inline |
See contains(const CoreBasicString&)
unsigned int CoreBasicString::count_occurences | ( | char | token | ) | const |
Count all occurences of a character in string
token | character to look for |
|
inline |
Get a pointer to the end of the string. Asserts if the string is empty.
|
inline |
Check if the string ends with another string.
|
inline |
See end_with(const CoreBasicString&)
unsigned int CoreBasicString::find | ( | const CoreBasicString & | str, |
unsigned int | start_index = 0 |
||
) | const |
Find a string starting at an optional index.
str | The string to look for |
start_index | Optional index where to start looking. 0 by default. |
str
, or CORE_INVALID_INDEX if not found. unsigned int CoreBasicString::find | ( | char | c, |
unsigned int | start_index = 0 |
||
) | const |
Find the first occurence of a given character.
c | The character to look for |
start_index | Optional index where to start looking. 0 by default. This will assert if start_index is out of range. |
str
, or CORE_INVALID_INDEX if not found.
|
inline |
See find(const CoreBasicString&, unsigned int)
|
inline |
Same as front()
|
inline |
Get the first char. Asserts if the data is null.
|
inline |
Return the capacity (the size of the internal buffer)
|
inline |
Same as get_length (don't ask me why...)
|
inline |
Get the wrapped char pointer
|
inline |
Get the length of the string
|
inline |
Check if the string is empty or not
|
inline |
Same as back()
|
inline |
Inequality operator
|
inline |
Inequality operator. str
must be a null terminated string.
|
inline |
Less than comparison operator
|
inline |
Less than comparison operator. str
must be a null terminated string.
|
inline |
Equality operator
|
inline |
Equality operator. str
must be a null terminated string.
|
inline |
Get a character by index. This will assert if index
is out of range, or if the data is null.
unsigned int CoreBasicString::rev_find | ( | const CoreBasicString & | str, |
unsigned int | start_index = CORE_INVALID_INDEX |
||
) | const |
Same as find(), but search in a reverse order. start_index
is a bit weird in this case: imagine that a sub string in the range [0, start_index[ is created, and then this sub string is searched for str
in reverse order.
unsigned int CoreBasicString::rev_find | ( | char | c, |
unsigned int | start_index = CORE_INVALID_INDEX |
||
) | const |
Reverse-find a character. Search will start at start_index
and go to index 0.
|
inline |
See rev_find(const CoreBasicString&, unsigned int)
|
inline |
Check if this string starts with another string.
|
inline |
See start_with(const CoreBasicString&)
|
protected |
Ok, after m_length, we WILL have padding when inheriting CoreBasicString. And since most classes implementing CoreBasicString will need some other data (CoreString stores the buffer's capacity, string views and const strings store the hash) we create the member here to avoid wasting the space. So even if it's named m_capacity, it's not used in this class, and might be used to store what you need in child classes.