|
template<typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| constexpr | str_storable (Args &&... args) noexcept(std::is_nothrow_constructible_v< allocator_t, Args... >) |
| | Create an empty object.
|
| |
template<typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| constexpr | str_storable (s_str other, Args &&... args) |
| | A constructor from another string object.
|
| |
template<typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| constexpr | str_storable (size_t repeat, s_str pattern, Args &&... args) |
| | String repetition constructor.
|
| |
template<typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| | str_storable (size_t count, K pad, Args &&... args) |
| | Character repetition constructor.
|
| |
template<typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| constexpr | str_storable (const StrExprForType< K > auto &expr, Args &&... args) |
| | Constructor from a string expression.
|
| |
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| | str_storable (const From &f, s_str pattern, s_str repl, size_t offset=0, size_t maxCount=0, Args &&... args) |
| | Constructor from string source with replacement.
|
| |
| | operator const K * () const noexcept |
| | Conversion operator to a null-terminated C string.
|
| |
| s_str_nt | to_nts (size_t from=0) const |
| | Get simple_str_nt starting at the given character.
|
| |
| | operator s_str_nt () const |
| | Convert to simple_str_nt.
|
| |
|
template<typename T, typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| static my_type | join (const T &strings, s_str delimeter, bool tail=false, bool skip_empty=false, Args &&... args) |
| | Concatenate strings from the container into one string.
|
| |
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| static my_type | uppered_only_ascii_from (const From &f, Args &&... args) |
| | Create a string copy of the passed in uppercase ASCII characters.
|
| |
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| static my_type | lowered_only_ascii_from (const From &f, Args &&... args) |
| | Create a copy of the passed string in lowercase ASCII characters.
|
| |
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| static my_type | uppered_from (const From &f, Args &&... args) |
| | Create a copy of the passed string in uppercase Unicode characters of the first plane (<0xFFFF).
|
| |
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| static my_type | lowered_from (const From &f, Args &&... args) |
| | Create a copy of the passed string in lowercase Unicode characters of the first plane (<0xFFFF).
|
| |
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...> |
| static my_type | replaced_from (const From &f, s_str pattern, s_str repl, size_t offset=0, size_t maxCount=0, Args &&... args) |
| | Create a copy of the passed string with substrings replaced.
|
| |
template<typename K, typename Impl, typename Allocator>
class simstr::str_storable< K, Impl, Allocator >
The base for the objects that own the string.
- Template Parameters
-
| K | - character type. |
| Impl | - the final class is the successor. |
| Allocator | - type of allocator. |
Still knows nothing about where the heir stores the string and its size. Simply calls its methods to get the space, and fills it as needed. Works only when creating an object, does not work with string modification after its creation and ensures that if these methods are called, the object is only is being created and no data sharing has yet taken place.
These methods must be implemented by the descendant class and are called only when an object is created
K* init(size_t size) - allocate space for a line of the specified size, return the address
void create_empty() - create an empty object
K* set_size(size_t size) - re-allocate space for the line if you didn’t guess correctly when creating the size you need and the space you need is larger or smaller. The contents of the line must be left. Although the allocator type is specified by the template parameter, this is done only for forwarding of its type in constructors, allocator methods are not called. If the heir does not use an allocator, and in init and set_size it somehow allocates space, can indicate the type of the allocator any empty class.
template<typename K, typename Impl, typename Allocator>
template<typename... Args>
requires std::is_constructible_v<allocator_t, Args...>
| simstr::str_storable< K, Impl, Allocator >::str_storable |
( |
const StrExprForType< K > auto & | expr, |
|
|
Args &&... | args ) |
|
inlineconstexpr |
Constructor from a string expression.
- Parameters
-
| expr | - string expression. |
| ...args | - parameters for initializing the allocator. |
The constructor queries the string expression length(), allocates memory of the required size, and calls the place() method to allocate result in buffer.
template<typename K, typename Impl, typename Allocator>
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...>
| simstr::str_storable< K, Impl, Allocator >::str_storable |
( |
const From & | f, |
|
|
s_str | pattern, |
|
|
s_str | repl, |
|
|
size_t | offset = 0, |
|
|
size_t | maxCount = 0, |
|
|
Args &&... | args ) |
|
inline |
Constructor from string source with replacement.
- Parameters
-
| f | - the string object from which the source string is taken. |
| pattern | - substring to be replaced. |
| repl | - the string to be replaced with. |
| offset | - starting position for searching substrings. |
| maxCount | - maximum number of replacements, 0 - no restrictions. |
| ...args | - parameters for initializing the allocator. |
template<typename K, typename Impl, typename Allocator>
template<typename T, typename... Args>
requires std::is_constructible_v<allocator_t, Args...>
| static my_type simstr::str_storable< K, Impl, Allocator >::join |
( |
const T & | strings, |
|
|
s_str | delimeter, |
|
|
bool | tail = false, |
|
|
bool | skip_empty = false, |
|
|
Args &&... | args ) |
|
inlinestatic |
Concatenate strings from the container into one string.
- Parameters
-
| strings | - container with strings. |
| delimeter | - delimiter added between lines. |
| tail | - add a separator after the last line. |
| skip_empty | - skip empty lines without adding a separator. |
| ...args | - parameters for initializing the allocator. |
The function is used to merge a container of strings into one delimited string.
std::vector<ssa> strings = get_strings();
ssa delim = get_current_delimeter();
static my_type join(const T &strings, s_str delimeter, bool tail=false, bool skip_empty=false, Args &&... args)
Definition sstring.h:3180
It is worth noting that if the separator is known in advance, it is better to use the string expression e_join.
std::vector<ssa> strings = get_strings();
lstringa<200> line{
e_join(strings,
"/")};
constexpr auto e_join(const T &s, L &&d)
Get a string expression concatenating the strings in the container into a single string with the give...
Definition sstring.h:5867
In this case, the compiler can better optimize the string merging code.
template<typename K, typename Impl, typename Allocator>
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...>
| static my_type simstr::str_storable< K, Impl, Allocator >::lowered_from |
( |
const From & | f, |
|
|
Args &&... | args ) |
|
inlinestatic |
Create a copy of the passed string in lowercase Unicode characters of the first plane (<0xFFFF).
- Parameters
-
| f | - source string. |
| ...args | - parameters for initializing the allocator. |
Case is changed by simplified tables, where one code_point is always changed to one code_point (but for UTF-8 it is possible that the length in code units will change).
template<typename K, typename Impl, typename Allocator>
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...>
| static my_type simstr::str_storable< K, Impl, Allocator >::lowered_only_ascii_from |
( |
const From & | f, |
|
|
Args &&... | args ) |
|
inlinestatic |
Create a copy of the passed string in lowercase ASCII characters.
- Parameters
-
| f | - source string. |
| ...args | - parameters for initializing the allocator. |
template<typename K, typename Impl, typename Allocator>
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...>
| static my_type simstr::str_storable< K, Impl, Allocator >::replaced_from |
( |
const From & | f, |
|
|
s_str | pattern, |
|
|
s_str | repl, |
|
|
size_t | offset = 0, |
|
|
size_t | maxCount = 0, |
|
|
Args &&... | args ) |
|
inlinestatic |
Create a copy of the passed string with substrings replaced.
- Parameters
-
| f | - source string. |
| pattern | - substring to be replaced. |
| repl | - the string to be replaced with. |
| offset | - starting position for searching substrings. |
| maxCount | - maximum number of replacements, 0 - no restrictions. |
| ...args | - parameters for initializing the allocator. |
template<typename K, typename Impl, typename Allocator>
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...>
| static my_type simstr::str_storable< K, Impl, Allocator >::uppered_from |
( |
const From & | f, |
|
|
Args &&... | args ) |
|
inlinestatic |
Create a copy of the passed string in uppercase Unicode characters of the first plane (<0xFFFF).
- Parameters
-
| f | - source string. |
| ...args | - parameters for initializing the allocator. |
Case is changed by simplified tables, where one code_point is always changed to one code_point (but for UTF-8 it is possible that the length in code units will change).
template<typename K, typename Impl, typename Allocator>
template<StrType< K > From, typename... Args>
requires std::is_constructible_v<allocator_t, Args...>
| static my_type simstr::str_storable< K, Impl, Allocator >::uppered_only_ascii_from |
( |
const From & | f, |
|
|
Args &&... | args ) |
|
inlinestatic |
Create a string copy of the passed in uppercase ASCII characters.
- Parameters
-
| f | - source string. |
| ...args | - parameters for initializing the allocator. |