tlx
|
StringView is a reference to a part of a string, consisting of only a char pointer and a length. More...
#include <string_view.hpp>
Public Types | |
typedef char | value_type |
typedef char * | pointer |
typedef const char * | const_pointer |
typedef char & | reference |
typedef const char & | const_reference |
typedef const_pointer | const_iterator |
typedef const_iterator | iterator |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
typedef const_reverse_iterator | reverse_iterator |
typedef std::size_t | size_type |
typedef std::ptrdiff_t | difference_type |
Public Member Functions | |
StringView () noexcept | |
default construction More... | |
StringView (const StringView &rhs) noexcept=default | |
copy construction More... | |
StringView & | operator= (const StringView &rhs) noexcept=default |
assignment More... | |
StringView (const std::string &str) noexcept | |
assign a whole string More... | |
StringView (std::string &&)=delete | |
constructing a StringView from a temporary string is a bad idea More... | |
StringView (const char *str) noexcept | |
assign a whole C-style string More... | |
StringView (const char *str, size_type size) noexcept | |
assign a C-style string with given length More... | |
StringView (const std::string::const_iterator &begin, size_t size) noexcept | |
assign a string iterator with given length More... | |
StringView (const std::string::const_iterator &begin, const std::string::const_iterator &end) noexcept | |
assign a string between two iterators More... | |
operator std::string () const | |
std::string | to_string () const |
Returns the data of this StringView as a std::string. More... | |
size_type | copy (char *s, size_type n, size_type pos=0) const |
StringView | substr (size_type pos, size_type n=npos) const |
iterators | |
const_iterator | begin () const noexcept |
const_iterator | cbegin () const noexcept |
const_iterator | end () const noexcept |
const_iterator | cend () const noexcept |
const_reverse_iterator | rbegin () const noexcept |
const_reverse_iterator | crbegin () const noexcept |
const_reverse_iterator | rend () const noexcept |
const_reverse_iterator | crend () const noexcept |
capacity | |
size_type | size () const noexcept |
size_type | length () const noexcept |
size_type | max_size () const noexcept |
bool | empty () const noexcept |
element access | |
const_pointer | data () const noexcept |
const_reference | operator[] (size_type pos) const noexcept |
const_reference | at (size_t pos) const |
const_reference | front () const |
const_reference | back () const |
modifiers | |
void | clear () noexcept |
void | remove_prefix (size_type n) |
void | remove_suffix (size_type n) |
void | swap (StringView &s) noexcept |
comparisons | |
int | compare (StringView x) const noexcept |
int | compare (size_type pos1, size_type n1, StringView x) const noexcept |
int | compare (size_type pos1, size_type n1, StringView x, size_type pos2, size_type n2) const |
int | compare (const char *x) const |
int | compare (size_type pos1, size_type n1, const char *x) const |
int | compare (size_type pos1, size_type n1, const char *x, size_type n2) const |
comparison operators | |
bool | operator== (const StringView &other) const noexcept |
Equality operator to compare a StringView with another StringView. More... | |
bool | operator!= (const StringView &other) const noexcept |
Inequality operator to compare a StringView with another StringView. More... | |
bool | operator< (const StringView &other) const noexcept |
Less operator to compare a StringView with another StringView lexicographically. More... | |
bool | operator> (const StringView &other) const noexcept |
Greater than. More... | |
bool | operator<= (const StringView &other) const noexcept |
Less than or equal to. More... | |
bool | operator>= (const StringView &other) const noexcept |
Less than or equal to. More... | |
searches | |
bool | starts_with (char c) const noexcept |
bool | starts_with (StringView x) const noexcept |
bool | ends_with (char c) const noexcept |
bool | ends_with (StringView x) const noexcept |
find | |
size_type | find (StringView s, size_type pos=0) const noexcept |
size_type | find (char c, size_type pos=0) const noexcept |
size_type | find (const char *s, size_type pos, size_type n) const noexcept |
size_type | find (const char *s, size_type pos=0) const noexcept |
rfind | |
size_type | rfind (StringView s, size_type pos=npos) const noexcept |
size_type | rfind (char c, size_type pos=npos) const noexcept |
size_type | rfind (const char *s, size_type pos, size_type n) const noexcept |
size_type | rfind (const char *s, size_type pos=npos) const noexcept |
find_first_of | |
size_type | find_first_of (StringView s, size_type pos=0) const noexcept |
size_type | find_first_of (char c, size_type pos=0) const noexcept |
size_type | find_first_of (const char *s, size_type pos, size_type n) const noexcept |
size_type | find_first_of (const char *s, size_type pos=0) const noexcept |
find_last_of | |
size_type | find_last_of (StringView s, size_type pos=npos) const noexcept |
size_type | find_last_of (char c, size_type pos=npos) const noexcept |
size_type | find_last_of (const char *s, size_type pos, size_type n) const noexcept |
size_type | find_last_of (const char *s, size_type pos=npos) const noexcept |
find_first_not_of | |
size_type | find_first_not_of (StringView s, size_type pos=0) const noexcept |
size_type | find_first_not_of (char c, size_type pos=0) const noexcept |
size_type | find_first_not_of (const char *s, size_type pos, size_type n) const noexcept |
size_type | find_first_not_of (const char *s, size_type pos=0) const noexcept |
find_last_not_of | |
size_type | find_last_not_of (StringView s, size_type pos=npos) const noexcept |
size_type | find_last_not_of (char c, size_type pos=npos) const noexcept |
size_type | find_last_not_of (const char *s, size_type pos, size_type n) const noexcept |
size_type | find_last_not_of (const char *s, size_type pos=npos) const noexcept |
Static Public Attributes | |
static constexpr size_type | npos |
Private Member Functions | |
template<typename r_iter > | |
size_type | reverse_distance (r_iter first, r_iter last) const noexcept |
template<typename Iterator > | |
Iterator | find_not_of (Iterator first, Iterator last, StringView s) const noexcept |
Private Attributes | |
const char * | ptr_ |
size_type | size_ |
Friends | |
std::ostream & | operator<< (std::ostream &os, const StringView &v) |
StringView is a reference to a part of a string, consisting of only a char pointer and a length.
It does not have ownership of the substring and is used mainly for temporary objects.
Definition at line 44 of file string_view.hpp.
typedef const_pointer const_iterator |
Definition at line 53 of file string_view.hpp.
typedef const char* const_pointer |
Definition at line 50 of file string_view.hpp.
typedef const char& const_reference |
Definition at line 52 of file string_view.hpp.
typedef std::reverse_iterator<const_iterator> const_reverse_iterator |
Definition at line 55 of file string_view.hpp.
typedef std::ptrdiff_t difference_type |
Definition at line 58 of file string_view.hpp.
typedef const_iterator iterator |
Definition at line 54 of file string_view.hpp.
typedef char* pointer |
Definition at line 49 of file string_view.hpp.
typedef char& reference |
Definition at line 51 of file string_view.hpp.
Definition at line 56 of file string_view.hpp.
typedef std::size_t size_type |
Definition at line 57 of file string_view.hpp.
typedef char value_type |
Definition at line 48 of file string_view.hpp.
|
inlinenoexcept |
default construction
Definition at line 63 of file string_view.hpp.
|
defaultnoexcept |
copy construction
|
inlinenoexcept |
assign a whole string
Definition at line 71 of file string_view.hpp.
|
delete |
constructing a StringView from a temporary string is a bad idea
|
inlinenoexcept |
assign a whole C-style string
Definition at line 78 of file string_view.hpp.
|
inlinenoexcept |
assign a C-style string with given length
Definition at line 82 of file string_view.hpp.
|
inlinenoexcept |
assign a string iterator with given length
Definition at line 86 of file string_view.hpp.
|
inlinenoexcept |
assign a string between two iterators
Definition at line 90 of file string_view.hpp.
|
inline |
Definition at line 136 of file string_view.hpp.
|
inline |
Definition at line 143 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 97 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 98 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 100 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 150 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 197 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 203 of file string_view.hpp.
|
inline |
Definition at line 207 of file string_view.hpp.
|
inline |
Definition at line 212 of file string_view.hpp.
Definition at line 216 of file string_view.hpp.
Definition at line 220 of file string_view.hpp.
Definition at line 180 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 105 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 111 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 130 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 123 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 99 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 276 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 280 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 290 of file string_view.hpp.
Definition at line 299 of file string_view.hpp.
Definition at line 302 of file string_view.hpp.
Definition at line 305 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 393 of file string_view.hpp.
Definition at line 402 of file string_view.hpp.
Definition at line 405 of file string_view.hpp.
Definition at line 409 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 343 of file string_view.hpp.
Definition at line 350 of file string_view.hpp.
Definition at line 353 of file string_view.hpp.
Definition at line 357 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 419 of file string_view.hpp.
Definition at line 429 of file string_view.hpp.
Definition at line 432 of file string_view.hpp.
Definition at line 436 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 366 of file string_view.hpp.
Definition at line 377 of file string_view.hpp.
Definition at line 380 of file string_view.hpp.
Definition at line 384 of file string_view.hpp.
|
inlineprivatenoexcept |
Definition at line 458 of file string_view.hpp.
|
inline |
Definition at line 142 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 121 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 122 of file string_view.hpp.
|
inlineexplicit |
Definition at line 173 of file string_view.hpp.
|
inlinenoexcept |
Inequality operator to compare a StringView with another StringView.
Definition at line 237 of file string_view.hpp.
|
inlinenoexcept |
Less operator to compare a StringView with another StringView lexicographically.
Definition at line 243 of file string_view.hpp.
|
inlinenoexcept |
Less than or equal to.
Definition at line 254 of file string_view.hpp.
|
defaultnoexcept |
assignment
|
inlinenoexcept |
Equality operator to compare a StringView with another StringView.
Definition at line 231 of file string_view.hpp.
|
inlinenoexcept |
Greater than.
Definition at line 249 of file string_view.hpp.
|
inlinenoexcept |
Less than or equal to.
Definition at line 259 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 132 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 102 of file string_view.hpp.
|
inline |
Definition at line 152 of file string_view.hpp.
|
inline |
Definition at line 159 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 108 of file string_view.hpp.
|
inlineprivatenoexcept |
Definition at line 451 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 314 of file string_view.hpp.
Definition at line 328 of file string_view.hpp.
Definition at line 331 of file string_view.hpp.
Definition at line 334 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 120 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 268 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 272 of file string_view.hpp.
|
inline |
Definition at line 188 of file string_view.hpp.
|
inlinenoexcept |
Definition at line 165 of file string_view.hpp.
|
inline |
Returns the data of this StringView as a std::string.
Definition at line 178 of file string_view.hpp.
|
friend |
Definition at line 444 of file string_view.hpp.
|
static |
Definition at line 60 of file string_view.hpp.
|
private |
Definition at line 466 of file string_view.hpp.
|
private |
Definition at line 467 of file string_view.hpp.