E-MailRelay
|
A zero-copy string field iterator where the field separators are short fixed strings. More...
#include <gstringfield.h>
Public Types | |
using | char_type = typename T::value_type |
Public Member Functions | |
StringFieldT (const T &s, const char_type *sep, std::size_t sepn) noexcept | |
Constructor. More... | |
StringFieldT (const T &s, char_type sep) noexcept | |
Constructor. More... | |
operator bool () const noexcept | |
Returns true if a valid field. More... | |
bool | valid () const noexcept |
Returns true if a valid field. More... | |
T | operator() () const noexcept(deref_operator_noexcept) |
Returns the current field substring. More... | |
StringFieldT< T > & | operator++ () noexcept |
Moves to the next field. More... | |
const char_type * | data () const noexcept |
Returns the current field pointer. More... | |
std::size_t | size () const noexcept |
Returns the current field size. More... | |
bool | first () const noexcept |
Returns true if the current field is the first. More... | |
bool | last () const noexcept |
Returns true if the current field is the last. More... | |
std::size_t | count () const noexcept |
Returns the number of fields. More... | |
StringFieldT (T &&s, const char *, std::size_t)=delete | |
StringFieldT (T &&s, char)=delete | |
StringFieldT (const StringFieldT< T > &)=delete | |
StringFieldT (StringFieldT< T > &&)=delete | |
StringFieldT< T > & | operator= (const StringFieldT< T > &)=delete |
StringFieldT< T > & | operator= (StringFieldT< T > &&)=delete |
Static Public Attributes | |
static constexpr bool | deref_operator_noexcept = std::is_same<T,std::string_view>::value |
A zero-copy string field iterator where the field separators are short fixed strings.
Definition at line 52 of file gstringfield.h.
using G::StringFieldT< T >::char_type = typename T::value_type |
Definition at line 55 of file gstringfield.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 164 of file gstringfield.h.
|
noexcept |
Constructor.
The parameters must stay valid for the object lifefime.
Definition at line 175 of file gstringfield.h.
|
noexcept |
Returns the number of fields.
Definition at line 243 of file gstringfield.h.
|
noexcept |
Returns the current field pointer.
Definition at line 186 of file gstringfield.h.
|
noexcept |
Returns true if the current field is the first.
Definition at line 231 of file gstringfield.h.
|
noexcept |
Returns true if the current field is the last.
Definition at line 237 of file gstringfield.h.
|
explicitnoexcept |
Returns true if a valid field.
Definition at line 200 of file gstringfield.h.
|
noexcept |
Returns the current field substring.
Prefer data() and size() to avoid copying.
Definition at line 212 of file gstringfield.h.
|
noexcept |
Moves to the next field.
Definition at line 219 of file gstringfield.h.
|
noexcept |
Returns the current field size.
Definition at line 193 of file gstringfield.h.
|
noexcept |
Returns true if a valid field.
Definition at line 206 of file gstringfield.h.
|
staticconstexpr |
Definition at line 77 of file gstringfield.h.