Zserio C++ runtime library
1.1.0
Built for Zserio 2.15.0
|
#include <StringView.h>
Public Types | |
using | traits_type = Traits |
using | value_type = CharT |
using | pointer = CharT * |
using | const_pointer = const CharT * |
using | reference = CharT & |
using | const_reference = const CharT & |
using | const_iterator = const_pointer |
using | iterator = const_iterator |
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
using | reverse_iterator = const_reverse_iterator |
using | size_type = size_t |
using | difference_type = ptrdiff_t |
Public Member Functions | |
constexpr | BasicStringView () noexcept=default |
BasicStringView (const const_pointer str) noexcept | |
constexpr | BasicStringView (const const_pointer str, const size_type count) noexcept |
template<typename ALLOC > | |
constexpr | BasicStringView (const std::basic_string< CharT, Traits, ALLOC > &str) noexcept |
constexpr const_iterator | begin () const noexcept |
constexpr const_iterator | cbegin () const noexcept |
constexpr const_iterator | end () const noexcept |
constexpr const_iterator | cend () const noexcept |
constexpr const_reverse_iterator | rbegin () const noexcept |
constexpr const_reverse_iterator | crbegin () const noexcept |
constexpr const_reverse_iterator | rend () const noexcept |
constexpr const_reverse_iterator | crend () const noexcept |
constexpr const_reference | operator[] (const size_type pos) const noexcept |
const_reference | at (const size_type pos) const |
constexpr const_reference | front () const noexcept |
constexpr const_reference | back () const noexcept |
constexpr const_pointer | data () const noexcept |
constexpr size_type | size () const noexcept |
constexpr size_type | length () const noexcept |
constexpr size_type | max_size () const noexcept |
constexpr bool | empty () const noexcept |
void | remove_prefix (size_type n) |
void | remove_suffix (size_type n) |
void | swap (BasicStringView &other) noexcept |
size_type | copy (CharT *dest, size_type count, size_type pos=0) const |
BasicStringView | substr (size_type pos=0, size_type count=npos) const |
int | compare (BasicStringView other) const noexcept |
int | compare (size_type pos1, size_type count1, BasicStringView other) const |
int | compare (size_type pos1, size_type count1, BasicStringView other, size_type pos2, size_type count2) const |
int | compare (const CharT *str) const |
int | compare (size_type pos1, size_type count1, const CharT *str) const |
int | compare (size_type pos1, size_type count1, const CharT *str, size_type count2) const |
size_type | find (BasicStringView str, size_type pos=0) const noexcept |
size_type | find (CharT character, size_type pos=0) const noexcept |
size_type | find (const CharT *str, size_type pos, size_type count) const |
size_type | find (const CharT *str, size_type pos=0) const |
size_type | rfind (BasicStringView str, size_type pos=npos) const noexcept |
size_type | rfind (CharT character, size_type pos=npos) const noexcept |
size_type | rfind (const CharT *str, size_type pos, size_type count) const |
size_type | rfind (const CharT *str, size_type pos=npos) const |
size_type | find_first_of (BasicStringView str, size_type pos=0) const noexcept |
size_type | find_first_of (CharT character, size_type pos=0) const noexcept |
size_type | find_first_of (const CharT *str, size_type pos, size_type count) const |
size_type | find_first_of (const CharT *str, size_type pos=0) const |
size_type | find_last_of (BasicStringView str, size_type pos=npos) const noexcept |
size_type | find_last_of (CharT character, size_type pos=npos) const noexcept |
size_type | find_last_of (const CharT *str, size_type pos, size_type count) const |
size_type | find_last_of (const CharT *str, size_type pos=npos) const |
size_type | find_first_not_of (BasicStringView str, size_type pos=0) const noexcept |
size_type | find_first_not_of (CharT character, size_type pos=0) const noexcept |
size_type | find_first_not_of (const CharT *str, size_type pos, size_type count) const |
size_type | find_first_not_of (const CharT *str, size_type pos=0) const |
size_type | find_last_not_of (BasicStringView str, size_type pos=npos) const noexcept |
size_type | find_last_not_of (CharT character, size_type pos=npos) const noexcept |
size_type | find_last_not_of (const CharT *str, size_type pos, size_type count) const |
size_type | find_last_not_of (const CharT *str, size_type pos=npos) const |
~BasicStringView ()=default | |
BasicStringView (const BasicStringView &) noexcept=default | |
BasicStringView & | operator= (const BasicStringView &) noexcept=default |
BasicStringView (BasicStringView &&) noexcept=default | |
BasicStringView & | operator= (BasicStringView &&) noexcept=default |
Static Public Attributes | |
static constexpr const size_type | npos = static_cast<size_type>(-1) |
Non-owning constant view to a string. The user of this class is responsible of making sure, that the referenced string is valid as long as the view is alive. Inspired by C++17 std::basic_string_view.
Definition at line 23 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::const_iterator = const_pointer |
Definition at line 32 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::const_pointer = const CharT* |
Definition at line 29 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::const_reference = const CharT& |
Definition at line 31 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Definition at line 34 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::difference_type = ptrdiff_t |
Definition at line 37 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::iterator = const_iterator |
Definition at line 33 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::pointer = CharT* |
Definition at line 28 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::reference = CharT& |
Definition at line 30 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::reverse_iterator = const_reverse_iterator |
Definition at line 35 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::size_type = size_t |
Definition at line 36 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::traits_type = Traits |
Definition at line 26 of file StringView.h.
using zserio::BasicStringView< CharT, Traits >::value_type = CharT |
Definition at line 27 of file StringView.h.
|
constexprdefaultnoexcept |
Constructor. Initializes empty view.
|
inlinenoexcept |
Constructor. Initializes string view to given null-terminated string.
str | Input null-terminated string. |
Definition at line 54 of file StringView.h.
|
inlineconstexprnoexcept |
Constructor. Initializes string view to given string with given length.
str | Input string. |
count | Length of the view. Shall not be longer than the input string. |
Definition at line 65 of file StringView.h.
|
inlineconstexprnoexcept |
Constructor. Initializes string view to given std::basic_string
str | Input string. |
Definition at line 76 of file StringView.h.
|
default |
Method generated by default.
|
defaultnoexcept |
Method generated by default.
|
defaultnoexcept |
Method generated by default.
|
inline |
Element access operator. Returns reference to the element of the referenced string at given index.
pos | Index of the element to access. |
CppRuntimeException | if pos is not less than size(). |
Definition at line 195 of file StringView.h.
|
inlineconstexprnoexcept |
Get reference to the last element of the string. The string shall not be empty.
Definition at line 220 of file StringView.h.
|
inlineconstexprnoexcept |
Begin iteration.
Definition at line 101 of file StringView.h.
|
inlineconstexprnoexcept |
Begin iteration.
Definition at line 111 of file StringView.h.
|
inlineconstexprnoexcept |
End iteration.
Definition at line 131 of file StringView.h.
|
inlinenoexcept |
Compare this string view to other.
other | Second string view. |
Definition at line 356 of file StringView.h.
|
inline |
Compare this string view to other.
str | String to compare with. |
Definition at line 417 of file StringView.h.
|
inline |
Compare this string view to other.
pos1 | Start position in this view. |
count1 | Number of elements in the view. |
other | Second string view. |
Definition at line 389 of file StringView.h.
|
inline |
Compare this string view to other.
pos1 | Start position in this view. |
count1 | Number of elements in the view. |
other | Second string view. |
pos2 | Start position in the other view. |
count2 | Number of element in the other view. |
Definition at line 405 of file StringView.h.
|
inline |
Compare this string view to other.
pos1 | Start position in this view. |
count1 | Number of elements in the view. |
str | String to compare with. |
Definition at line 431 of file StringView.h.
|
inline |
Compare this string view to other.
pos1 | Start position in this view. |
count1 | Number of elements in the view. |
str | String to compare with. |
count2 | Number of element in the str. |
Definition at line 446 of file StringView.h.
|
inline |
Copy the specified amount of elements from the string view to given buffer.
dest | Buffer where the substring should be copied. |
count | Number of elements to copy. |
pos | Offset in the string view, where the copy should begin. |
CppRuntimeException | if pos is > size(). |
Definition at line 317 of file StringView.h.
|
inlineconstexprnoexcept |
Begin reverse iteration.
Definition at line 151 of file StringView.h.
|
inlineconstexprnoexcept |
End reverse iteration.
Definition at line 171 of file StringView.h.
|
inlineconstexprnoexcept |
Get pointer to the beginning of the referenced string.
Definition at line 230 of file StringView.h.
|
inlineconstexprnoexcept |
Check if the string is empty.
Definition at line 270 of file StringView.h.
|
inlineconstexprnoexcept |
End iteration.
Definition at line 121 of file StringView.h.
|
inlinenoexcept |
Find position of given string view in this string view.
str | String to search. |
pos | Position where the start the search. |
Definition at line 458 of file StringView.h.
|
inlinenoexcept |
Find position of given char in this string view.
character | Char to search. |
pos | Position where the start the search. |
Definition at line 497 of file StringView.h.
|
inline |
Find position of given string in this string view.
str | String to search. |
pos | Position where the start the search. |
count | Length of str. |
Definition at line 510 of file StringView.h.
|
inline |
Find position of given null-terminated string in this string view.
str | String to search. |
pos | Position where the start the search. |
Definition at line 522 of file StringView.h.
|
inlinenoexcept |
Finds the first character not equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
Definition at line 719 of file StringView.h.
|
inlinenoexcept |
Finds the first character not equal to the given character.
character | Character to search. |
pos | Position where to start the search. |
Definition at line 744 of file StringView.h.
|
inline |
Finds the first character not equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
count | Number of characters in str. |
Definition at line 757 of file StringView.h.
|
inline |
Finds the first character not equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
Definition at line 769 of file StringView.h.
|
inlinenoexcept |
Find the position of the first character equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
Definition at line 595 of file StringView.h.
|
inlinenoexcept |
Find the position of the first character equal to the given character.
character | Character to search. |
pos | Position where to start the search. |
Definition at line 620 of file StringView.h.
|
inline |
Find the position of the first character equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
count | Number of character in str. |
Definition at line 633 of file StringView.h.
|
inline |
Find the position of the first character equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
Definition at line 645 of file StringView.h.
|
inlinenoexcept |
Find the last character not equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
Definition at line 781 of file StringView.h.
|
inlinenoexcept |
Find the last character not equal to the given character.
character | Character to search. |
pos | Position where to start the search. |
Definition at line 806 of file StringView.h.
|
inline |
Find the last character not equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
count | Number of characters in str. |
Definition at line 819 of file StringView.h.
|
inline |
Find the last character not equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
Definition at line 831 of file StringView.h.
|
inlinenoexcept |
Find the last character not equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
Definition at line 657 of file StringView.h.
|
inlinenoexcept |
Find the last character not equal to the given character.
character | Character to search. |
pos | Position where to start the search. |
Definition at line 682 of file StringView.h.
|
inline |
Find the last character not equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
count | Number of characters in str. |
Definition at line 695 of file StringView.h.
|
inline |
Find the last character not equal to any of the characters in the given character sequence.
str | Sequence to search. |
pos | Position where to start the search. |
Definition at line 707 of file StringView.h.
|
inlineconstexprnoexcept |
Get reference to the first element of the string. The string shall not be empty.
Definition at line 210 of file StringView.h.
|
inlineconstexprnoexcept |
Get referenced string length.
Definition at line 250 of file StringView.h.
|
inlineconstexprnoexcept |
Get max. allowed string length.
Definition at line 260 of file StringView.h.
|
defaultnoexcept |
Method generated by default.
|
defaultnoexcept |
Method generated by default.
|
inlineconstexprnoexcept |
Element access operator. Returns reference to the element of the referenced string at given index.
pos | Index of the element to access. Shall be less than size(). |
Definition at line 182 of file StringView.h.
|
inlineconstexprnoexcept |
Begin reverse iteration.
Definition at line 141 of file StringView.h.
|
inline |
Modify the string view so that it skips specified amount of elements at the beginning.
n | Number of elements to skip. Shall not be greater than size(). |
Definition at line 280 of file StringView.h.
|
inline |
Modify the string view so that it skips specified amount of elements at the end.
n | Number of elements to skip. Shall not be greater than size(). |
Definition at line 291 of file StringView.h.
|
inlineconstexprnoexcept |
End reverse iteration.
Definition at line 161 of file StringView.h.
|
inlinenoexcept |
Find position of given string view in this string view, starting from the view end.
str | String to search. |
pos | Position where the start the search. |
Definition at line 534 of file StringView.h.
|
inlinenoexcept |
Find position of given char in this string view, starting from the view end.
character | Char to search. |
pos | Position where the start the search. |
Definition at line 559 of file StringView.h.
|
inline |
Find position of given null-terminated string in this string view, starting from the view end.
str | String to search. |
pos | Position where the start the search. |
Definition at line 571 of file StringView.h.
|
inline |
Find position of given null-terminated string in this string view, starting from the view end.
str | String to search. |
pos | Position where the start the search. |
Definition at line 583 of file StringView.h.
|
inlineconstexprnoexcept |
Get referenced string length.
Definition at line 240 of file StringView.h.
|
inline |
Calculate string sub-view.
pos | Position in this view, where the sub-view should start. |
count | Number of element in the sub-view. |
CppRuntimeException | if pos is > size(). |
Definition at line 338 of file StringView.h.
|
inlinenoexcept |
Swap the content with another string view.
other | Another string view |
Definition at line 301 of file StringView.h.
|
staticconstexpr |
Constant used to indicate end of view or "not a position", depending on context.
Definition at line 42 of file StringView.h.