Wide counterpart of String. More...
#include <StormByte/string/wstring.hxx>
Public Types | |
| using | value_type = wchar_t |
| Code unit type. | |
| using | const_iterator = const wchar_t * |
| Contiguous observer. | |
| using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
| Reverse observer. | |
Public Member Functions | |
| void | swap (WString &other) noexcept |
Swaps buffers with other. | |
Life | |
| WString () noexcept | |
| Null text. | |
| WString (const wchar_t *str) noexcept | |
| Copies a wide C string. | |
| WString (std::wstring_view str) noexcept | |
| Copies a view into an owned NUL-terminated buffer. | |
| WString (WCString text) noexcept | |
| Takes an owned buffer. | |
| WString (const String &other) noexcept | |
| Wide text from UTF-8. | |
| WString (const WString &other) noexcept | |
| Copy constructor. | |
| WString (WString &&other) noexcept | |
| Move constructor. | |
| ~WString () noexcept=default | |
| Releases the buffer. | |
| WString & | operator= (const WString &other) noexcept |
| Copy assignment. | |
| WString & | operator= (WString &&other) noexcept |
| Move assignment. | |
Range | |
| const_iterator | begin () const noexcept |
| First character, or null. | |
| const_iterator | end () const noexcept |
| One past the last character, or null. | |
| const_iterator | cbegin () const noexcept |
| First character, or null. | |
| const_iterator | cend () const noexcept |
| One past the last character, or null. | |
| const_reverse_iterator | rbegin () const noexcept |
| Reverse begin. | |
| const_reverse_iterator | rend () const noexcept |
| Reverse end. | |
| const_reverse_iterator | crbegin () const noexcept |
| Reverse begin. | |
| const_reverse_iterator | crend () const noexcept |
| Reverse end. | |
| const wchar_t * | data () const noexcept |
| Contiguous pointer; null when the buffer is null. | |
| std::size_t | size () const noexcept |
Code-unit count; 0 when null or empty. | |
| std::size_t | length () const noexcept |
| Same as size. | |
| bool | empty () const noexcept |
| Whether size is zero. | |
| wchar_t | operator[] (std::size_t index) const noexcept |
Code unit at index. | |
| operator bool () const noexcept | |
| Whether a buffer is held. | |
Conversions | |
| operator std::wstring_view () const noexcept | |
| Non-owning view of the text. | |
| operator std::wstring () const | |
| Copy of the text in the caller’s heap. | |
| operator const wchar_t * () const noexcept | |
| View of the owned buffer. | |
| operator String () const noexcept | |
| UTF-8 text (wide encoded in the module). | |
| const WCString & | Bytes () const noexcept |
| Owned code units. | |
Comparison | |
| bool | operator== (const WString &other) const noexcept |
| Content equality. | |
| bool | operator!= (const WString &other) const noexcept |
| Content inequality. | |
| bool | operator== (const wchar_t *str) const noexcept |
| Content equality with a wide C string. | |
| bool | operator!= (const wchar_t *str) const noexcept |
| Content inequality with a wide C string. | |
| std::strong_ordering | operator<=> (const WString &other) const noexcept |
| Content order. | |
| std::strong_ordering | operator<=> (const wchar_t *str) const noexcept |
| Content order against a wide C string. | |
Helpers | |
| WString | ToLower () const noexcept |
| ASCII-letter lower case of this text. | |
| WString | ToUpper () const noexcept |
| ASCII-letter upper case of this text. | |
| WString | SanitizeNewlines () const noexcept |
| CR LF to LF on this text. | |
| WString | RemoveWhitespace () const noexcept |
Drops iswspace code units from this text. | |
| bool | IsInteger () const noexcept |
| Whether this text is an integer token. | |
| std::vector< WString > | Split () const noexcept |
| Whitespace-separated tokens. | |
| std::queue< WString > | Explode (wchar_t delimiter) const noexcept |
Tokens on delimiter. | |
| static WString | ToLower (std::wstring_view str) noexcept |
| ASCII-letter lower case; other code points copied. | |
| static WString | ToUpper (std::wstring_view str) noexcept |
| ASCII-letter upper case; other code points copied. | |
| static WString | SanitizeNewlines (std::wstring_view str) noexcept |
| Turns CR LF into LF. | |
| static WString | RemoveWhitespace (std::wstring_view str) noexcept |
Drops iswspace code units. | |
| static bool | IsInteger (std::wstring_view str) noexcept |
| Optional sign plus ASCII digits. | |
| static void | Split (std::wstring_view str, std::vector< WString > &out) noexcept |
| Whitespace-separated tokens. | |
| static void | Explode (std::wstring_view str, wchar_t delimiter, std::queue< WString > &out) noexcept |
Tokens on delimiter. | |
Wide counterpart of String.
Owned wide text composed of StormByte::WCString.
Defined in wstring.hxx.
Not a std::wstring. Iterators are constant and contiguous so algorithms that read a range of wchar_t work. In-place mutating algorithms do not: helpers return a new WString.
operator std::wstring_view is implicit and inline. operator std::wstring is explicit and inline (caller heap).
Conversion to String is explicit and runs in the module (wide → UTF-8). Conversion from String copies wide units in the module.
ToUpper / ToLower map only ASCII A–Z / a–z (as wchar_t). Other code points are copied. On 16-bit wchar_t, a well-formed surrogate pair is copied together.
| using StormByte::String::WString::const_iterator = const wchar_t* |
Contiguous observer.
| using StormByte::String::WString::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Reverse observer.
| using StormByte::String::WString::value_type = wchar_t |
Code unit type.
|
noexcept |
Null text.
|
explicitnoexcept |
Copies a wide C string.
| str | Source; may be null. |
|
explicitnoexcept |
Copies a view into an owned NUL-terminated buffer.
| str | Source. |
|
explicitnoexcept |
Takes an owned buffer.
| text | Buffer. |
|
explicitnoexcept |
Wide text from UTF-8.
| other | UTF-8 source. |
|
noexcept |
Copy constructor.
| other | Text to copy. |
|
noexcept |
Move constructor.
| other | Text to take. other becomes null. |
|
defaultnoexcept |
Releases the buffer.
|
inlinenoexcept |
First character, or null.
|
inlinenoexcept |
Owned code units.
|
inlinenoexcept |
First character, or null.
|
inlinenoexcept |
One past the last character, or null.
|
inlinenoexcept |
Reverse begin.
|
inlinenoexcept |
Reverse end.
|
inlinenoexcept |
Contiguous pointer; null when the buffer is null.
|
inlinenoexcept |
Whether size is zero.
|
inlinenoexcept |
One past the last character, or null.
|
staticnoexcept |
Tokens on delimiter.
out is the caller’s container.
| str | Source. | |
| delimiter | Separator. | |
| [out] | out | Tokens, including empty ones. |
|
inlinenoexcept |
Tokens on delimiter.
The queue is built in the caller.
| delimiter | Separator. |
|
inlinenoexcept |
Whether this text is an integer token.
|
staticnoexcept |
Optional sign plus ASCII digits.
| str | Source. |
str is an integer token.
|
inlinenoexcept |
Same as size.
|
inlineexplicitnoexcept |
Whether a buffer is held.
false only for a null WCString. L"" is valid and empty.
|
inlineexplicitnoexcept |
View of the owned buffer.
std::wstring::c_str().
|
inlineexplicit |
Copy of the text in the caller’s heap.
|
inlinenoexcept |
Non-owning view of the text.
std::wstring::c_str().
|
explicitnoexcept |
UTF-8 text (wide encoded in the module).
|
inlinenoexcept |
Content inequality with a wide C string.
| str | May be null. |
|
inlinenoexcept |
Content inequality.
| other | Other text. |
|
inlinenoexcept |
Content order against a wide C string.
| str | May be null. |
|
inlinenoexcept |
Content order.
Null is less than any text.
| other | Other text. |
Copy assignment.
| other | Text to copy. |
Move assignment.
| other | Text to take. other becomes null. |
|
inlinenoexcept |
Content equality with a wide C string.
| str | May be null. |
|
inlinenoexcept |
Content equality.
| other | Other text. |
|
inlinenoexcept |
|
inlinenoexcept |
Reverse begin.
|
inlinenoexcept |
Drops iswspace code units from this text.
|
staticnoexcept |
Drops iswspace code units.
| str | Source. |
|
inlinenoexcept |
Reverse end.
|
inlinenoexcept |
CR LF to LF on this text.
|
staticnoexcept |
Turns CR LF into LF.
| str | Source. |
|
inlinenoexcept |
Code-unit count; 0 when null or empty.
|
inlinenoexcept |
Whitespace-separated tokens.
The vector is built in the caller.
|
staticnoexcept |
Whitespace-separated tokens.
out is the caller’s container.
| str | Source. | |
| [out] | out | Tokens. |
|
noexcept |
Swaps buffers with other.
| other | Other text. |
|
inlinenoexcept |
ASCII-letter lower case of this text.
|
staticnoexcept |
ASCII-letter lower case; other code points copied.
| str | Source. |
|
inlinenoexcept |
ASCII-letter upper case of this text.
|
staticnoexcept |
ASCII-letter upper case; other code points copied.
| str | Source. |