![]() |
|
Wrapper for a UTF-8 encoded std::string_view
that can be iterated over as code points instead of bytes.
More...
#include <unicodeUtils.h>
Public Types | |
using | const_iterator = TfUtf8CodePointIterator |
Public Member Functions | |
TfUtf8CodePointView (const std::string_view &view) | |
const_iterator | begin () const |
TfUtf8CodePointIterator::PastTheEndSentinel | end () const |
The sentinel will compare as equal to any iterator at the end of the underlying string_view | |
const_iterator | cbegin () const |
TfUtf8CodePointIterator::PastTheEndSentinel | cend () const |
The sentinel will compare as equal to any iterator at the end of the underlying string_view | |
bool | empty () const |
Returns true if the underlying view is empty. | |
const_iterator | EndAsIterator () const |
Returns an iterator of the same type as begin that identifies the end of the string. | |
Wrapper for a UTF-8 encoded std::string_view
that can be iterated over as code points instead of bytes.
Because of the variable length encoding, the TfUtf8CodePointView
iterator is a ForwardIterator and is read only.
The TfUtf8CodePointView
's sentinel end()
is compatible with range based for loops and the forthcoming STL ranges library; it avoids triplicating the storage for the end iterator. EndAsIterator()
can be used for algorithms that require the begin and end iterators to be of the same type but necessarily stores redundant copies of the endpoint.
Definition at line 321 of file unicodeUtils.h.
Definition at line 323 of file unicodeUtils.h.
|
inlineexplicit |
Definition at line 326 of file unicodeUtils.h.
|
inline |
Definition at line 328 of file unicodeUtils.h.
|
inline |
Definition at line 340 of file unicodeUtils.h.
|
inline |
The sentinel will compare as equal to any iterator at the end of the underlying string_view
Definition at line 347 of file unicodeUtils.h.
|
inline |
Returns true if the underlying view is empty.
Definition at line 353 of file unicodeUtils.h.
|
inline |
The sentinel will compare as equal to any iterator at the end of the underlying string_view
Definition at line 335 of file unicodeUtils.h.
|
inline |
Returns an iterator of the same type as begin
that identifies the end of the string.
As the end iterator is stored three times, this is slightly heavier than using the PastTheEndSentinel
and should be avoided in performance critical code paths. It is provided for convenience when an algorithm restricts the iterators to have the same type.
As C++20 ranges exposes more sentinel friendly algorithms, this can likely be deprecated in the future.
Definition at line 368 of file unicodeUtils.h.