simstr 1.2.4
Yet another strings library
 
Loading...
Searching...
No Matches
simstr Namespace Reference

Library namespace. More...

Classes

class  chunked_string_builder
 For constructing long dynamic strings by concatenating small pieces. More...
 
struct  empty_expr
 An "empty" string expression. More...
 
struct  expr_choice
 Conditional selection string expression. More...
 
struct  expr_choice_one_lit
 Conditional selection string expression. More...
 
struct  expr_choice_two_lit
 Conditional selection string expression. More...
 
struct  expr_if
 Conditional selection string expression. More...
 
struct  expr_pad
 A type of string expression that returns N specified characters. More...
 
struct  expr_replace_symbols
 A type for a string expression that generates a string in which the given characters are replaced by the given strings. More...
 
struct  expr_replaced
 A string expression that generates a string replacing all occurrences of the given substring. More...
 
struct  expr_spaces
 A type of string expression that returns N specified characters. More...
 
struct  expr_stdstr
 A type for using std::string and std::string_view as sources in string expressions. More...
 
struct  expr_utf
 String expression to convert strings to different UTF types. More...
 
class  from_utf_convertable
 Base class for strings that can be converted from another character type. More...
 
class  hashStrMap
 Container for more efficient searching by string keys. More...
 
class  lstring
 The mutable, owning string class. Contains an internal buffer for text of a given size. More...
 
struct  simple_str
 The simplest immutable non-owning string class. More...
 
struct  simple_str_nt
 A class that claims to refer to a null-terminated string. More...
 
class  Splitter
 Class for sequentially obtaining substrings by a given delimiter. More...
 
class  sstring
 Immutable owning string class. More...
 
class  str_algs
 A class with basic constant string algorithms. More...
 
class  str_mutable
 Base class for working with mutable strings. More...
 
class  str_storable
 The base for the objects that own the string. More...
 
struct  strexprjoin
 Template class for concatenating two string expressions into one using operator + More...
 
struct  strexprjoin_c
 Concatenation of a reference to a string expression and the value of the string expression. More...
 

Concepts

concept  storable_str
 A type concept that can store a string.
 
concept  mutable_str
 A type concept that can modify a stored string.
 
concept  immutable_str
 A type concept that cannot modify a stored string.
 
concept  Allocatorable
 Concept of a memory management type.
 
concept  StrType
 Base concept of string object.
 
concept  StrExpr
 Concept of "String Expressions".
 
concept  StrExprForType
 The concept of a string expression of a given character type.
 

Typedefs

template<typename T>
using hashStrMapA = hashStrMap<u8s, T, strhash<u8s>, streql<u8s>>
 Type of hash dictionary for char strings, case sensitive search.
 
template<typename T>
using hashStrMapAIA = hashStrMap<u8s, T, strhashia<u8s>, streqlia<u8s>>
 Type of hash dictionary for char strings, case-insensitive lookup for ASCII characters.
 
template<typename T>
using hashStrMapAIU = hashStrMap<u8s, T, strhashiu<u8s>, streqliu<u8s>>
 Hash dictionary type for char strings, case-insensitive search for Unicode characters up to 0xFFFF.
 
template<typename T>
using hashStrMapW = hashStrMap<wchar_t, T, strhash<wchar_t>, streql<wchar_t>>
 Hash dictionary type for wchar_t strings, case sensitive search.
 
template<typename T>
using hashStrMapWIA = hashStrMap<wchar_t, T, strhashia<wchar_t>, streqlia<wchar_t>>
 Hash dictionary type for wchar_t strings, case-insensitive lookup for ASCII characters.
 
template<typename T>
using hashStrMapWIU = hashStrMap<wchar_t, T, strhashiu<wchar_t>, streqliu<wchar_t>>
 Hash dictionary type for wchar_t strings, case insensitive search for Unicode characters up to 0xFFFF.
 
template<typename T>
using hashStrMapU = hashStrMap<u16s, T, strhash<u16s>, streql<u16s>>
 Hash dictionary type for char16_t strings, case sensitive search.
 
template<typename T>
using hashStrMapUIA = hashStrMap<u16s, T, strhashia<u16s>, streqlia<u16s>>
 Hash dictionary type for char16_t strings, case-insensitive lookup for ASCII characters.
 
template<typename T>
using hashStrMapUIU = hashStrMap<u16s, T, strhashiu<u16s>, streqliu<u16s>>
 Hash dictionary type for char16_t strings, case insensitive search for Unicode characters up to 0xFFFF.
 
template<typename T>
using hashStrMapUU = hashStrMap<u32s, T, strhash<u32s>, streql<u32s>>
 Hash dictionary type for char32_t strings, case sensitive search.
 
template<typename T>
using hashStrMapUUIA = hashStrMap<u32s, T, strhashia<u32s>, streqlia<u32s>>
 Hash dictionary type for char32_t strings, case-insensitive lookup for ASCII characters.
 
template<typename T>
using hashStrMapUUIU = hashStrMap<u32s, T, strhashiu<u32s>, streqliu<u32s>>
 Hash dictionary type for char32_t strings, case insensitive search for Unicode characters up to 0xFFFF.
 

Enumerations

enum class  IntConvertResult : char { Success , BadSymbolAtTail , Overflow , NotNumber }
 Enumeration with possible results of converting a string to an integer. More...
 

Functions

template<typename To, typename From>
requires (!std::is_same_v<From, To>)
auto e_utf (simple_str< From > from)
 Returns a string expression that converts a string of one character type to another type, via UTF conversion.
 
template<StrExpr A, FromIntNumber T>
constexpr auto operator+ (const A &a, T s)
 Concatenation operator for string expression and integer.
 
template<StrExpr A, FromIntNumber T>
constexpr auto operator+ (T s, const A &a)
 Concatenation operator for integer and string expression.
 
template<typename K, typename T>
constexpr auto e_num (T t)
 Convert an integer to a string expression.
 
template<StrExpr A, typename R>
requires (std::is_same_v<R, double> || std::is_same_v<R, float>)
constexpr auto operator+ (const A &a, R s)
 Concatenation operator for string expression and real number (float, double).
 
template<StrExpr A, typename R>
requires (is_one_of_std_char_v<typename A::symb_type> && (std::is_same_v<R, double> || std::is_same_v<R, float>))
constexpr auto operator+ (R s, const A &a)
 Concatenation operator for float (float, double) and string expression.
 
template<typename K>
requires (is_one_of_std_char_v<K>)
constexpr auto e_real (double t)
 Convert a double number to a string expression.
 
template<bool tail = false, bool skip_empty = false, typename L, typename K = typename const_lit<L>::symb_type, size_t I = const_lit<L>::Count, typename T>
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 given delimiter.limiter.limiter.
 
template<typename K, typename T, size_t N = const_lit_for<K, T>::Count, typename X, size_t L = const_lit_for<K, X>::Count>
requires (N > 1)
constexpr auto e_repl (simple_str< K > w, T &&p, X &&r)
 Get a string expression that generates a string with all occurrences of a given substring replaced.
 
template<bool UseVector = false, typename K, typename ... Repl>
requires (sizeof...(Repl) % 2 == 0)
auto e_repl_const_symbols (simple_str< K > src, Repl &&... other)
 Returns a string expression that generates a string containing the given characters replaced with given substrings.
 
SS_CONSTEVAL simple_str_nt< u8s > operator""_ss (const u8s *ptr, size_t l)
 Operator literal in simple_str_nt.
 
SS_CONSTEVAL simple_str_nt< uws > operator""_ss (const uws *ptr, size_t l)
 Operator literal in simple_str_nt.
 
SS_CONSTEVAL simple_str_nt< u16s > operator""_ss (const u16s *ptr, size_t l)
 Operator literal in simple_str_nt.
 
SS_CONSTEVAL simple_str_nt< u32s > operator""_ss (const u32s *ptr, size_t l)
 Operator literal in simple_str_nt.
 
consteval HashKey< u8s > operator""_h (const u8s *ptr, size_t l)
 Key literal operator for hashStrMap with a case-sensitive hash calculated at compile time.
 
consteval HashKeyIA< u8s > operator""_ia (const u8s *ptr, size_t l)
 Key literal operator for hashStrMap with a case-insensitive ASCII hash calculated at compile time.
 
HashKeyIU< u8s > operator""_iu (const u8s *ptr, size_t l)
 Key literal operator for hashStrMap with a simple unicode case-insensitive hash calculated at compile time.
 
consteval HashKey< u16s > operator""_h (const u16s *ptr, size_t l)
 Key literal operator for hashStrMap with a case-sensitive hash calculated at compile time.
 
consteval HashKeyIA< u16s > operator""_ia (const u16s *ptr, size_t l)
 Key literal operator for hashStrMap with a case-insensitive ASCII hash calculated at compile time.
 
HashKeyIU< u16s > operator""_iu (const u16s *ptr, size_t l)
 Key literal operator for hashStrMap with a simple unicode case-insensitive hash calculated at compile time.
 
consteval HashKey< u32s > operator""_h (const u32s *ptr, size_t l)
 Key literal operator for hashStrMap with a case-sensitive hash calculated at compile time.
 
consteval HashKeyIA< u32s > operator""_ia (const u32s *ptr, size_t l)
 Key literal operator for hashStrMap with a case-insensitive ASCII hash calculated at compile time.
 
HashKeyIU< u32s > operator""_iu (const u32s *ptr, size_t l)
 Key literal operator for hashStrMap with a simple unicode case-insensitive hash calculated at compile time.
 
consteval HashKey< uws > operator""_h (const uws *ptr, size_t l)
 Key literal operator for hashStrMap with a case-sensitive hash calculated at compile time.
 
consteval HashKeyIA< uws > operator""_ia (const uws *ptr, size_t l)
 Key literal operator for hashStrMap with a case-insensitive ASCII hash calculated at compile time.
 
HashKeyIU< uws > operator""_iu (const uws *ptr, size_t l)
 Key literal operator for hashStrMap with a simple unicode case-insensitive hash calculated at compile time.
 
std::ostream & operator<< (std::ostream &stream, ssa text)
 Stream output operator simple_str.
 
std::wostream & operator<< (std::wostream &stream, ssw text)
 Stream output operator simple_str.
 
std::wostream & operator<< (std::wostream &stream, simple_str< wchar_type > text)
 Stream output operator simple_str.
 
std::ostream & operator<< (std::ostream &stream, const stringa &text)
 Operator for outputting sstring to stream.
 
std::wostream & operator<< (std::wostream &stream, const stringw &text)
 Operator for outputting sstring to stream.
 
std::wostream & operator<< (std::wostream &stream, const sstring< wchar_type > &text)
 Operator for outputting sstring to stream.
 
template<size_t N, bool S, simstr::Allocatorable A>
std::ostream & operator<< (std::ostream &stream, const lstring< u8s, N, S, A > &text)
 Operator to output lstring to stream.
 
template<size_t N, bool S, simstr::Allocatorable A>
std::wostream & operator<< (std::wostream &stream, const lstring< uws, N, S, A > &text)
 Operator to output lstring to stream.
 
template<size_t N, bool S, simstr::Allocatorable A>
std::wostream & operator<< (std::wostream &stream, const lstring< wchar_type, N, S, A > &text)
 Operator to output lstring to stream.
 
template<StrExpr A, StrExprForType< typename A::symb_type > B>
auto operator+ (const A &a, const B &b)
 An addition operator for two arbitrary string expressions of the same character type.
 
template<typename K, StrExprForType< K > A>
constexpr auto operator+ (const A &a, K s)
 Addition operator of a string expression and one character.
 
template<typename K>
constexpr auto e_char (K s)
 Generates a string of 1 given character.
 
template<typename T, size_t N = const_lit<T>::Count>
constexpr auto e_t (T &&s)
 Converts a string literal to a string expression.
 
template<StrExpr A, typename K = typename A::symb_type, typename T, size_t N = const_lit_for<K, T>::Count>
constexpr auto operator+ (const A &a, T &&s)
 The addition operator for a string expression and a string literal of the same character type.
 
template<StrExpr A, typename K = typename A::symb_type, typename T, size_t N = const_lit_for<K, T>::Count>
constexpr auto operator+ (T &&s, const A &a)
 The addition operator for a string literal of the same character type and string expression.
 
template<size_t N>
constexpr auto e_spca ()
 Generates a string of N char spaces.
 
template<size_t N>
constexpr auto e_spcw ()
 Generates a string of N wchar_t spaces.
 
template<typename K>
constexpr auto e_c (size_t l, K s)
 Generates a string of l characters s of type K.
 
template<StrExpr A, StrExprForType< typename A::symb_type > B>
constexpr auto e_choice (bool c, const A &a, const B &b)
 Create a conditional string expression expr_choice.
 
template<StrExpr A, typename T, size_t N = const_lit_for<typename A::symb_type, T>::Count>
constexpr auto e_choice (bool c, const A &a, T &&str)
 Overload e_choice when the third argument is a string literal.
 
template<StrExpr A, typename T, size_t N = const_lit_for<typename A::symb_type, T>::Count>
constexpr auto e_choice (bool c, T &&str, const A &a)
 Overload e_choice when the second argument is a string literal.
 
template<typename T, typename L, size_t N = const_lit<T>::Count, size_t M = const_lit_for<typename const_lit<T>::symb_type, L>::Count>
constexpr auto e_choice (bool c, T &&str_a, L &&str_b)
 Overload e_choice when the second and third arguments are string literals.
 
template<StrExpr A>
constexpr auto e_if (bool c, const A &a)
 Creating a conditional string expression expr_if.
 
template<typename T, size_t N = const_lit<T>::Count>
constexpr auto e_if (bool c, T &&str)
 Overload e_if when the second argument is a string literal.
 
template<StrExprForType< u8s > A>
auto operator+ (const A &a, const std::string &s)
 Addition operator for char string expression and std::string.
 
template<StrExprForType< u8s > A>
auto operator+ (const std::string &s, const A &a)
 Addition operator for std::string and char string expression.
 
template<StrExprForType< u8s > A>
auto operator+ (const A &a, const std::string_view &s)
 Addition operator for char string expression and std::string_view.
 
template<StrExprForType< u8s > A>
auto operator+ (const std::string_view &s, const A &a)
 Addition operator for std::string_view and char string expression.
 
template<StrExprForType< uws > A>
auto operator+ (const A &a, const std::wstring &s)
 Addition operator for wchar_t string expression and std::wstring.
 
template<StrExprForType< uws > A>
auto operator+ (const std::wstring &s, const A &a)
 Addition operator for std::wstring and wchar_t string expression.
 
template<StrExprForType< uws > A>
auto operator+ (const A &a, const std::wstring_view &s)
 Addition operator for wchar_t string expression and std::wstring_view.
 
template<StrExprForType< uws > A>
auto operator+ (const std::wstring_view &s, const A &a)
 Addition operator for std::wstring_view and wchar_t string expression.
 

Variables

constexpr empty_expr< u8s > eea {}
 Empty string expression of type char.
 
constexpr empty_expr< uws > eew {}
 Empty string expression of type wchar_t.
 
constexpr empty_expr< u16s > eeu {}
 Empty string expression of type char16_t.
 
constexpr empty_expr< u32s > eeuu {}
 Empty string expression of type char32_t.
 

Detailed Description

Library namespace.

Enumeration Type Documentation

◆ IntConvertResult

enum class simstr::IntConvertResult : char
strong

Enumeration with possible results of converting a string to an integer.

Enumerator
Success 

Успешно

BadSymbolAtTail 

Число закончилось не числовым символом

Overflow 

Переполнение, число не помещается в заданный тип

NotNumber 

Вообще не число

Function Documentation

◆ e_utf()

template<typename To, typename From>
requires (!std::is_same_v<From, To>)
auto simstr::e_utf ( simple_str< From > from)

Returns a string expression that converts a string of one character type to another type, via UTF conversion.

Template Parameters
To- the type of string to convert to.
From- the type of string to convert from. Derived from the argument.
Parameters
from- the string from which to convert.

◆ operator""_h() [1/4]

HashKey< u16s > simstr::literals::operator""_h ( const u16s * ptr,
size_t l )
consteval

Key literal operator for hashStrMap with a case-sensitive hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_h() [2/4]

HashKey< u32s > simstr::literals::operator""_h ( const u32s * ptr,
size_t l )
consteval

Key literal operator for hashStrMap with a case-sensitive hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_h() [3/4]

HashKey< u8s > simstr::literals::operator""_h ( const u8s * ptr,
size_t l )
consteval

Key literal operator for hashStrMap with a case-sensitive hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_h() [4/4]

HashKey< uws > simstr::literals::operator""_h ( const uws * ptr,
size_t l )
consteval

Key literal operator for hashStrMap with a case-sensitive hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_ia() [1/4]

HashKeyIA< u16s > simstr::literals::operator""_ia ( const u16s * ptr,
size_t l )
consteval

Key literal operator for hashStrMap with a case-insensitive ASCII hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_ia() [2/4]

HashKeyIA< u32s > simstr::literals::operator""_ia ( const u32s * ptr,
size_t l )
consteval

Key literal operator for hashStrMap with a case-insensitive ASCII hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_ia() [3/4]

HashKeyIA< u8s > simstr::literals::operator""_ia ( const u8s * ptr,
size_t l )
consteval

Key literal operator for hashStrMap with a case-insensitive ASCII hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_ia() [4/4]

HashKeyIA< uws > simstr::literals::operator""_ia ( const uws * ptr,
size_t l )
consteval

Key literal operator for hashStrMap with a case-insensitive ASCII hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_iu() [1/4]

HashKeyIU< u16s > simstr::literals::operator""_iu ( const u16s * ptr,
size_t l )
inline

Key literal operator for hashStrMap with a simple unicode case-insensitive hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_iu() [2/4]

HashKeyIU< u32s > simstr::literals::operator""_iu ( const u32s * ptr,
size_t l )
inline

Key literal operator for hashStrMap with a simple unicode case-insensitive hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_iu() [3/4]

HashKeyIU< u8s > simstr::literals::operator""_iu ( const u8s * ptr,
size_t l )
inline

Key literal operator for hashStrMap with a simple unicode case-insensitive hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_iu() [4/4]

HashKeyIU< uws > simstr::literals::operator""_iu ( const uws * ptr,
size_t l )
inline

Key literal operator for hashStrMap with a simple unicode case-insensitive hash calculated at compile time.

Parameters
ptr- pointer to a string.
l- string length.
Returns
StoreType.

◆ operator""_ss() [1/4]

SS_CONSTEVAL simple_str_nt< u16s > simstr::literals::operator""_ss ( const u16s * ptr,
size_t l )

Operator literal in simple_str_nt.

Parameters
ptr- pointer to a string.
l- string length.
Returns
simple_str_nt.

◆ operator""_ss() [2/4]

SS_CONSTEVAL simple_str_nt< u32s > simstr::literals::operator""_ss ( const u32s * ptr,
size_t l )

Operator literal in simple_str_nt.

Parameters
ptr- pointer to a string.
l- string length.
Returns
simple_str_nt.

◆ operator""_ss() [3/4]

SS_CONSTEVAL simple_str_nt< u8s > simstr::literals::operator""_ss ( const u8s * ptr,
size_t l )

Operator literal in simple_str_nt.

Parameters
ptr- pointer to a string.
l- string length.
Returns
simple_str_nt.

◆ operator""_ss() [4/4]

SS_CONSTEVAL simple_str_nt< uws > simstr::literals::operator""_ss ( const uws * ptr,
size_t l )

Operator literal in simple_str_nt.

Parameters
ptr- pointer to a string.
l- string length.
Returns
simple_str_nt.

◆ operator<<() [1/9]

template<size_t N, bool S, simstr::Allocatorable A>
std::ostream & simstr::operator<< ( std::ostream & stream,
const lstring< u8s, N, S, A > & text )
inline

Operator to output lstring to stream.

Parameters
stream- output stream.
text- text.
Returns
std::ostream&.

◆ operator<<() [2/9]

std::ostream & simstr::operator<< ( std::ostream & stream,
const stringa & text )
inline

Operator for outputting sstring to stream.

Parameters
stream- output stream.
text- text.
Returns
std::ostream&.

◆ operator<<() [3/9]

std::ostream & simstr::operator<< ( std::ostream & stream,
ssa text )
inline

Stream output operator simple_str.

Parameters
stream- output stream.
text- text.
Returns
std::ostream&.

◆ operator<<() [4/9]

template<size_t N, bool S, simstr::Allocatorable A>
std::wostream & simstr::operator<< ( std::wostream & stream,
const lstring< uws, N, S, A > & text )
inline

Operator to output lstring to stream.

Parameters
stream- output stream.
text- text.
Returns
std::ostream&.

◆ operator<<() [5/9]

template<size_t N, bool S, simstr::Allocatorable A>
std::wostream & simstr::operator<< ( std::wostream & stream,
const lstring< wchar_type, N, S, A > & text )
inline

Operator to output lstring to stream.

Parameters
stream- output stream.
text- text.
Returns
std::ostream&.

◆ operator<<() [6/9]

std::wostream & simstr::operator<< ( std::wostream & stream,
const sstring< wchar_type > & text )
inline

Operator for outputting sstring to stream.

Parameters
stream- output stream.
text- text.
Returns
std::ostream&.

◆ operator<<() [7/9]

std::wostream & simstr::operator<< ( std::wostream & stream,
const stringw & text )
inline

Operator for outputting sstring to stream.

Parameters
stream- output stream.
text- text.
Returns
std::ostream&.

◆ operator<<() [8/9]

std::wostream & simstr::operator<< ( std::wostream & stream,
simple_str< wchar_type > text )
inline

Stream output operator simple_str.

Parameters
stream- output stream.
text- text.
Returns
std::ostream&.

◆ operator<<() [9/9]

std::wostream & simstr::operator<< ( std::wostream & stream,
ssw text )
inline

Stream output operator simple_str.

Parameters
stream- output stream.
text- text.
Returns
std::ostream&.