HDK
|
#include <unicodeUtils.h>
Public Types | |
using | const_iterator = TfUtf8CodePointIterator |
Public Member Functions | |
TfUtf8CodePointView ()=default | |
TfUtf8CodePointView (const std::string_view &view) | |
const_iterator | begin () const |
TfUtf8CodePointIterator::PastTheEndSentinel | end () const |
const_iterator | cbegin () const |
TfUtf8CodePointIterator::PastTheEndSentinel | cend () const |
bool | empty () const |
Returns true if the underlying view is empty. More... | |
const_iterator | EndAsIterator () const |
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 338 of file unicodeUtils.h.
Definition at line 340 of file unicodeUtils.h.
|
default |
|
inlineexplicit |
Definition at line 343 of file unicodeUtils.h.
|
inline |
Definition at line 345 of file unicodeUtils.h.
|
inline |
Definition at line 357 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 364 of file unicodeUtils.h.
|
inline |
Returns true if the underlying view is empty.
Definition at line 370 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 352 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 385 of file unicodeUtils.h.