Wide counterpart of String. More...
#include <StormByte/safe/wstring.hxx>

Public Types | |
| using | value_type = wchar_t |
| Code unit type. | |
| using | size_type = Size |
| Unit count and position type. | |
| using | difference_type = std::ptrdiff_t |
| Iterator distance type. | |
| using | pointer = wchar_t* |
| Mutable buffer pointer. | |
| using | const_pointer = const wchar_t* |
| Read-only buffer pointer. | |
| using | reference = wchar_t& |
| Mutable unit reference. | |
| using | const_reference = const wchar_t& |
| Read-only unit reference. | |
| using | iterator = wchar_t* |
| Mutable contiguous iterator. | |
| using | const_iterator = const wchar_t* |
| Contiguous observer. | |
| using | reverse_iterator = std::reverse_iterator<iterator> |
| Mutable reverse observer. | |
| using | const_reverse_iterator = std::reverse_iterator<const_iterator> |
| Reverse observer. | |
Public Member Functions | |
| void | swap (WString &other) noexcept |
Swaps storage with other. | |
Life | |
| WString () noexcept | |
| Empty text. | |
| WString (const wchar_t *str) | |
| Copies a wide C string. | |
| WString (std::wstring_view str) | |
| Copies a view into owned storage. | |
| WString (size_type count, wchar_t character) | |
Construct count copies of character. | |
| WString (const WString &other, size_type pos, size_type count=npos) | |
Copy a slice of other. | |
| template<std::input_iterator InputIt> | |
| WString (InputIt first, InputIt last) | |
| Copy the unit range [first, last). | |
| WString (const String &other) | |
| Wide text from UTF-8, including an empty source. | |
| WString (const WString &other) | |
| Copy constructor. | |
| WString (WString &&other) noexcept | |
| Move constructor. | |
| ~WString () noexcept | |
| Releases a long buffer. | |
| WString & | operator= (const WString &other) |
| Copy assignment. | |
| WString & | operator= (WString &&other) noexcept |
| Move assignment. | |
| WString & | operator= (std::wstring_view text) |
| Copy text from a caller-owned view. | |
Conversions | |
| operator std::wstring_view () const noexcept | |
| Non-owning view of the text. | |
| STORMBYTE_FORCE_INLINE | 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 | |
| UTF-8 text decoded in the module. | |
| const wchar_t * | Bytes () const noexcept |
| Non-owning view of the owned 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. | |
| STORMBYTE_FORCE_INLINE std::strong_ordering | operator<=> (const WString &other) const noexcept |
| Content order. | |
| STORMBYTE_FORCE_INLINE std::strong_ordering | operator<=> (const wchar_t *str) const noexcept |
| Content order against a wide C string. | |
Static Public Attributes | |
| static constexpr std::size_t | SSO_CAPACITY = 11 |
| Short capacity, excluding the trailing NUL. | |
Lookup | |
| static constexpr size_type | npos {~0ull} |
| Not found. | |
| bool | starts_with (std::wstring_view text) const noexcept |
Whether the text begins with text. | |
| bool | starts_with (wchar_t ch) const noexcept |
Whether the text begins with ch. | |
| bool | ends_with (std::wstring_view text) const noexcept |
Whether the text ends with text. | |
| bool | ends_with (wchar_t ch) const noexcept |
Whether the text ends with ch. | |
| bool | contains (std::wstring_view text) const noexcept |
Whether text occurs. | |
| bool | contains (wchar_t ch) const noexcept |
Whether ch occurs. | |
| Size | find (std::wstring_view text, Size pos={}) const noexcept |
First occurrence of text at or after pos. | |
| Size | find (wchar_t ch, Size pos={}) const noexcept |
First occurrence of ch at or after pos. | |
| Size | find (const wchar_t *text, Size pos, Size count) const noexcept |
First occurrence of count units of text. | |
| Size | rfind (std::wstring_view text, Size pos=npos) const noexcept |
Last occurrence of text at or before pos. | |
| Size | rfind (wchar_t ch, Size pos=npos) const noexcept |
Last occurrence of ch at or before pos. | |
| Size | rfind (const wchar_t *text, Size pos, Size count) const noexcept |
Last occurrence of count units of text. | |
| Size | find_first_of (std::wstring_view text, Size pos={}) const noexcept |
First unit that is in text, at or after pos. | |
| Size | find_first_of (wchar_t ch, Size pos={}) const noexcept |
First ch at or after pos. | |
| Size | find_last_of (std::wstring_view text, Size pos=npos) const noexcept |
Last unit that is in text, at or before pos. | |
| Size | find_last_of (wchar_t ch, Size pos=npos) const noexcept |
Last ch at or before pos. | |
| Size | find_first_not_of (std::wstring_view text, Size pos={}) const noexcept |
First unit that is not in text, at or after pos. | |
| Size | find_first_not_of (wchar_t ch, Size pos={}) const noexcept |
First unit other than ch, at or after pos. | |
| Size | find_last_not_of (std::wstring_view text, Size pos=npos) const noexcept |
Last unit that is not in text, at or before pos. | |
| Size | find_last_not_of (wchar_t ch, Size pos=npos) const noexcept |
Last unit other than ch, at or before pos. | |
| WString | substr (Size pos={}, Size count=npos) const noexcept |
| Copy of a slice. | |
| int | compare (std::wstring_view text) const noexcept |
| Same order as std::wstring_view::compare. | |
| int | compare (size_type pos, size_type count, std::wstring_view text) const noexcept |
Compare a slice with text. | |
| wchar_t & | front () noexcept |
| First unit. | |
| wchar_t | front () const noexcept |
| Read the first unit. | |
| wchar_t & | back () noexcept |
| Last unit. | |
| wchar_t | back () const noexcept |
| Read the last unit. | |
Range | |
| iterator | begin () noexcept |
| First unit. | |
| const_iterator | begin () const noexcept |
| First unit. | |
| iterator | end () noexcept |
| One past the last unit. | |
| const_iterator | end () const noexcept |
| One past the last unit. | |
| const_iterator | cbegin () const noexcept |
| First unit. | |
| const_iterator | cend () const noexcept |
| One past the last unit. | |
| reverse_iterator | rbegin () noexcept |
| Reverse begin. | |
| const_reverse_iterator | rbegin () const noexcept |
| Reverse begin. | |
| reverse_iterator | rend () noexcept |
| Reverse end. | |
| const_reverse_iterator | rend () const noexcept |
| Reverse end. | |
| const_reverse_iterator | crbegin () const noexcept |
| Reverse begin. | |
| const_reverse_iterator | crend () const noexcept |
| Reverse end. | |
| wchar_t * | data () noexcept |
| Contiguous pointer to the first unit, or to the trailing NUL when empty. | |
| const wchar_t * | data () const noexcept |
| Read-only contiguous pointer to the first unit, or to the trailing NUL when empty. | |
| const wchar_t * | c_str () const noexcept |
| Same pointer as data. | |
| Size | size () const noexcept |
| Unit count, excluding the trailing NUL. | |
| Size | capacity () const noexcept |
| Allocated unit capacity, excluding the trailing NUL. | |
| Size | max_size () const noexcept |
| Largest representable unit count. | |
| Size | length () const noexcept |
| Same as Size. | |
| bool | empty () const noexcept |
| Whether Size is zero. | |
| WString & | append (std::wstring_view text) |
| Append wide code units. | |
| WString & | append (size_type count, wchar_t character) |
| Append count copies of a wide code unit. | |
| template<std::input_iterator InputIt> | |
| WString & | append (InputIt first, InputIt last) |
| Append the unit range [first, last). | |
| template<std::ranges::input_range R> | |
| WString & | append_range (R &&range) |
Append a copy of range. | |
| WString & | assign (std::wstring_view text) |
| Replace the contents with a wide text view. | |
| WString & | assign (size_type count, wchar_t character) |
| Replace the contents with count copies of a wide code unit. | |
| template<std::input_iterator InputIt> | |
| WString & | assign (InputIt first, InputIt last) |
| Replace the contents with [first, last). | |
| template<std::ranges::input_range R> | |
| WString & | assign_range (R &&range) |
Replace the contents with a copy of range. | |
| WString & | operator+= (std::wstring_view text) |
| Append a wide view. | |
| WString & | operator+= (wchar_t character) |
| Append one wide code unit. | |
| void | push_back (wchar_t character) |
| Append one wide code unit. | |
| void | pop_back () |
| Remove the final code unit. | |
| void | clear () |
| Replace the contents with an empty string, retaining long-path capacity. | |
| void | reserve (size_type new_capacity) |
Reserve storage for at least new_capacity code units. | |
| void | shrink_to_fit () |
| Drop unused long-path capacity. | |
| void | resize (size_type count, wchar_t character=wchar_t{}) |
| Resize the unit sequence, filling new units with character. | |
| WString & | insert (size_type position, std::wstring_view text) |
| Insert wide code units at a code-unit position. | |
| WString & | insert (size_type position, size_type count, wchar_t character) |
Insert count copies of character at position. | |
| template<std::input_iterator InputIt> | |
| iterator | insert (const_iterator pos, InputIt first, InputIt last) |
Insert [first, last) before pos. | |
| iterator | insert (const_iterator pos, std::initializer_list< wchar_t > values) |
Insert an initializer list before pos. | |
| template<std::ranges::input_range R> | |
| iterator | insert_range (const_iterator pos, R &&range) |
Insert a copy of range before pos. | |
| WString & | erase (size_type position={}, size_type count=npos) |
| Erase wide code units starting at position. | |
| iterator | erase (const_iterator pos) |
Erase the unit at pos. | |
| iterator | erase (const_iterator first, const_iterator last) |
| Erase [first, last). | |
| WString & | replace (size_type position, size_type count, std::wstring_view text) |
| Replace a wide code-unit range with text. | |
| WString & | replace (const_iterator first, const_iterator last, std::wstring_view text) |
Replace [first, last) with text. | |
| wchar_t & | operator[] (const Size &index) noexcept |
Code unit at index. | |
| wchar_t | operator[] (const Size &index) const noexcept |
Read-only code unit at index. | |
| wchar_t & | at (size_type index) |
Unit at index. | |
| const wchar_t & | at (size_type index) const |
Read-only unit at index. | |
| size_type | copy (wchar_t *dest, size_type count, size_type pos={}) const |
Copy at most count units into dest, starting at pos. | |
| operator bool () const noexcept | |
| Whether the text is non-empty. | |
| template<class... Args> requires (sizeof...(Args) >= 1) | |
| static WString | ReplaceToken (std::wstring_view text, Args &&... args) |
Copy text with each field replaced, in order, by one argument. | |
Helpers | |
| WString | ToLower () const |
| ASCII-letter lower case of this text. | |
| WString | ToUpper () const |
| ASCII-letter upper case of this text. | |
| WString | SanitizeNewlines () const |
| CR LF to LF on this text. | |
| WString | RemoveWhitespace () const |
| Drops wide space units from this text. | |
| bool | IsInteger () const noexcept |
| Whether this text is an integer token. | |
| Vector< WString > | Split () const |
| Whitespace-separated tokens of this text. | |
| Queue< WString > | Explode (wchar_t delimiter) const |
Tokens of this text on delimiter, including empty ones. | |
| static WString | ToLower (std::wstring_view str) |
| ASCII-letter lower case; other units copied. | |
| static WString | ToUpper (std::wstring_view str) |
| ASCII-letter upper case; other units copied. | |
| static WString | SanitizeNewlines (std::wstring_view str) |
| Turns CR LF into LF. | |
| static WString | RemoveWhitespace (std::wstring_view str) |
| Drops wide space units. | |
| static bool | IsInteger (std::wstring_view str) noexcept |
| Optional sign plus ASCII digits. | |
| static Vector< WString > | Split (std::wstring_view str) |
| Whitespace-separated tokens. | |
| static Vector< WString > | Split (const std::vector< WString > &parts) |
| Copy caller-owned tokens into Base storage. | |
| static Queue< WString > | Explode (std::wstring_view str, wchar_t delimiter) |
Tokens on delimiter, including empty ones. | |
| static WString | Implode (const Vector< WString > &parts, std::wstring_view delimiter) |
Join parts with delimiter. | |
| static WString | Implode (const Queue< WString > &parts, std::wstring_view delimiter) |
Join parts with delimiter, in queue order. | |
Wide counterpart of String.
Owned wide text.
Defined in wstring.hxx.
Not a std::wstring. Short text lives in the object, NUL-terminated, with an explicit size. Longer text is a wide buffer freed in Base. There is no null state: a moved-from string is empty. data() and c_str() are never null.
Classic and ranges algorithms can read or modify existing units; they cannot change the owned size. operator std::wstring_view is implicit and inline. operator std::wstring is explicit and STORMBYTE_FORCE_INLINE (caller heap).
Conversion to String is explicit and runs in the module. Conversion from String copies UTF-8 into wide units in the module.
Observers follow std::wstring_view. Size-changing modifiers follow std::wstring value semantics. capacity() and reserve(Size) count code units excluding NUL; reserve never shrinks. size_type is Size. There is no allocator.
Text construction, copying, conversion and transformations may allocate and throw. Default construction, moves and observers do not allocate and remain noexcept.
| using StormByte::Safe::WString::const_iterator = const wchar_t* |
Contiguous observer.
| using StormByte::Safe::WString::const_pointer = const wchar_t* |
Read-only buffer pointer.
| using StormByte::Safe::WString::const_reference = const wchar_t& |
Read-only unit reference.
| using StormByte::Safe::WString::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Reverse observer.
| using StormByte::Safe::WString::difference_type = std::ptrdiff_t |
Iterator distance type.
| using StormByte::Safe::WString::iterator = wchar_t* |
Mutable contiguous iterator.
| using StormByte::Safe::WString::pointer = wchar_t* |
Mutable buffer pointer.
| using StormByte::Safe::WString::reference = wchar_t& |
Mutable unit reference.
| using StormByte::Safe::WString::reverse_iterator = std::reverse_iterator<iterator> |
Mutable reverse observer.
Unit count and position type.
| using StormByte::Safe::WString::value_type = wchar_t |
Code unit type.
|
noexcept |
Empty text.
Not null.
| StormByte::Safe::WString::WString | ( | const wchar_t * | str | ) |
Copies a wide C string.
A null pointer becomes empty.
| str | Source; may be null. |
| StormByte::Safe::WString::WString | ( | std::wstring_view | str | ) |
Copies a view into owned storage.
| str | Source. Embedded NUL counts. |
| StormByte::Safe::WString::WString | ( | size_type | count, |
| wchar_t | character ) |
Construct count copies of character.
| count | Unit count. |
| character | Fill unit. |
| AllocationError | The long path could not be allocated. |
Copy a slice of other.
| other | Source text. |
| pos | Start, in code units. |
| count | Length. npos means through the end. |
| OutOfBoundsError | pos is past other.size(). |
| AllocationError | The long path could not be allocated. |
|
inline |
Copy the unit range [first, last).
| InputIt | Input iterator of wide units. |
| first | Start. |
| last | End. |
| AllocationError | The long path could not be allocated. |
|
explicit |
Wide text from UTF-8, including an empty source.
| other | UTF-8 source. |
| StormByte::Safe::WString::WString | ( | const WString & | other | ) |
Copy constructor.
| other | Text to copy. |
|
noexcept |
Move constructor.
| other | Text to take. other becomes empty. |
|
noexcept |
Releases a long buffer.
A short string has nothing to free.
|
inline |
Append the unit range [first, last).
| InputIt | Input iterator of wide units. |
| first | Start. |
| last | End. |
| AllocationError | The long path could not be allocated. |
Append count copies of a wide code unit.
| count | Number of copies. |
| character | Code unit to append. |
| WString & StormByte::Safe::WString::append | ( | std::wstring_view | text | ) |
Append wide code units.
| text | Text to append. |
|
inline |
Append a copy of range.
| R | Input range of wide units. |
| range | Source range. |
| AllocationError | The long path could not be allocated. |
|
inline |
Replace the contents with [first, last).
| InputIt | Input iterator of wide units. |
| first | Start. |
| last | End. |
| AllocationError | The long path could not be allocated. |
Replace the contents with count copies of a wide code unit.
| count | Number of copies. |
| character | Code unit to assign. |
| WString & StormByte::Safe::WString::assign | ( | std::wstring_view | text | ) |
Replace the contents with a wide text view.
| text | Source code units. |
|
inline |
Replace the contents with a copy of range.
| R | Input range of wide units. |
| range | Source range. |
| AllocationError | The long path could not be allocated. |
| wchar_t & StormByte::Safe::WString::at | ( | size_type | index | ) |
Unit at index.
| index | Unit offset. |
| OutOfBoundsError | index is not less than Size. |
| const wchar_t & StormByte::Safe::WString::at | ( | size_type | index | ) | const |
Read-only unit at index.
| index | Unit offset. |
| OutOfBoundsError | index is not less than Size. |
|
inlinenoexcept |
Read the last unit.
|
inlinenoexcept |
Last unit.
|
inlinenoexcept |
First unit.
|
inlinenoexcept |
First unit.
|
inlinenoexcept |
Non-owning view of the owned units.
|
inlinenoexcept |
|
noexcept |
Allocated unit capacity, excluding the trailing NUL.
|
inlinenoexcept |
First unit.
|
inlinenoexcept |
One past the last unit.
| void StormByte::Safe::WString::clear | ( | ) |
Replace the contents with an empty string, retaining long-path capacity.
|
inlinenoexcept |
Compare a slice with text.
| pos | Start, in code units. |
| count | Slice length. |
| text | Other text. |
|
inlinenoexcept |
Same order as std::wstring_view::compare.
| text | Other text. |
|
inlinenoexcept |
Whether text occurs.
| text | Needle. |
|
inlinenoexcept |
Whether ch occurs.
| ch | Unit. |
| size_type StormByte::Safe::WString::copy | ( | wchar_t * | dest, |
| size_type | count, | ||
| size_type | pos = {} ) const |
Copy at most count units into dest, starting at pos.
| dest | Caller buffer. |
| count | Buffer capacity, in units. |
| pos | Start, in code units. |
| OutOfBoundsError | pos is past Size. |
|
inlinenoexcept |
Reverse begin.
|
inlinenoexcept |
Reverse end.
|
noexcept |
Read-only contiguous pointer to the first unit, or to the trailing NUL when empty.
|
noexcept |
Contiguous pointer to the first unit, or to the trailing NUL when empty.
|
inlinenoexcept |
Whether Size is zero.
|
inlinenoexcept |
One past the last unit.
|
inlinenoexcept |
One past the last unit.
|
inlinenoexcept |
Whether the text ends with text.
| text | Suffix. |
|
inlinenoexcept |
Whether the text ends with ch.
| ch | Suffix unit. |
| iterator StormByte::Safe::WString::erase | ( | const_iterator | first, |
| const_iterator | last ) |
Erase [first, last).
| first | Start. |
| last | End. |
| OutOfBoundsError | The range is outside this string. |
| iterator StormByte::Safe::WString::erase | ( | const_iterator | pos | ) |
Erase the unit at pos.
| pos | Unit to erase. |
| OutOfBoundsError | pos is outside this string. |
Erase wide code units starting at position.
| position | First code unit to erase. |
| count | Maximum code units to erase. |
|
static |
Tokens on delimiter, including empty ones.
Nodes are allocated in Base.
| str | Source. |
| delimiter | Separator. |
Tokens of this text on delimiter, including empty ones.
| delimiter | Separator. |
|
inlinenoexcept |
First occurrence of count units of text.
| text | Needle. May be null when count is zero. |
| pos | Start, in code units. |
| count | Units of text to use. |
First occurrence of text at or after pos.
| text | Needle. |
| pos | Start, in code units. |
First occurrence of ch at or after pos.
| ch | Unit. |
| pos | Start, in code units. |
First unit other than ch, at or after pos.
| ch | Unit. |
| pos | Start, in code units. |
|
inlinenoexcept |
Last unit other than ch, at or before pos.
| ch | Unit. |
| pos | Highest index. Default is the end. |
Last ch at or before pos.
| ch | Unit. |
| pos | Highest index. Default is the end. |
|
inlinenoexcept |
Read the first unit.
|
inlinenoexcept |
First unit.
|
static |
Join parts with delimiter, in queue order.
| parts | Tokens. Not modified. |
| delimiter | Separator inserted between tokens. Not copied. |
parts is empty.
|
static |
Join parts with delimiter.
Parts are not copied before the result is built.
| parts | Tokens. Not modified. |
| delimiter | Separator inserted between tokens. Not copied. Empty joins them directly. |
parts is empty. A short result stays in SSO.
|
inline |
Insert [first, last) before pos.
| InputIt | Input iterator of wide units. |
| pos | Insertion point. |
| first | Start. |
| last | End. |
pos when the range is empty. | OutOfBoundsError | pos is outside this string. |
| AllocationError | The long path could not be allocated. |
| iterator StormByte::Safe::WString::insert | ( | const_iterator | pos, |
| std::initializer_list< wchar_t > | values ) |
Insert an initializer list before pos.
| pos | Insertion point. |
| values | Units to insert. |
| OutOfBoundsError | pos is outside this string. |
| AllocationError | The long path could not be allocated. |
| WString & StormByte::Safe::WString::insert | ( | size_type | position, |
| size_type | count, | ||
| wchar_t | character ) |
Insert count copies of character at position.
| position | Insertion position. |
| count | Copy count. |
| character | Fill unit. |
| OutOfBoundsError | position is past Size. |
| AllocationError | The long path could not be allocated. |
Insert wide code units at a code-unit position.
| position | Insertion position. |
| text | Text to insert. |
|
inline |
Insert a copy of range before pos.
| R | Input range of wide units. |
| pos | Insertion point. |
| range | Source range. |
| OutOfBoundsError | pos is outside this string. |
| AllocationError | The long path could not be allocated. |
|
inlinenoexcept |
Whether this text is an integer token.
|
staticnoexcept |
|
inlinenoexcept |
Same as Size.
|
noexcept |
Largest representable unit count.
|
inlineexplicitnoexcept |
Whether the text is non-empty.
|
inlineexplicitnoexcept |
|
inlineexplicit |
Copy of the text in the caller’s heap.
|
inlinenoexcept |
Non-owning view of the text.
|
explicit |
UTF-8 text decoded in the module.
|
inlinenoexcept |
Content inequality with a wide C string.
| str | May be null. |
|
inlinenoexcept |
Content inequality.
| other | Other text. |
| WString & StormByte::Safe::WString::operator+= | ( | std::wstring_view | text | ) |
Append a wide view.
A WString converts to this view.
| text | Text to append. |
| WString & StormByte::Safe::WString::operator+= | ( | wchar_t | character | ) |
Append one wide code unit.
| character | Code unit. |
|
inlinenoexcept |
Content order against a wide C string.
A null pointer compares as empty.
| str | May be null. |
|
inlinenoexcept |
Content order.
| other | Other text. |
Copy assignment.
| other | Text to copy. |
| WString & StormByte::Safe::WString::operator= | ( | std::wstring_view | text | ) |
Copy text from a caller-owned view.
| text | Source units. |
Move assignment.
| other | Text to take. other becomes empty. |
|
inlinenoexcept |
Content equality with a wide C string.
A null pointer compares equal to empty.
| str | May be null. |
|
inlinenoexcept |
Content equality.
| other | Other text. |
|
inlinenoexcept |
|
inlinenoexcept |
| void StormByte::Safe::WString::pop_back | ( | ) |
Remove the final code unit.
Empty use follows std::wstring preconditions.
| void StormByte::Safe::WString::push_back | ( | wchar_t | character | ) |
Append one wide code unit.
| character | Code unit. |
|
inlinenoexcept |
Reverse begin.
|
inlinenoexcept |
Reverse begin.
|
inline |
Drops wide space units from this text.
|
static |
Drops wide space units.
| str | Source. |
|
inlinenoexcept |
Reverse end.
|
inlinenoexcept |
Reverse end.
| WString & StormByte::Safe::WString::replace | ( | const_iterator | first, |
| const_iterator | last, | ||
| std::wstring_view | text ) |
Replace [first, last) with text.
| first | Start. |
| last | End. |
| text | Replacement. |
| OutOfBoundsError | The range is outside this string. |
| AllocationError | The long path could not be allocated. |
| WString & StormByte::Safe::WString::replace | ( | size_type | position, |
| size_type | count, | ||
| std::wstring_view | text ) |
Replace a wide code-unit range with text.
| position | First code unit to replace. |
| count | Maximum code units to erase. |
| text | Replacement text. |
|
inlinestatic |
Copy text with each field replaced, in order, by one argument.
| Args | Text, a bool, a number, a pointer, or a type that converts to std::wstring or WString. A view is not copied. A bool is true or false. A wchar_t* is text. Any other raw pointer is its address (0x and hex). Safe::Unique and Safe::Shared print the address of the object they hold, or 0x0 when empty. Size and ByteSize use their wide text conversion for {} and their integer count for a numeric field. A number with a bare {} uses std::to_wstring. A field may be {:[0][width][.precision][type]} with type d, f, g, G, x or X. |
| text | Pattern. A long pattern is not stored; only the result is owned. |
| args | Replacements. At least one. Extra arguments are ignored. A leftover field stays. A brace run that is not a supported field stays literal and does not consume an argument. |
text. | AllocationError | The result could not be allocated. |
| void StormByte::Safe::WString::reserve | ( | size_type | new_capacity | ) |
Reserve storage for at least new_capacity code units.
| new_capacity | Requested unit capacity, excluding the NUL. |
| OutOfBoundsError | The request cannot be represented, including a trailing NUL. |
| AllocationError | The size is representable but the wide allocation failed. |
| void StormByte::Safe::WString::resize | ( | size_type | count, |
| wchar_t | character = wchar_t{} ) |
Resize the unit sequence, filling new units with character.
| count | New unit count. |
| character | Fill unit, default initialized to NUL. |
|
inlinenoexcept |
Last occurrence of count units of text.
| text | Needle. May be null when count is zero. |
| pos | Highest start. |
| count | Units of text to use. |
|
inlinenoexcept |
Last occurrence of text at or before pos.
| text | Needle. |
| pos | Highest start. Default is the end. |
Last occurrence of ch at or before pos.
| ch | Unit. |
| pos | Highest start. Default is the end. |
|
inline |
CR LF to LF on this text.
|
static |
Turns CR LF into LF.
| str | Source. |
| void StormByte::Safe::WString::shrink_to_fit | ( | ) |
Drop unused long-path capacity.
A short string is unchanged.
|
noexcept |
Unit count, excluding the trailing NUL.
Whitespace-separated tokens of this text.
|
inlinestatic |
Copy caller-owned tokens into Base storage.
| parts | Source. Not modified. |
Whitespace-separated tokens.
Nodes are allocated in Base.
| str | Source. |
|
inlinenoexcept |
Whether the text begins with text.
| text | Prefix. |
|
inlinenoexcept |
Whether the text begins with ch.
| ch | Prefix unit. |
|
noexcept |
Swaps storage with other.
| other | Other text. |
|
inline |
ASCII-letter lower case of this text.
|
static |
ASCII-letter lower case; other units copied.
| str | Source. |
|
inline |
ASCII-letter upper case of this text.
|
static |
ASCII-letter upper case; other units copied.
| str | Source. |
|
staticconstexpr |
Not found.
|
staticconstexpr |
Short capacity, excluding the trailing NUL.