Terminal++ 4.0.1.23
A C++ library for interacting with ANSI terminal windows
|
A class that represents strings of elements. More...
#include <string.hpp>
Public Types | |
using | value_type = element |
Container Typedefs. | |
using | reference = value_type & |
using | const_reference = value_type const & |
using | pointer = element * |
using | const_pointer = element const * |
using | iterator = elements_storage::iterator |
using | const_iterator = elements_storage::const_iterator |
using | reverse_iterator = elements_storage::reverse_iterator |
using | const_reverse_iterator = elements_storage::const_reverse_iterator |
using | difference_type = std::ptrdiff_t |
using | size_type = std::size_t |
Public Member Functions | |
constexpr | string ()=default |
Constructor. | |
template<std::forward_iterator ForwardIterator> | |
constexpr | string (ForwardIterator &&begin, ForwardIterator &&end) |
Range Constructor. | |
constexpr | string (std::initializer_list< element > const &ilist) |
Initializer List Constructor. | |
constexpr | string (char const *text) |
Constructor. | |
constexpr | string (char const *text, size_type len) |
Constructor. | |
constexpr | string (std::string const &text) |
Constructor. | |
constexpr | string (std::string const &text, terminalpp::attribute const &attr) |
Constructor. | |
constexpr | string (size_type size, terminalpp::element const &elem) |
Construct a string of a number of identical elements. | |
constexpr size_type | size () const noexcept |
Returns the number of elements in the string. | |
constexpr iterator | begin () noexcept |
Returns an iterator to the beginning of the string. | |
constexpr const_iterator | begin () const noexcept |
Returns an iterator to the beginning of the string. | |
constexpr reverse_iterator | rbegin () noexcept |
Returns a reverse iterator to the reverse beginning of the string. | |
constexpr const_reverse_iterator | rbegin () const noexcept |
Returns a reverse iterator to the reverse beginning of the string. | |
constexpr iterator | end () noexcept |
Returns an iterator to the end of the string. | |
constexpr const_iterator | end () const noexcept |
Returns an iterator to the end of the string. | |
constexpr reverse_iterator | rend () noexcept |
Returns a reverse iterator to the reverse end of the string. | |
constexpr const_reverse_iterator | rend () const noexcept |
Returns a reverse iterator to the reverse end of the string. | |
constexpr const_iterator | cbegin () noexcept |
Returns an iterator to the beginning of the string. | |
constexpr const_iterator | cend () noexcept |
Returns an iterator to the end of the string. | |
constexpr void | swap (string &other) noexcept |
Swaps the contents of this and another string. | |
constexpr size_type | max_size () const noexcept |
Returns the maximum size of the string allowed. | |
constexpr bool | empty () const noexcept |
Returns whether the string is empty or not. | |
constexpr reference | operator[] (size_type index) noexcept |
Array access operator. | |
constexpr const_reference | operator[] (size_type index) const noexcept |
Array access operator. | |
constexpr string & | operator+= (element const &elem) |
Append operator. | |
constexpr string & | operator+= (string const &rhs) |
Append operator. | |
constexpr void | insert (iterator pos, element const &elem) |
Inserts an element at the iterator position. | |
template<class InputIterator > | |
constexpr void | insert (iterator pos, InputIterator range_begin, InputIterator range_end) |
Inserts a range of elements at the iterator position. | |
constexpr void | erase () |
Erase. | |
constexpr void | erase (iterator range_begin) |
Erase. | |
constexpr void | erase (iterator range_begin, iterator range_end) |
Erase. | |
Friends | |
string | operator+ (string lhs, element const &rhs) |
Append operator. | |
string | operator+ (string lhs, string const &rhs) |
Append operator. | |
constexpr friend auto | operator<=> (string const &lhs, string const &rhs) noexcept=default |
Relational operators for strings. | |
TERMINALPP_EXPORT constexpr friend bool | operator== (string const &lhs, string const &rhs) noexcept=default |
Equality operator. | |
std::size_t | hash_value (string const &str) noexcept |
Hash function. | |
A class that represents strings of elements.
Constructor.
text | the text to build this string around. Results in a string with the passed text, with all attributes their default values. |
Constructor.
text | the text to build this string around. |
len | the length of text. Results in a string of length len with the passed text, with all attributes their default values. |
Constructor.
text | the text to build this string around Results in a string with the passed text, with all attributes their default values. |
|
inlineconstexpr |
Constructor.
text | the text to build this string around. |
attr | the attribute to apply to each new element of the string. |
|
inlineconstexpr |
Construct a string of a number of identical elements.
size | the size of the string to construct. |
elem | a prototype element to fill the string with |