xentara-utils v2.0.4
The Xentara Utility Library
Loading...
Searching...
No Matches
xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits > Class Template Reference

A string that uses a statically allocated buffer for the data. More...

#include <xentara/utils/string/StaticString.hpp>

Classes

class  RawData
 An object that enables low-level access to the string’s data and size. More...
 

Public Types

using traits_type = CharTraits
 The character traits.
 
using value_type = Char
 The character type.
 
using size_type = std::size_t
 The type used for sizes.
 
using difference_type = std::ptrdiff_t
 The type used for distances.
 
using reference = value_type &
 A reference to an character.
 
using const_reference = const value_type &
 A const reference to an character.
 
using pointer = value_type *
 A pointer to an character.
 
using const_pointer = const value_type *
 A const pointer to an character.
 
using iterator = core::ContiguousIterator< pointer, BasicStaticString >
 An iterator.
 
using const_iterator = core::ContiguousIterator< const_pointer, BasicStaticString >
 A const iterator.
 
using reverse_iterator = std::reverse_iterator< iterator >
 An iterator for iterating in reverse order.
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 A const iterator for iterating in reverse order.
 

Public Member Functions

Constructors
constexpr BasicStaticString () noexcept
 Default constructor.
 
constexpr BasicStaticString (const BasicStaticString &) noexcept=default
 Copy constructor.
 
constexpr BasicStaticString (size_type count, Char character)
 Constructor for a string filled with a specific character.
 
constexpr BasicStaticString (const BasicStaticString &string, size_type position, size_type count=npos)
 Constructor that copies a sub string of another static string with the same capacity.
 
constexpr BasicStaticString (const Char *string, size_type count)
 Constructor that copies characters from an array.
 
constexpr BasicStaticString (const Char *string)
 Constructor that copies a null-terminated string.
 
template<std::input_iterator InputIterator>
constexpr BasicStaticString (InputIterator first, InputIterator last)
 Constructor that fills the string from a character sequence.
 
 BasicStaticString (std::initializer_list< Char > characters)
 Constructor that initializes the characters from an initializer list.
 
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr BasicStaticString (const String &string)
 Constructor that copies an arbitrary string.
 
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr BasicStaticString (const String &string, size_type position, size_type count)
 Constructor that copies a sub string of a string.
 
Assigning Values
constexpr auto operator= (const BasicStaticString &) noexcept -> BasicStaticString &=default
 Copy assignment operator.
 
constexpr auto operator= (Char character) -> BasicStaticString &
 Assignment operator for a single character.
 
constexpr auto operator= (const Char *string) -> BasicStaticString &
 Assignment operator for a null-terminated string.
 
constexpr auto operator= (std::initializer_list< Char > characters) -> BasicStaticString &
 Assignment operator for an initializer list.
 
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto operator= (const String &string) -> BasicStaticString &
 Assignment operator for an arbitrary string.
 
constexpr auto assign (size_type count, Char character) -> BasicStaticString &
 Fills the string with a specific character.
 
constexpr auto assign (const BasicStaticString &string) noexcept -> BasicStaticString &
 Copies another static string of the same capacity.
 
constexpr auto assign (const BasicStaticString &string, size_type position, size_type count=npos) noexcept -> BasicStaticString &
 Copies a sub string of another static string of the same capacity.
 
constexpr auto assign (const Char *string, size_type count) -> BasicStaticString &
 Copies characters from an array.
 
constexpr auto assign (const Char *string) -> BasicStaticString &
 Copies a null-terminated string.
 
template<std::input_iterator InputIterator>
constexpr auto assign (InputIterator first, InputIterator last) -> BasicStaticString &
 Copies a character range.
 
constexpr auto assign (std::initializer_list< Char > characters) -> BasicStaticString &
 Copies the characters from an initializer list.
 
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto assign (const String &string) -> BasicStaticString &
 Copies an arbitrary string.
 
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto assign (const String &string, size_type position, size_type count=npos) -> BasicStaticString &
 Copies a sub string of a string, up to a maximum length.
 
Character Access
constexpr operator std::basic_string_view< Char, CharTraits > () const noexcept
 conversion to a string view
 
template<typename Allocator >
constexpr operator std::basic_string< Char, CharTraits, Allocator > () const noexcept
 conversion to an std::string
 
constexpr auto view () const noexcept -> std::basic_string_view< Char, CharTraits >
 Gets the data as a string view.
 
template<typename Allocator = std::allocator<Char>>
constexpr auto str (const Allocator &allocator=Allocator()) const noexcept -> std::basic_string< Char, CharTraits, Allocator >
 Gets the data as an std::string.
 
constexpr auto at (size_type index) const -> const_reference
 Accesses the character at a certain index.
 
constexpr auto at (size_type index) -> reference
 Accesses the character at a certain index.
 
constexpr auto operator[] (size_type index) const noexcept -> const_reference
 Subscript operator.
 
constexpr auto operator[] (size_type index) noexcept -> reference
 Subscript operator.
 
constexpr auto front () const noexcept -> const_reference
 Returns the first character.
 
constexpr auto front () noexcept -> reference
 Returns the first character.
 
constexpr auto back () const noexcept -> const_reference
 Returns the last character.
 
constexpr auto back () noexcept -> reference
 Returns the last character.
 
constexpr auto data () const noexcept -> const Char *
 Gets a pointer to the data.
 
constexpr auto data () noexcept -> Char *
 Gets a pointer to the data.
 
constexpr auto c_str () const noexcept -> const Char *
 Gets the data as a null terminated string.
 
Iterators
constexpr auto begin () noexcept -> iterator
 Creates a begin iterator.
 
constexpr auto begin () const noexcept -> const_iterator
 Creates a begin iterator.
 
constexpr auto cbegin () const noexcept -> const_iterator
 Creates a begin iterator.
 
constexpr auto end () noexcept -> iterator
 Creates an end iterator.
 
constexpr auto end () const noexcept -> const_iterator
 Creates an end iterator.
 
constexpr auto cend () const noexcept -> const_iterator
 Creates an end iterator.
 
constexpr auto rbegin () noexcept -> reverse_iterator
 Creates a reverse begin iterator.
 
constexpr auto rbegin () const noexcept -> const_reverse_iterator
 Creates a reverse begin iterator.
 
constexpr auto crbegin () const noexcept -> const_reverse_iterator
 Creates a reverse begin iterator.
 
constexpr auto rend () noexcept -> reverse_iterator
 Creates a reverse end iterator.
 
constexpr auto rend () const noexcept -> const_reverse_iterator
 Creates a reverse end iterator.
 
constexpr auto crend () const noexcept -> const_reverse_iterator
 Creates a reverse end iterator.
 
Finding Sub Strings
constexpr auto starts_with (std::basic_string_view< Char, CharTraits > string) const noexcept -> bool
 Checks whether the string starts with a certain text.
 
constexpr auto starts_with (Char character) const noexcept -> bool
 Checks whether the string starts with a certain character.
 
constexpr auto starts_with (const Char *string) const -> bool
 Checks whether the string starts with a certain text.
 
constexpr auto ends_with (std::basic_string_view< Char, CharTraits > string) const noexcept -> bool
 Checks whether the string ends with a certain text.
 
constexpr auto ends_with (Char character) const noexcept -> bool
 Checks whether the string ends with a certain character.
 
constexpr auto ends_with (const Char *string) const -> bool
 Checks whether the string ends with a certain text.
 
Modifiers
constexpr auto resize (size_type newSize) noexcept -> void
 Resizes the string.
 
constexpr auto resize (size_type newSize, Char padding) noexcept -> void
 Resizes the string.
 
constexpr auto clear () noexcept -> void
 Clears the string.
 
Appending characters
constexpr auto operator+= (const BasicStaticString &string) -> BasicStaticString &
 Appends another static string of the same capacity to the string.
 
constexpr auto operator+= (Char character) -> BasicStaticString &
 Appends a single character to the string.
 
constexpr auto operator+= (const Char *string) -> BasicStaticString &
 Appends a null-terminated string to the string.
 
constexpr auto operator+= (std::initializer_list< Char > characters) -> BasicStaticString &
 Appends the characters from an initializer list to the string.
 
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto operator+= (const String &string) -> BasicStaticString &
 Appends an arbitrary string to the string.
 
constexpr auto push_back (Char character) -> void
 Appends a single character to the string.
 
constexpr auto append (size_type count, Char character) -> BasicStaticString &
 Appends a number of copies of a character to the string.
 
constexpr auto append (const BasicStaticString &string) -> BasicStaticString &
 Appends another static string of the same capacity to the string.
 
constexpr auto append (const BasicStaticString &string, size_type position, size_type count=npos) -> BasicStaticString &
 Appends a sub string of another static string of the same capacity to the string.
 
constexpr auto append (const Char *string, size_type count) -> BasicStaticString &
 Appends characters from an array to the string.
 
constexpr auto append (const Char *string) -> BasicStaticString &
 Appends a null-terminated string to the string.
 
template<std::input_iterator InputIterator>
constexpr auto append (InputIterator first, InputIterator last) -> BasicStaticString &
 Appends a character sequence to the string.
 
constexpr auto append (std::initializer_list< Char > characters) -> BasicStaticString &
 Appends the characters from an initializer list to the string.
 
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto append (const String &string) -> BasicStaticString &
 Appends an arbitrary string to the string.
 
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto append (const String &string, size_type position, size_type count=npos) -> BasicStaticString &
 Appends a sub string of a string, up to a maximum length to the string.
 
Inserting characters
constexpr auto insert (size_type where, size_type count, Char character) -> BasicStaticString &
 Inserts a number of copies of a character into the string.
 
constexpr auto insert (size_type where, const Char *string) -> BasicStaticString &
 Inserts a null-terminated string into the string.
 
constexpr auto insert (size_type where, const Char *string, size_type count) -> BasicStaticString &
 Inserts characters from an array into the string.
 
constexpr auto insert (size_type where, const BasicStaticString &string) -> BasicStaticString &
 Inserts another static string of the same capacity into the string.
 
constexpr auto insert (size_type where, const BasicStaticString &string, size_type position, size_type count=npos) -> BasicStaticString &
 Inserts a sub string of another static string of the same capacity into the string.
 
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto insert (size_type where, const String &string) -> BasicStaticString &
 Inserts an arbitrary string into the string.
 
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto insert (size_type where, const String &string, size_type position, size_type count=npos) -> BasicStaticString &
 Inserts a sub string of a string, up to a maximum length into the string.
 
constexpr auto insert (const_iterator where, Char character) -> iterator
 Inserts a single character into the string.
 
constexpr auto insert (const_iterator where, size_type count, Char character) -> iterator
 Inserts a number of copies of a character into the string.
 
template<std::input_iterator InputIterator>
constexpr auto insert (const_iterator where, InputIterator first, InputIterator last) -> iterator
 Inserts a character sequence into the string.
 
constexpr auto insert (const_iterator where, std::initializer_list< Char > characters) -> iterator
 Inserts the characters from an initializer list into the string.
 
Removing characters
constexpr auto pop_back () noexcept -> void
 Removes the last character of the string.
 
constexpr auto erase (size_type index=0, size_type count=npos) -> BasicStaticString &
 Removes characters from the string.
 
constexpr auto erase (const_iterator position) noexcept -> iterator
 Removes a single character from the string.
 
constexpr auto erase (const_iterator first, const_iterator last) noexcept -> iterator
 Removes a range of characters from the string.
 
Low-Level Access
constexpr auto rawData () noexcept -> RawData
 Returns an object that allows you to access to the string’s data and size directly.
 

Static Public Attributes

static constexpr size_type npos
 Special size value used for automatically determined lengths.
 

Size and Capacity

constexpr auto empty () const noexcept -> bool
 Determines whether the string is empty.
 
constexpr auto size () const noexcept -> size_type
 Gets the current size.
 
constexpr auto length () const noexcept -> size_type
 Alias for size()
 
constexpr auto capacity () const noexcept -> size_type
 Gets the capacity of the string.
 
static constexpr auto max_size () noexcept -> size_type
 Gets the maximum size.
 

Detailed Description

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
class xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >

A string that uses a statically allocated buffer for the data.

This class behaves just like std::string, but doesn't require any heap allocation. Instead, the string data is allocated in a static buffer of a fixed size.

Template Parameters
CharThe character type
kCapacityThe capacity of the string
CharTraitsThe char traits used for interacting with the standard C++ library

Member Typedef Documentation

◆ const_iterator

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::const_iterator = core::ContiguousIterator<const_pointer, BasicStaticString>

A const iterator.

◆ const_pointer

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::const_pointer = const value_type *

A const pointer to an character.

◆ const_reference

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::const_reference = const value_type &

A const reference to an character.

◆ const_reverse_iterator

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::const_reverse_iterator = std::reverse_iterator<const_iterator>

A const iterator for iterating in reverse order.

◆ difference_type

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::difference_type = std::ptrdiff_t

The type used for distances.

◆ iterator

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::iterator = core::ContiguousIterator<pointer, BasicStaticString>

An iterator.

◆ pointer

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::pointer = value_type *

A pointer to an character.

◆ reference

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::reference = value_type &

A reference to an character.

◆ reverse_iterator

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::reverse_iterator = std::reverse_iterator<iterator>

An iterator for iterating in reverse order.

◆ size_type

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::size_type = std::size_t

The type used for sizes.

◆ traits_type

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::traits_type = CharTraits

The character traits.

◆ value_type

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
using xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::value_type = Char

The character type.

Constructor & Destructor Documentation

◆ BasicStaticString() [1/10]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::BasicStaticString ( )
constexprnoexcept

Default constructor.

This constructor constructs an empty string.

◆ BasicStaticString() [2/10]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::BasicStaticString ( const BasicStaticString< Char, kCapacity, CharTraits > &  )
constexprdefaultnoexcept

Copy constructor.

◆ BasicStaticString() [3/10]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::BasicStaticString ( size_type  count,
Char  character 
)
constexpr

Constructor for a string filled with a specific character.

Parameters
countThe number of repetitions of the character. This must not exceed kCapacity.
characterThe character to fill the string with.
Exceptions
std::length_errorcount is greater than kCapacity.

◆ BasicStaticString() [4/10]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::BasicStaticString ( const BasicStaticString< Char, kCapacity, CharTraits > &  string,
size_type  position,
size_type  count = npos 
)
constexpr

Constructor that copies a sub string of another static string with the same capacity.

Parameters
stringThe string to copy from.
positionThe position of the sub string to copy. Must be a valid sub string position within string, meaning it must be between 0 and the string.size(), inclusively.
countThe maximum length of the sub string to copy, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr().
Exceptions
std::out_of_rangeposition is greater than the size of string.

◆ BasicStaticString() [5/10]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::BasicStaticString ( const Char *  string,
size_type  count 
)
constexpr

Constructor that copies characters from an array.

Parameters
stringA pointer to the characters to copy. The pointer must point to a memory region that is at least count characters long.
countThe number of characters to copy. This must not exceed kCapacity.
Exceptions
std::length_errorcount is greater than kCapacity.

◆ BasicStaticString() [6/10]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::BasicStaticString ( const Char *  string)
constexpr

Constructor that copies a null-terminated string.

Parameters
stringThe string to copy. The string must be null-terminated, and must be no more than kCapacity character long.
Exceptions
std::length_errorThe length of the string is greater than kCapacity.

◆ BasicStaticString() [7/10]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
template<std::input_iterator InputIterator>
constexpr xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::BasicStaticString ( InputIterator  first,
InputIterator  last 
)
constexpr

Constructor that fills the string from a character sequence.

Parameters
firstAn iterator pointing to the first character to copy.
lastAn iterator pointing one position past the last character to copy. There must be no more than kCapacity characters between first and last.
Exceptions
std::length_errorThe length of the sequence [first, last) is greater than kCapacity.

◆ BasicStaticString() [8/10]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::BasicStaticString ( std::initializer_list< Char >  characters)

Constructor that initializes the characters from an initializer list.

Parameters
charactersThe characters to initialize the string with. The size of the initializer list must not exceed kCapacity.
Exceptions
std::length_errorThe size of the initializer list is greater than kCapacity.

◆ BasicStaticString() [9/10]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::BasicStaticString ( const String &  string)
explicitconstexpr

Constructor that copies an arbitrary string.

Template Parameters
StringThe string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>.
Parameters
stringThe string to copy. The size of the string must not exceed kCapacity.
Exceptions
std::length_errorThe size of the string is greater than kCapacity.

◆ BasicStaticString() [10/10]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::BasicStaticString ( const String &  string,
size_type  position,
size_type  count 
)
constexpr

Constructor that copies a sub string of a string.

Template Parameters
StringThe string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>.
Parameters
stringThe string to copy from.
positionThe position of the sub string to copy. Must be a valid sub string position within string, meaning it must be between 0 and the size of the string contained in string, inclusively.
countThe maximum length of the sub string to copy, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr(). Irrespective of the value of count, the effective length of the sub string must not exceed kCapacity.
Exceptions
std::out_of_rangeposition is greater than the size of the string contained in string.
std::length_errorThe effective length of the sub string is greater than kCapacity.

Member Function Documentation

◆ append() [1/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::append ( const BasicStaticString< Char, kCapacity, CharTraits > &  string) -> BasicStaticString &
constexpr

Appends another static string of the same capacity to the string.

Parameters
stringThe string to append.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ append() [2/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::append ( const BasicStaticString< Char, kCapacity, CharTraits > &  string,
size_type  position,
size_type  count = npos 
) -> BasicStaticString &
constexpr

Appends a sub string of another static string of the same capacity to the string.

Parameters
stringThe string to append from.
positionThe position of the sub string to append. Must be a valid sub string position within string, meaning it must be between 0 and the string.size(), inclusively.
countThe maximum length of the sub string to append, or npos to always copy the remainder of the string.
Returns
A Reference to this object
Exceptions
std::out_of_rangeposition is greater than the size of string.
std::length_errorThe resulting string size is greater than kCapacity.

◆ append() [3/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::append ( const Char *  string) -> BasicStaticString &
constexpr

Appends a null-terminated string to the string.

Parameters
stringThe string to append. The string must be null-terminated.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ append() [4/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::append ( const Char *  string,
size_type  count 
) -> BasicStaticString &
constexpr

Appends characters from an array to the string.

Parameters
stringA pointer to the characters to append. The pointer must point to a memory region that is at least count characters long.
countThe number of characters to append.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ append() [5/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::append ( const String &  string) -> BasicStaticString &
constexpr

Appends an arbitrary string to the string.

Template Parameters
StringThe string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>.
Parameters
stringThe string to append.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ append() [6/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::append ( const String &  string,
size_type  position,
size_type  count = npos 
) -> BasicStaticString &
constexpr

Appends a sub string of a string, up to a maximum length to the string.

Template Parameters
StringThe string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>.
Parameters
stringThe string to append from.
positionThe position of the sub string to append. Must be a valid sub string position within string, meaning it must be between 0 and the size of the string contained in string, inclusively.
countThe maximum length of the sub string to append, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr().
Returns
A Reference to this object
Exceptions
std::out_of_rangeposition is greater than the size of the string contained in string.
std::length_errorThe resulting string size is greater than kCapacity.

◆ append() [7/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
template<std::input_iterator InputIterator>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::append ( InputIterator  first,
InputIterator  last 
) -> BasicStaticString &
constexpr

Appends a character sequence to the string.

Parameters
firstAn iterator pointing to the first character to append.
lastAn iterator pointing one position past the last character to append.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ append() [8/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::append ( size_type  count,
Char  character 
) -> BasicStaticString &
constexpr

Appends a number of copies of a character to the string.

Parameters
countThe number of repetitions of the character.
characterThe character to append.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ append() [9/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::append ( std::initializer_list< Char >  characters) -> BasicStaticString &
constexpr

Appends the characters from an initializer list to the string.

Parameters
charactersThe characters to initialize the string with.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ assign() [1/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::assign ( const BasicStaticString< Char, kCapacity, CharTraits > &  string) -> BasicStaticString &
constexprnoexcept

Copies another static string of the same capacity.

Returns
A Reference to this object

◆ assign() [2/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::assign ( const BasicStaticString< Char, kCapacity, CharTraits > &  string,
size_type  position,
size_type  count = npos 
) -> BasicStaticString &
constexprnoexcept

Copies a sub string of another static string of the same capacity.

Parameters
stringThe string to copy from.
positionThe position of the sub string to copy. Must be a valid sub string position within string, meaning it must be between 0 and the string.size(), inclusively.
countThe maximum length of the sub string to copy, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr().
Returns
A Reference to this object
Exceptions
std::out_of_rangeposition is greater than the size of string.

◆ assign() [3/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::assign ( const Char *  string) -> BasicStaticString &
constexpr

Copies a null-terminated string.

Parameters
stringThe string to copy. The string must be null-terminated, and must be no more than kCapacity character long.
Returns
A Reference to this object
Exceptions
std::length_errorThe length of the string is greater than kCapacity.

◆ assign() [4/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::assign ( const Char *  string,
size_type  count 
) -> BasicStaticString &
constexpr

Copies characters from an array.

Parameters
stringA pointer to the characters to copy. The pointer must point to a memory region that is at least count characters long.
countThe number of characters to copy. This must not exceed kCapacity.
Returns
A Reference to this object
Exceptions
std::length_errorcount is greater than kCapacity.

◆ assign() [5/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::assign ( const String &  string) -> BasicStaticString &
constexpr

Copies an arbitrary string.

Template Parameters
StringThe string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>.
Parameters
stringThe string to copy. The size of the string must not exceed kCapacity.
Returns
A Reference to this object
Exceptions
std::length_errorThe size of the string is greater than kCapacity.

◆ assign() [6/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::assign ( const String &  string,
size_type  position,
size_type  count = npos 
) -> BasicStaticString &
constexpr

Copies a sub string of a string, up to a maximum length.

Template Parameters
StringThe string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>.
Parameters
stringThe string to copy from.
positionThe position of the sub string to copy. Must be a valid sub string position within string, meaning it must be between 0 and the size of the string contained in string, inclusively.
countThe maximum length of the sub string to copy, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr(). Irrespective of the value of count, the effective length of the sub string must not exceed kCapacity.
Returns
A Reference to this object
Exceptions
std::out_of_rangeposition is greater than the size of the string contained in string.
std::length_errorThe effective length of the sub string is greater than kCapacity.

◆ assign() [7/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
template<std::input_iterator InputIterator>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::assign ( InputIterator  first,
InputIterator  last 
) -> BasicStaticString &
constexpr

Copies a character range.

Parameters
firstAn iterator pointing to the first character to copy.
lastAn iterator pointing one position past the last character to copy. There must be no more than kCapacity characters between begin and last.
Returns
A Reference to this object
Exceptions
std::length_errorThe length of the sequence [first, last) is greater than kCapacity.

◆ assign() [8/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::assign ( size_type  count,
Char  character 
) -> BasicStaticString &
constexpr

Fills the string with a specific character.

Parameters
countThe number of repetitions of the character. This must not exceed kCapacity.
characterThe character to fill the string with.
Returns
A Reference to this object
Exceptions
std::length_errorcount is greater than kCapacity.

◆ assign() [9/9]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::assign ( std::initializer_list< Char >  characters) -> BasicStaticString &
constexpr

Copies the characters from an initializer list.

Parameters
charactersThe characters to initialize the string with. The size of the initializer list must not exceed kCapacity.
Returns
A Reference to this object
Exceptions
std::length_errorThe size of the initializer list is greater than kCapacity.

◆ at() [1/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::at ( size_type  index) -> reference
constexpr

Accesses the character at a certain index.

Parameters
indexThe index
Returns
A reference to the character at the given index
Exceptions
std::out_of_rangeindex is out of range

◆ at() [2/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::at ( size_type  index) const -> const_reference
constexpr

Accesses the character at a certain index.

Parameters
indexThe index
Returns
A reference to the character at the given index
Exceptions
std::out_of_rangeindex is out of range

◆ back() [1/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::back ( ) const -> const_reference
constexprnoexcept

Returns the last character.

Note
Must not be called on an empty string
Returns
A reference to last character

◆ back() [2/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::back ( ) -> reference
constexprnoexcept

Returns the last character.

Note
Must not be called on an empty string
Returns
A reference to last character

◆ begin() [1/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::begin ( ) const -> const_iterator
constexprnoexcept

Creates a begin iterator.

Returns
An iterator pointing at the first character, or end(), if the data is empty

◆ begin() [2/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::begin ( ) -> iterator
constexprnoexcept

Creates a begin iterator.

Returns
An iterator pointing at the first character, or end(), if the data is empty

◆ c_str()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::c_str ( ) const -> const Char *
constexprnoexcept

Gets the data as a null terminated string.

Returns
The data as a null terminated string.

◆ capacity()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::capacity ( ) const -> size_type
constexprnoexcept

Gets the capacity of the string.

Returns
The capacity, as defined by the kCapacity template parameter.

◆ cbegin()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::cbegin ( ) const -> const_iterator
constexprnoexcept

Creates a begin iterator.

Returns
An iterator pointing at the first character, or end(), if the data is empty

◆ cend()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::cend ( ) const -> const_iterator
constexprnoexcept

Creates an end iterator.

Returns
An iterator pointing at the position past the last character

◆ clear()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::clear ( ) -> void
constexprnoexcept

Clears the string.

◆ crbegin()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::crbegin ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse begin iterator.

Returns
A reverse iterator pointing at the last character, or rend(), if the data is empty

◆ crend()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::crend ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse end iterator.

Returns
A reverse iterator pointing at the position before the first character

◆ data() [1/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::data ( ) const -> const Char *
constexprnoexcept

Gets a pointer to the data.

Returns
A pointer to the data.

◆ data() [2/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::data ( ) -> Char *
constexprnoexcept

Gets a pointer to the data.

Returns
A pointer to the data.

◆ empty()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::empty ( ) const -> bool
constexprnoexcept

Determines whether the string is empty.

Returns
Whether the string is empty

◆ end() [1/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::end ( ) const -> const_iterator
constexprnoexcept

Creates an end iterator.

Returns
An iterator pointing at the position past the last character

◆ end() [2/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::end ( ) -> iterator
constexprnoexcept

Creates an end iterator.

Returns
An iterator pointing at the position past the last character

◆ ends_with() [1/3]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::ends_with ( Char  character) const -> bool
constexprnoexcept

Checks whether the string ends with a certain character.

◆ ends_with() [2/3]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::ends_with ( const Char *  string) const -> bool
constexpr

Checks whether the string ends with a certain text.

◆ ends_with() [3/3]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::ends_with ( std::basic_string_view< Char, CharTraits >  string) const -> bool
constexprnoexcept

Checks whether the string ends with a certain text.

◆ erase() [1/3]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::erase ( const_iterator  first,
const_iterator  last 
) -> iterator
constexprnoexcept

Removes a range of characters from the string.

Parameters
firstThe position of the first character to remove.
lastAn iterator pointing one position past the last character to remove.
Returns
An iterator pointing to the position after the removed characters.

◆ erase() [2/3]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::erase ( const_iterator  position) -> iterator
constexprnoexcept

Removes a single character from the string.

Parameters
positionThe position of the character to remove. position must point to an existing character within the string.
Returns
An iterator pointing to the position after the removed character.

◆ erase() [3/3]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::erase ( size_type  index = 0,
size_type  count = npos 
) -> BasicStaticString &
constexpr

Removes characters from the string.

Parameters
indexThe index of the first character to remove. Must be a valid index within the string, or size() to remove characters from the end of the string. Since there are no characters beyond the end of the string, no characters are ever removed if index is equal to size().
countThe maximum number of characters to remove, or npos to remove all remaining characters. count is allowed to extend beyond the end of the string, in which case all remaining characters are removed..
Returns
A Reference to this object
Exceptions
std::out_of_rangeindex is greater than size().

◆ front() [1/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::front ( ) const -> const_reference
constexprnoexcept

Returns the first character.

Note
Must not be called on an empty string
Returns
A reference to first character

◆ front() [2/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::front ( ) -> reference
constexprnoexcept

Returns the first character.

Note
Must not be called on an empty string
Returns
A reference to first character

◆ insert() [1/11]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::insert ( const_iterator  where,
Char  character 
) -> iterator
constexpr

Inserts a single character into the string.

Parameters
whereThe desired position of the character. Must be a position within the string, or cend() to append the character.
characterThe character to insert.
Returns
The position where the character was inserted.
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ insert() [2/11]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
template<std::input_iterator InputIterator>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::insert ( const_iterator  where,
InputIterator  first,
InputIterator  last 
) -> iterator
constexpr

Inserts a character sequence into the string.

Parameters
whereThe desired position of the character sequence. Must be a position within the string, or cend() to append the sequence.
firstAn iterator pointing to the first character to insert.
lastAn iterator pointing one position past the last character to insert.
Returns
The position where the characters were inserted, or where if nothing was inserted.
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ insert() [3/11]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::insert ( const_iterator  where,
size_type  count,
Char  character 
) -> iterator
constexpr

Inserts a number of copies of a character into the string.

Parameters
whereThe desired position of the characters. Must be a position within the string, or cend() to append the characters.
countThe number of repetitions of the character.
characterThe character to insert.
Returns
The position where the characters were inserted, or where if nothing was inserted.
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ insert() [4/11]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::insert ( const_iterator  where,
std::initializer_list< Char >  characters 
) -> iterator
constexpr

Inserts the characters from an initializer list into the string.

Parameters
whereThe desired position of the characters. Must be a position within the string, or cend() to append the characters.
charactersThe characters to initialize the string with.
Returns
The position where the characters were inserted, or where if nothing was inserted.
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ insert() [5/11]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::insert ( size_type  where,
const BasicStaticString< Char, kCapacity, CharTraits > &  string 
) -> BasicStaticString &
constexpr

Inserts another static string of the same capacity into the string.

Parameters
whereThe desired index of the string. Must be a valid index within the string, or size() to append the string.
stringThe string to insert.
Returns
A Reference to this object
Exceptions
std::out_of_rangewhere is greater than size().
std::length_errorThe resulting string size is greater than kCapacity.

◆ insert() [6/11]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::insert ( size_type  where,
const BasicStaticString< Char, kCapacity, CharTraits > &  string,
size_type  position,
size_type  count = npos 
) -> BasicStaticString &
constexpr

Inserts a sub string of another static string of the same capacity into the string.

Parameters
whereThe desired index of the sub string. Must be a valid index within the string, or size() to append the sub string.
stringThe string to insert from.
positionThe position of the sub string to insert. Must be a valid sub string position within string, meaning it must be between 0 and the string.size(), inclusively.
countThe maximum length of the sub string to insert, or npos to always copy the remainder of the string.
Returns
A Reference to this object
Exceptions
std::out_of_rangewhere is greater than size().
std::out_of_rangeposition is greater than the size of string.
std::length_errorThe resulting string size is greater than kCapacity.

◆ insert() [7/11]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::insert ( size_type  where,
const Char *  string 
) -> BasicStaticString &
constexpr

Inserts a null-terminated string into the string.

Parameters
whereThe desired index of the string. Must be a valid index within the string, or size() to append the string.
stringThe string to insert. The string must be null-terminated.
Returns
A Reference to this object
Exceptions
std::out_of_rangewhere is greater than size().
std::length_errorThe resulting string size is greater than kCapacity.

◆ insert() [8/11]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::insert ( size_type  where,
const Char *  string,
size_type  count 
) -> BasicStaticString &
constexpr

Inserts characters from an array into the string.

Parameters
whereThe desired index of the characters. Must be a valid index within the string, or size() to append the characters.
stringA pointer to the characters to insert. The pointer must point to a memory region that is at least count characters long.
countThe number of characters to insert.
Returns
A Reference to this object
Exceptions
std::out_of_rangewhere is greater than size().
std::length_errorThe resulting string size is greater than kCapacity.

◆ insert() [9/11]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::insert ( size_type  where,
const String &  string 
) -> BasicStaticString &
constexpr

Inserts an arbitrary string into the string.

Parameters
whereThe desired index of the string. Must be a valid index within the string, or size() to append the string.
Template Parameters
StringThe string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>.
Parameters
stringThe string to insert.
Returns
A Reference to this object
Exceptions
std::out_of_rangewhere is greater than size().
std::length_errorThe resulting string size is greater than kCapacity.

◆ insert() [10/11]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::insert ( size_type  where,
const String &  string,
size_type  position,
size_type  count = npos 
) -> BasicStaticString &
constexpr

Inserts a sub string of a string, up to a maximum length into the string.

Template Parameters
StringThe string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>.
Parameters
whereThe desired index of the sub string. Must be a valid index within the string, or size() to append the sub string.
stringThe string to insert from.
positionThe position of the sub string to insert. Must be a valid sub string position within string, meaning it must be between 0 and the size of the string contained in string, inclusively.
countThe maximum length of the sub string to insert, or npos to always copy the remainder of the string. The length of the sub string is calculated in the same way as std::basic_string_view::substr().
Returns
A Reference to this object
Exceptions
std::out_of_rangewhere is greater than size().
std::out_of_rangeposition is greater than the size of the string contained in string.
std::length_errorThe resulting string size is greater than kCapacity.

◆ insert() [11/11]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::insert ( size_type  where,
size_type  count,
Char  character 
) -> BasicStaticString &
constexpr

Inserts a number of copies of a character into the string.

Parameters
whereThe desired index of the characters. Must be a valid index within the string, or size() to append the characters.
countThe number of repetitions of the character.
characterThe character to insert.
Returns
A Reference to this object
Exceptions
std::out_of_rangewhere is greater than size().
std::length_errorThe resulting string size is greater than kCapacity.

◆ length()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::length ( ) const -> size_type
constexprnoexcept

Alias for size()

Returns
The current size

◆ max_size()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
static constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::max_size ( ) -> size_type
staticconstexprnoexcept

Gets the maximum size.

Returns
The maximum size, as defined by the kCapacity template parameter.

◆ operator std::basic_string< Char, CharTraits, Allocator >()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
template<typename Allocator >
constexpr xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator std::basic_string< Char, CharTraits, Allocator > ( ) const
constexprnoexcept

conversion to an std::string

Returns
A copy to the data

◆ operator std::basic_string_view< Char, CharTraits >()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator std::basic_string_view< Char, CharTraits > ( ) const
constexprnoexcept

conversion to a string view

Returns
A view to the data

◆ operator+=() [1/5]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator+= ( Char  character) -> BasicStaticString &
constexpr

Appends a single character to the string.

Parameters
characterThe character to append.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ operator+=() [2/5]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator+= ( const BasicStaticString< Char, kCapacity, CharTraits > &  string) -> BasicStaticString &
constexpr

Appends another static string of the same capacity to the string.

Parameters
stringThe string to append.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ operator+=() [3/5]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator+= ( const Char *  string) -> BasicStaticString &
constexpr

Appends a null-terminated string to the string.

Parameters
stringThe string to append. The string must be null-terminated.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ operator+=() [4/5]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator+= ( const String &  string) -> BasicStaticString &
constexpr

Appends an arbitrary string to the string.

Template Parameters
StringThe string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>.
Parameters
stringThe string to append.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ operator+=() [5/5]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator+= ( std::initializer_list< Char >  characters) -> BasicStaticString &
constexpr

Appends the characters from an initializer list to the string.

Parameters
charactersThe characters to initialize the string with.
Returns
A Reference to this object
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ operator=() [1/5]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator= ( Char  character) -> BasicStaticString &
constexpr

Assignment operator for a single character.

This constructor creates a string of size 1, containing the specified character

Parameters
characterThe character to assign.
Returns
A Reference to this object
Exceptions
std::length_errorThe length of the string is greater than kCapacity.

◆ operator=() [2/5]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator= ( const BasicStaticString< Char, kCapacity, CharTraits > &  ) -> BasicStaticString &=default
constexprdefaultnoexcept

Copy assignment operator.

◆ operator=() [3/5]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator= ( const Char *  string) -> BasicStaticString &
constexpr

Assignment operator for a null-terminated string.

Parameters
stringThe string to copy. The string must be null-terminated, and must be no more than kCapacity character long.
Returns
A Reference to this object
Exceptions
std::length_errorkCapacity is less than 1.

◆ operator=() [4/5]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
template<typename String >
requires (std::is_convertible_v<const String &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const String &, const Char *>)
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator= ( const String &  string) -> BasicStaticString &
constexpr

Assignment operator for an arbitrary string.

Template Parameters
StringThe string type. Must be a type that is convertible to std::basic_string_view<Char, CharTraits>.
Parameters
stringThe string to copy. The size of the string must not exceed kCapacity.
Returns
A Reference to this object
Exceptions
std::length_errorThe size of the string is greater than kCapacity.

◆ operator=() [5/5]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator= ( std::initializer_list< Char >  characters) -> BasicStaticString &
constexpr

Assignment operator for an initializer list.

Parameters
charactersThe characters to initialize the string with. The size of the initializer list must not exceed kCapacity.
Returns
A Reference to this object
Exceptions
std::length_errorThe size of the initializer list is greater than kCapacity.

◆ operator[]() [1/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator[] ( size_type  index) const -> const_reference
constexprnoexcept

Subscript operator.

Returns a reference to the character at a certain index

Parameters
indexThe index
Returns
A reference to the value at the given offset

◆ operator[]() [2/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::operator[] ( size_type  index) -> reference
constexprnoexcept

Subscript operator.

Returns a reference to the character at a certain index

Parameters
indexThe index
Returns
A reference to the value at the given offset

◆ pop_back()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::pop_back ( ) -> void
constexprnoexcept

Removes the last character of the string.

Precondition
Must not be called on an empty string.

◆ push_back()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::push_back ( Char  character) -> void
constexpr

Appends a single character to the string.

Parameters
characterThe character to append.
Exceptions
std::length_errorThe resulting string size is greater than kCapacity.

◆ rawData()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::rawData ( ) -> RawData
constexprnoexcept

Returns an object that allows you to access to the string’s data and size directly.

The returned object gives you access to the raw buffer used by the string. You can use this object to manipulate and resize the string efficiently, without the overhead of using resize().

The buffer actually extends one position past kCapacity, to make room for a terminating null character. It is thus safe to read and write one position past the end of the buffer. This allows you to safely copy a string to the buffer including the terminating null, even if the string has a length of kCapacity and the terminating null will thus end up one position after the end of the buffer.

Returns
An object allowing low-level access to the string’s buffer and size.

◆ rbegin() [1/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::rbegin ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse begin iterator.

Returns
A reverse iterator pointing at the last character, or rend(), if the data is empty

◆ rbegin() [2/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::rbegin ( ) -> reverse_iterator
constexprnoexcept

Creates a reverse begin iterator.

Returns
A reverse iterator pointing at the last character, or rend(), if the data is empty

◆ rend() [1/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::rend ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse end iterator.

Returns
A reverse iterator pointing at the position before the first character

◆ rend() [2/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits >
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::rend ( ) -> reverse_iterator
constexprnoexcept

Creates a reverse end iterator.

Returns
A reverse iterator pointing at the position before the first character

◆ resize() [1/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::resize ( size_type  newSize) -> void
constexprnoexcept

Resizes the string.

If the new size is smaller than the current size, then the string is truncated. If the new size is greater than the current size, then the string is padded with zeros.

Parameters
newSizeThe new size. Must not exceed kCapacity.
Exceptions
std::length_errorThe new size is larger than kCapacity.

◆ resize() [2/2]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::resize ( size_type  newSize,
Char  padding 
) -> void
constexprnoexcept

Resizes the string.

If the new size is smaller than the current size, then the string is truncated. If the new size is greater than the current size, then the string is padded with padding.

Parameters
newSizeThe new size. Must not exceed kCapacity.
paddingThe padding to use if the string size increases
Exceptions
std::length_errorThe new size is larger than kCapacity.

◆ size()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::size ( ) const -> size_type
constexprnoexcept

Gets the current size.

Returns
The current size

◆ starts_with() [1/3]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::starts_with ( Char  character) const -> bool
constexprnoexcept

Checks whether the string starts with a certain character.

◆ starts_with() [2/3]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::starts_with ( const Char *  string) const -> bool
constexpr

Checks whether the string starts with a certain text.

◆ starts_with() [3/3]

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::starts_with ( std::basic_string_view< Char, CharTraits >  string) const -> bool
constexprnoexcept

Checks whether the string starts with a certain text.

◆ str()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
template<typename Allocator = std::allocator<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::str ( const Allocator &  allocator = Allocator()) const -> std::basic_string<Char, CharTraits, Allocator>
constexprnoexcept

Gets the data as an std::string.

Returns
The data as a null terminated string.

◆ view()

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr auto xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::view ( ) const -> std::basic_string_view<Char, CharTraits>
constexprnoexcept

Gets the data as a string view.

Returns
The data as a string view.

Member Data Documentation

◆ npos

template<tools::CharType Char, std::size_t kCapacity, typename CharTraits = std::char_traits<Char>>
constexpr size_type xentara::utils::string::BasicStaticString< Char, kCapacity, CharTraits >::npos
staticconstexpr

Special size value used for automatically determined lengths.