E-MailRelay
|
A zero-copy string token iterator where the token separators are runs of whitespace characters, with no support for escape characters. More...
#include <gstringtoken.h>
Public Types | |
using | char_type = typename T::value_type |
Public Member Functions | |
StringTokenT (const T &s, const char_type *ws, std::size_t wsn) noexcept | |
Constructor. More... | |
StringTokenT (const T &s, std::string_view ws) noexcept | |
Constructor. More... | |
bool | valid () const noexcept |
Returns true if a valid token position. More... | |
operator bool () const noexcept | |
Returns true if a valid token. More... | |
const char_type * | data () const noexcept |
Returns the current token pointer. More... | |
std::size_t | size () const noexcept |
Returns the current token size. More... | |
std::size_t | pos () const noexcept |
Returns the offset of data(). More... | |
T | operator() () const noexcept(std::is_same< T, std::string_view >::value) |
Returns the current token substring or T() if not valid(). More... | |
StringTokenT< T > & | operator++ () noexcept |
Moves to the next token. More... | |
StringTokenT< T > & | next () noexcept |
Moves to the next token. More... | |
StringTokenT (T &&s, const char_type *, std::size_t)=delete | |
StringTokenT (T &&s, std::string_view)=delete | |
StringTokenT (const StringTokenT< T > &)=delete | |
StringTokenT (StringTokenT< T > &&)=delete | |
StringTokenT< T > & | operator= (const StringTokenT< T > &)=delete |
StringTokenT< T > & | operator= (StringTokenT< T > &&)=delete |
A zero-copy string token iterator where the token separators are runs of whitespace characters, with no support for escape characters.
Leading and trailing whitespace are not significant. Empty whitespace yields a single token. Stepping beyond the last token is allowed.
Definition at line 53 of file gstringtoken.h.
using G::StringTokenT< T >::char_type = typename T::value_type |
Definition at line 56 of file gstringtoken.h.
|
noexcept |
Constructor.
The parameters must stay valid for the object lifefime.
The rvalue overload is deleted to avoid passing a temporary T that has been implicitly constructed from something else. Temporary std::string_views constructed from a string would be safe, but might be unsafe for other types.
Definition at line 133 of file gstringtoken.h.
|
noexcept |
Constructor.
The parameters must stay valid for the object lifefime.
Definition at line 146 of file gstringtoken.h.
|
noexcept |
Returns the current token pointer.
Definition at line 156 of file gstringtoken.h.
|
noexcept |
Moves to the next token.
Definition at line 205 of file gstringtoken.h.
|
explicitnoexcept |
Returns true if a valid token.
Definition at line 175 of file gstringtoken.h.
|
noexcept |
Returns the current token substring or T() if not valid().
Definition at line 187 of file gstringtoken.h.
|
noexcept |
Moves to the next token.
Definition at line 194 of file gstringtoken.h.
|
noexcept |
Returns the offset of data().
Definition at line 169 of file gstringtoken.h.
|
noexcept |
Returns the current token size.
Definition at line 163 of file gstringtoken.h.
|
noexcept |
Returns true if a valid token position.
Definition at line 181 of file gstringtoken.h.