Zserio C++ runtime library
1.0.0
Built for Zserio 2.13.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 ch, 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 ch, 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 ch, 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 ch, 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 ch, 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 ch, 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.
|
defaultnoexcept |
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.
|
inlinenoexcept |
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 64 of file StringView.h.
|
inlinenoexcept |
Constructor. Initializes string view to given std::basic_string
str | Input string. |
Definition at line 74 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 192 of file StringView.h.
|
inlinenoexcept |
Get reference to the last element of the string. The string shall not be empty.
Definition at line 217 of file StringView.h.
|
inlinenoexcept |
Begin iteration.
Definition at line 98 of file StringView.h.
|
inlinenoexcept |
Begin iteration.
Definition at line 108 of file StringView.h.
|
inlinenoexcept |
End iteration.
Definition at line 128 of file StringView.h.
|
inlinenoexcept |
Compare this string view to other.
other | Second string view. |
Definition at line 353 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 378 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 394 of file StringView.h.
|
inline |
Compare this string view to other.
str | String to compare with. |
Definition at line 406 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 420 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 435 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 314 of file StringView.h.
|
inlinenoexcept |
Begin reverse iteration.
Definition at line 148 of file StringView.h.
|
inlinenoexcept |
End reverse iteration.
Definition at line 168 of file StringView.h.
|
inlinenoexcept |
Get pointer to the beginning of the referenced string.
Definition at line 227 of file StringView.h.
|
inlinenoexcept |
Check if the string is empty.
Definition at line 267 of file StringView.h.
|
inlinenoexcept |
End iteration.
Definition at line 118 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 447 of file StringView.h.
|
inlinenoexcept |
Find position of given char in this string view.
ch | Char to search. |
pos | Position where the start the search. |
Definition at line 482 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 495 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 507 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 692 of file StringView.h.
|
inlinenoexcept |
Finds the first character not equal to the given character.
ch | Character to search. |
pos | Position where to start the search. |
Definition at line 713 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 726 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 738 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 576 of file StringView.h.
|
inlinenoexcept |
Find the position of the first character equal to the given character.
ch | Character to search. |
pos | Position where to start the search. |
Definition at line 597 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 610 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 622 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 750 of file StringView.h.
|
inlinenoexcept |
Find the last character not equal to the given character.
ch | Character to search. |
pos | Position where to start the search. |
Definition at line 771 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 784 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 796 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 634 of file StringView.h.
|
inlinenoexcept |
Find the last character not equal to the given character.
ch | Character to search. |
pos | Position where to start the search. |
Definition at line 655 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 668 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 680 of file StringView.h.
|
inlinenoexcept |
Get reference to the first element of the string. The string shall not be empty.
Definition at line 207 of file StringView.h.
|
inlinenoexcept |
Get referenced string length.
Definition at line 247 of file StringView.h.
|
inlinenoexcept |
Get max. allowed string length.
Definition at line 257 of file StringView.h.
|
defaultnoexcept |
Method generated by default.
|
defaultnoexcept |
Method generated by default.
|
inlinenoexcept |
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 179 of file StringView.h.
|
inlinenoexcept |
Begin reverse iteration.
Definition at line 138 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 277 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 288 of file StringView.h.
|
inlinenoexcept |
End reverse iteration.
Definition at line 158 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 519 of file StringView.h.
|
inlinenoexcept |
Find position of given char in this string view, starting from the view end.
ch | Char to search. |
pos | Position where the start the search. |
Definition at line 540 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 552 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 564 of file StringView.h.
|
inlinenoexcept |
Get referenced string length.
Definition at line 237 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 335 of file StringView.h.
|
inlinenoexcept |
Swap the content with another string view.
other | Another string view |
Definition at line 298 of file StringView.h.
|
static |
Constant used to indicate end of view or "not a position", depending on context.
Definition at line 42 of file StringView.h.