A non-modifiable owning string with associated encoding.
More...
#include <String.h>
|
auto | nativeWritableBytesIncludingTerminator () |
|
|
struct | SmallStringTest |
|
struct | StringBuilder |
|
struct | StringConverter |
|
struct | FileDescriptor |
|
struct | FileSystem |
|
template<int > |
struct | SmallString |
|
template<typename T > |
struct | Reflection::Reflect |
|
A non-modifiable owning string with associated encoding.
SC::String is (currently) implemented as a SC::Vector with the associated string encoding. A SC::StringView can be obtained from it calling SC::String::view method but it's up to the user making sure that the usage of such SC::StringView doesn't exceed lifetime of the SC::String it originated from (but thankfully Address Sanitizer will catch the issue if it goes un-noticed).
◆ String() [1/3]
Builds an empty String with a given Encoding.
- Parameters
-
encoding | The encoding of the String |
◆ String() [2/3]
Builds String from a StringView.
- Parameters
-
- Warning
- This function will assert if StringView::assign fails
◆ String() [3/3]
SC::String::String |
( |
const char(&) |
text[N] | ) |
|
|
inline |
Builds String with a null terminated char string literal.
- Template Parameters
-
N | Length of the string literal (including null terminator) |
- Parameters
-
text | Pointer to string literal |
- Warning
- This function will assert if StringView::assign fails
◆ assign()
Assigns a StringView to this String, replacing existing contents.
- Parameters
-
- Returns
true
if StringView is assigned successfully
- Note
- This method will invalidate any
StringView::view
previously obtained
◆ bytesIncludingTerminator()
const char * SC::String::bytesIncludingTerminator |
( |
| ) |
const |
|
inline |
Access current string content as read-only null-terminated const char*
- Returns
- A null terminated
const char*
◆ getEncoding()
◆ isEmpty()
bool SC::String::isEmpty |
( |
| ) |
const |
|
inline |
◆ operator!=() [1/3]
bool SC::String::operator!= |
( |
const char(&) |
other[N] | ) |
const |
|
inline |
Check if current String is different from the ascii string literal.
- Template Parameters
-
N | Length of string literal, including null terminator |
- Parameters
-
- Returns
true
if the String is different from other
◆ operator!=() [2/3]
bool SC::String::operator!= |
( |
const String & |
other | ) |
const |
|
inline |
Check if current String is different from other String.
- Parameters
-
- Returns
true
if the two strings are different
◆ operator!=() [3/3]
bool SC::String::operator!= |
( |
const StringView |
other | ) |
const |
|
inline |
◆ operator<()
bool SC::String::operator< |
( |
const StringView |
other | ) |
const |
|
inline |
◆ operator=()
String & SC::String::operator= |
( |
const char(&) |
text[N] | ) |
|
|
inline |
Assigns an ascii string literal to current String.
- Template Parameters
-
N | Length of string literal, including null terminator |
- Parameters
-
- Returns
- Reference to current String
- Warning
- Assignment operator will assert if String::assign fails
◆ operator==() [1/3]
bool SC::String::operator== |
( |
const char(&) |
other[N] | ) |
const |
|
inline |
Check if current String is equal to the ascii string literal.
- Template Parameters
-
N | Length of string literal, including null terminator |
- Parameters
-
- Returns
true
if the String is the same as other
◆ operator==() [2/3]
bool SC::String::operator== |
( |
const String & |
other | ) |
const |
|
inline |
Check if current String is same as other String.
- Parameters
-
- Returns
true
if the two strings are equal
◆ operator==() [3/3]
bool SC::String::operator== |
( |
const StringView |
other | ) |
const |
|
inline |
◆ owns()
◆ sizeInBytesIncludingTerminator()
size_t SC::String::sizeInBytesIncludingTerminator |
( |
| ) |
const |
|
inline |
Get length of the string in bytes (including null terminator bytes)
- Returns
- Size in bytes including null terminator
◆ view()
The documentation for this struct was generated from the following file: