istring class
#include <bn_string.h>
Base class of string.
Contents
Can be used as a reference type for all string containers.
Base classes
- class istring_base
- Base class of istring.
Derived classes
-
template<int MaxSize>class string
- String implementation that uses a fixed size buffer.
Public types
- using reverse_iterator = bn::reverse_iterator<iterator>
- Reverse iterator alias.
-
using const_reverse_iterator = bn::reverse_iterator<const_
iterator> - Const reverse iterator alias.
Public functions
-
auto operator=(const istring_
base& other) -> istring& constexpr - Copy assignment operator.
-
auto operator=(const string_
view& view) -> istring& constexpr - Copy assignment operator.
-
auto operator=(const_
pointer char_array_ptr) -> istring& constexpr - Copy assignment operator.
-
auto rbegin() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the end of the characters data.
-
auto rbegin() -> reverse_
iterator constexpr - Returns a reverse iterator to the end of the characters data.
-
auto rend() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the beginning of the characters data.
-
auto rend() -> reverse_
iterator constexpr - Returns a reverse iterator to the beginning of the characters data.
-
auto crbegin() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the end of the characters data.
-
auto crend() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the beginning of the characters data.
-
auto operator[](size_
type index) const -> const_ reference constexpr - Returns a const reference to the character stored at the specified index.
-
auto operator[](size_
type index) -> reference constexpr - Returns a reference to the character stored at the specified index.
-
auto at(size_
type index) const -> const_ reference constexpr - Returns a const reference to the character stored at the specified index.
-
auto at(size_
type index) -> reference constexpr - Returns a reference to the character stored at the specified index.
-
auto front() const -> const_
reference constexpr - Returns a const reference to the first character.
- auto front() -> reference constexpr
- Returns a reference to the first character.
-
auto back() const -> const_
reference constexpr - Returns a const reference to the last character.
- auto back() -> reference constexpr
- Returns a reference to the last character.
-
auto assign(const istring_
base& other) -> istring& constexpr - Replaces the contents of the istring.
-
auto assign(value_
type value) -> istring& constexpr - Replaces the contents of the istring.
-
auto assign(const string_
view& view) -> istring& constexpr - Replaces the contents of the istring.
-
auto assign(const_
pointer char_array_ptr) -> istring& constexpr - Replaces the contents of the istring.
-
auto assign(size_
type count, value_ type value) -> istring& constexpr - Replaces the contents of the istring with count copies of character value.
-
auto assign(const_
iterator first, const_ iterator last) -> istring& constexpr - Replaces the contents of the istring with the characters in the range [first, last).
-
void push_back(value_
type value) constexpr - Inserts a character at the end of the istring.
- void pop_back() constexpr
- Removes the last character of the istring.
-
auto append(const istring_
base& other) -> istring& constexpr - Appends additional characters to the istring.
-
auto append(value_
type value) -> istring& constexpr - Appends an additional character to the istring.
-
auto append(const string_
view& view) -> istring& constexpr - Appends additional characters to the istring.
-
auto append(const_
pointer char_array_ptr) -> istring& constexpr - Appends additional characters to the istring.
-
auto append(const_
pointer char_array_ptr, size_ type char_array_size) -> istring& constexpr - Appends additional characters to the istring.
-
auto append(size_
type count, value_ type value) -> istring& constexpr - Appends additional characters to the istring.
-
auto append(const_
iterator first, const_ iterator last) -> istring& constexpr - Appends additional characters to the istring.
-
auto erase(const_
iterator position) -> iterator constexpr - Erases a character.
-
auto erase(const_
iterator first, const_ iterator last) -> iterator constexpr - Erases a range of characters.
-
auto starts_with(value_
type value) const -> bool constexpr - Checks if the referenced string begins with the given prefix.
-
auto starts_with(const string_
view& other) const -> bool constexpr - Checks if the referenced string begins with the given prefix.
-
auto starts_with(const_
pointer char_array_ptr) const -> bool constexpr - Checks if the referenced string begins with the given prefix.
-
auto ends_with(value_
type value) const -> bool constexpr - Checks if the referenced string ends with the given prefix.
-
auto ends_with(const string_
view& other) const -> bool constexpr - Checks if the referenced string ends with the given prefix.
- void swap(istring& other) constexpr
- Exchanges the contents of this istring with those of the other one.
-
auto operator+=(const istring_
base& other) -> istring& constexpr - Appends additional characters to the istring.
-
auto operator+=(value_
type value) -> istring& constexpr - Appends an additional character to the istring.
-
auto operator+=(const string_
view& view) -> istring& constexpr - Appends additional characters to the istring.
-
auto operator+=(const_
pointer char_array_ptr) -> istring& constexpr - Appends additional characters to the istring.
Friends
-
auto erase(istring& string,
value_
type value) -> friend size_ type constexpr - Erases all characters that are equal to the specified one.
-
template<class Pred>auto erase_if(istring& string, const Pred& pred) -> friend size_
type constexpr - Erases all characters that satisfy the specified predicate.
- auto swap(istring& a, istring& b) -> friend void constexpr
- Exchanges the contents of a istring with those of another one.
Function documentation
istring& bn:: istring:: operator=(const istring_ base& other) constexpr
Copy assignment operator.
| Parameters | |
|---|---|
| other | istring_ |
| Returns | Reference to this. |
istring& bn:: istring:: operator=(const string_ view& view) constexpr
Copy assignment operator.
| Parameters | |
|---|---|
| view | string_ |
| Returns | Reference to this. |
istring& bn:: istring:: operator=(const_ pointer char_array_ptr) constexpr
Copy assignment operator.
| Parameters | |
|---|---|
| char_array_ptr | Pointer to null-terminated characters array. |
| Returns | Reference to this. |
istring& bn:: istring:: assign(const istring_ base& other) constexpr
Replaces the contents of the istring.
| Parameters | |
|---|---|
| other | istring_ |
| Returns | Reference to this. |
istring& bn:: istring:: assign(value_ type value) constexpr
Replaces the contents of the istring.
| Parameters | |
|---|---|
| value | Character replacement. |
| Returns | Reference to this. |
istring& bn:: istring:: assign(const string_ view& view) constexpr
Replaces the contents of the istring.
| Parameters | |
|---|---|
| view | string_ |
| Returns | Reference to this. |
istring& bn:: istring:: assign(const_ pointer char_array_ptr) constexpr
Replaces the contents of the istring.
| Parameters | |
|---|---|
| char_array_ptr | Pointer to null-terminated characters array replacement. |
| Returns | Reference to this. |
istring& bn:: istring:: assign(size_ type count,
value_ type value) constexpr
Replaces the contents of the istring with count copies of character value.
| Parameters | |
|---|---|
| count | New size. |
| value | Character replacement. |
| Returns | Reference to this. |
istring& bn:: istring:: assign(const_ iterator first,
const_ iterator last) constexpr
Replaces the contents of the istring with the characters in the range [first, last).
| Parameters | |
|---|---|
| first | First element of the range. |
| last | Last element of the range. |
| Returns | Reference to this. |
void bn:: istring:: push_back(value_ type value) constexpr
Inserts a character at the end of the istring.
| Parameters | |
|---|---|
| value | Character to insert. |
istring& bn:: istring:: append(const istring_ base& other) constexpr
Appends additional characters to the istring.
| Parameters | |
|---|---|
| other | istring_ |
| Returns | Reference to this. |
istring& bn:: istring:: append(value_ type value) constexpr
Appends an additional character to the istring.
| Parameters | |
|---|---|
| value | Character to append. |
| Returns | Reference to this. |
istring& bn:: istring:: append(const string_ view& view) constexpr
Appends additional characters to the istring.
| Parameters | |
|---|---|
| view | string_ |
| Returns | Reference to this. |
istring& bn:: istring:: append(const_ pointer char_array_ptr) constexpr
Appends additional characters to the istring.
| Parameters | |
|---|---|
| char_array_ptr | Pointer to null-terminated characters array. |
| Returns | Reference to this. |
istring& bn:: istring:: append(const_ pointer char_array_ptr,
size_ type char_array_size) constexpr
Appends additional characters to the istring.
| Parameters | |
|---|---|
| char_array_ptr | Pointer to characters array. |
| char_array_size | Characters count of the characters array. |
| Returns | Reference to this. |
istring& bn:: istring:: append(size_ type count,
value_ type value) constexpr
Appends additional characters to the istring.
| Parameters | |
|---|---|
| count | Number of characters to append. |
| value | Character to append. |
| Returns | Reference to this. |
istring& bn:: istring:: append(const_ iterator first,
const_ iterator last) constexpr
Appends additional characters to the istring.
| Parameters | |
|---|---|
| first | First element of the range to append. |
| last | Last element of the range to append. |
| Returns | Reference to this. |
iterator bn:: istring:: erase(const_ iterator position) constexpr
Erases a character.
| Parameters | |
|---|---|
| position | Iterator to the character to erase. |
| Returns | Iterator following the erased character. |
iterator bn:: istring:: erase(const_ iterator first,
const_ iterator last) constexpr
Erases a range of characters.
| Parameters | |
|---|---|
| first | Iterator to the first character to erase. |
| last | Iterator to the last character to erase. |
| Returns | Iterator following the last erased character. |
The range includes all the characters between first and last, including the character pointed by first, but not the one pointed by last.
bool bn:: istring:: starts_with(value_ type value) const constexpr
Checks if the referenced string begins with the given prefix.
| Parameters | |
|---|---|
| value | Single character. |
| Returns | true if the referenced string begins with the given prefix, false otherwise. |
bool bn:: istring:: starts_with(const string_ view& other) const constexpr
Checks if the referenced string begins with the given prefix.
| Parameters | |
|---|---|
| other | Another string_ |
| Returns | true if the referenced string begins with the given prefix, false otherwise. |
bool bn:: istring:: starts_with(const_ pointer char_array_ptr) const constexpr
Checks if the referenced string begins with the given prefix.
| Parameters | |
|---|---|
| char_array_ptr | Pointer to null-terminated characters array. |
| Returns | true if the referenced string begins with the given prefix, false otherwise. |
bool bn:: istring:: ends_with(value_ type value) const constexpr
Checks if the referenced string ends with the given prefix.
| Parameters | |
|---|---|
| value | Single character. |
| Returns | true if the referenced string ends with the given prefix, false otherwise. |
bool bn:: istring:: ends_with(const string_ view& other) const constexpr
Checks if the referenced string ends with the given prefix.
| Parameters | |
|---|---|
| other | Another string_ |
| Returns | true if the referenced string ends with the given prefix, false otherwise. |
istring& bn:: istring:: operator+=(const istring_ base& other) constexpr
Appends additional characters to the istring.
| Parameters | |
|---|---|
| other | istring_ |
| Returns | Reference to this. |
istring& bn:: istring:: operator+=(value_ type value) constexpr
Appends an additional character to the istring.
| Parameters | |
|---|---|
| value | Character to append. |
| Returns | Reference to this. |
istring& bn:: istring:: operator+=(const string_ view& view) constexpr
Appends additional characters to the istring.
| Parameters | |
|---|---|
| view | string_ |
| Returns | Reference to this. |
istring& bn:: istring:: operator+=(const_ pointer char_array_ptr) constexpr
Appends additional characters to the istring.
| Parameters | |
|---|---|
| char_array_ptr | Pointer to null-terminated characters array. |
| Returns | Reference to this. |
friend size_ type erase(istring& string,
value_ type value) constexpr
Erases all characters that are equal to the specified one.
| Parameters | |
|---|---|
| string | istring from which to erase. |
| value | Character to erase. |
| Returns | Number of erased characters. |
template<class Pred>
friend size_ type erase_if(istring& string,
const Pred& pred) constexpr
Erases all characters that satisfy the specified predicate.
| Parameters | |
|---|---|
| string | istring from which to erase. |
| pred | Unary predicate which returns true if the character should be erased. |
| Returns | Number of erased characters. |