|
ICU 78.1
78.1
|
Validating iterator over the code points in a Unicode string. More...
#include <utfiterator.h>
Public Types | |
| using | value_type = CodeUnits< CP32, UnitIter > |
| C++ iterator boilerplate. More... | |
| using | reference = value_type |
| C++ iterator boilerplate. More... | |
| using | pointer = Proxy |
| C++ iterator boilerplate. More... | |
| using | difference_type = prv::iter_difference_t< UnitIter > |
| C++ iterator boilerplate. More... | |
| using | iterator_category = std::conditional_t< prv::bidirectional_iterator< UnitIter >, std::bidirectional_iterator_tag, std::forward_iterator_tag > |
| C++ iterator boilerplate. More... | |
Public Member Functions | |
| U_FORCE_INLINE | UTFIterator (UnitIter start, UnitIter p, LimitIter limit) |
| Constructor with start <= p < limit. More... | |
| U_FORCE_INLINE | UTFIterator (UnitIter p, LimitIter limit) |
| Constructor with start == p < limit. More... | |
| U_FORCE_INLINE | UTFIterator (UnitIter p) |
| Constructs an iterator start or limit sentinel. More... | |
| U_FORCE_INLINE | UTFIterator () |
| Default constructor. More... | |
| U_FORCE_INLINE | UTFIterator (UTFIterator &&src) noexcept=default |
| Move constructor. More... | |
| U_FORCE_INLINE UTFIterator & | operator= (UTFIterator &&src) noexcept=default |
| Move assignment operator. More... | |
| U_FORCE_INLINE | UTFIterator (const UTFIterator &other)=default |
| Copy constructor. More... | |
| U_FORCE_INLINE UTFIterator & | operator= (const UTFIterator &other)=default |
| Copy assignment operator. More... | |
| U_FORCE_INLINE bool | operator== (const UTFIterator &other) const |
| U_FORCE_INLINE bool | operator!= (const UTFIterator &other) const |
| U_FORCE_INLINE CodeUnits< CP32, UnitIter > | operator* () const |
| Decodes the code unit sequence at the current position. More... | |
| U_FORCE_INLINE Proxy | operator-> () const |
| Decodes the code unit sequence at the current position. More... | |
| U_FORCE_INLINE UTFIterator & | operator++ () |
| Pre-increment operator. More... | |
| U_FORCE_INLINE UTFIterator | operator++ (int) |
| Post-increment operator. More... | |
| template<typename Iter = UnitIter> | |
| U_FORCE_INLINE std::enable_if_t< prv::bidirectional_iterator< Iter >, UTFIterator & > | operator-- () |
| Pre-decrement operator. More... | |
| template<typename Iter = UnitIter> | |
| U_FORCE_INLINE std::enable_if_t< prv::bidirectional_iterator< Iter >, UTFIterator > | operator-- (int) |
| Post-decrement operator. More... | |
Friends | |
| class | std::reverse_iterator< UTFIterator< CP32, behavior, UnitIter > > |
| template<typename Sentinel > | |
| U_FORCE_INLINE friend std::enable_if_t< !std::is_same_v< Sentinel, UTFIterator > &&!std::is_same_v< Sentinel, UnitIter >, bool > | operator== (const UTFIterator &iter, const Sentinel &s) |
| template<typename Sentinel > | |
| U_FORCE_INLINE friend std::enable_if_t< !std::is_same_v< Sentinel, UTFIterator > &&!std::is_same_v< Sentinel, UnitIter >, bool > | operator== (const Sentinel &s, const UTFIterator &iter) |
| template<typename Sentinel > | |
| U_FORCE_INLINE friend std::enable_if_t< !std::is_same_v< Sentinel, UTFIterator > &&!std::is_same_v< Sentinel, UnitIter >, bool > | operator!= (const UTFIterator &iter, const Sentinel &s) |
| template<typename Sentinel > | |
| U_FORCE_INLINE friend std::enable_if_t< !std::is_same_v< Sentinel, UTFIterator > &&!std::is_same_v< Sentinel, UnitIter >, bool > | operator!= (const Sentinel &s, const UTFIterator &iter) |
Validating iterator over the code points in a Unicode string.
The UnitIter can be an input_iterator, a forward_iterator, or a bidirectional_iterator (including a pointer). The UTFIterator will have the corresponding iterator_category.
Call utfIterator() to have the compiler deduce the UnitIter and LimitIter types.
For reverse iteration, either use this iterator directly as in *–iter or wrap it using std::make_reverse_iterator(iter).
| CP32 | Code point type: UChar32 (=int32_t) or char32_t or uint32_t; should be signed if UTF_BEHAVIOR_NEGATIVE |
| behavior | How to handle ill-formed Unicode strings |
| UnitIter | An iterator (often a pointer) that returns a code unit type: UTF-8: char or char8_t or uint8_t; UTF-16: char16_t or uint16_t or (on Windows) wchar_t; UTF-32: char32_t or UChar32=int32_t or (on Linux) wchar_t |
| LimitIter | Either the same as UnitIter, or an iterator sentinel type. |
Definition at line 1094 of file utfiterator.h.
| using U_HEADER_ONLY_NAMESPACE::UTFIterator< CP32, behavior, UnitIter, LimitIter, typename >::difference_type = prv::iter_difference_t<UnitIter> |
C++ iterator boilerplate.
This API is for internal use only.
Definition at line 1117 of file utfiterator.h.
| using U_HEADER_ONLY_NAMESPACE::UTFIterator< CP32, behavior, UnitIter, LimitIter, typename >::iterator_category = std::conditional_t< prv::bidirectional_iterator<UnitIter>, std::bidirectional_iterator_tag, std::forward_iterator_tag> |
C++ iterator boilerplate.
This API is for internal use only.
Definition at line 1119 of file utfiterator.h.
| using U_HEADER_ONLY_NAMESPACE::UTFIterator< CP32, behavior, UnitIter, LimitIter, typename >::pointer = Proxy |
C++ iterator boilerplate.
This API is for internal use only.
Definition at line 1115 of file utfiterator.h.
| using U_HEADER_ONLY_NAMESPACE::UTFIterator< CP32, behavior, UnitIter, LimitIter, typename >::reference = value_type |
C++ iterator boilerplate.
This API is for internal use only.
Definition at line 1113 of file utfiterator.h.
| using U_HEADER_ONLY_NAMESPACE::UTFIterator< CP32, behavior, UnitIter, LimitIter, typename >::value_type = CodeUnits<CP32, UnitIter> |
C++ iterator boilerplate.
This API is for internal use only.
Definition at line 1111 of file utfiterator.h.
|
inline |
Constructor with start <= p < limit.
All of these iterators/pointers should be at code point boundaries. Only enabled if UnitIter is a (multi-pass) forward_iterator or better.
When using a code unit sentinel (UnitIter≠LimitIter), then that sentinel also works as a sentinel for this code point iterator.
| start | Start of the range |
| p | Initial position inside the range |
| limit | Limit (exclusive end) of the range |
Definition at line 1137 of file utfiterator.h.
|
inline |
Constructor with start == p < limit.
All of these iterators/pointers should be at code point boundaries.
When using a code unit sentinel (UnitIter≠LimitIter), then that sentinel also works as a sentinel for this code point iterator.
| p | Start of the range, and the initial position |
| limit | Limit (exclusive end) of the range |
Definition at line 1150 of file utfiterator.h.
|
inlineexplicit |
Constructs an iterator start or limit sentinel.
The iterator/pointer should be at a code point boundary. Requires UnitIter to be copyable.
When using a code unit sentinel (UnitIter≠LimitIter), then that sentinel also works as a sentinel for this code point iterator.
| p | Range start or limit |
Definition at line 1163 of file utfiterator.h.
|
inline |
Default constructor.
Makes a non-functional iterator.
Definition at line 1169 of file utfiterator.h.
|
defaultnoexcept |
Move constructor.
|
default |
Copy constructor.
|
inline |
| other | Another iterator |
Definition at line 1194 of file utfiterator.h.
References U_HEADER_ONLY_NAMESPACE::UTFIterator< CP32, behavior, UnitIter, LimitIter, typename >::operator==().
|
inline |
Decodes the code unit sequence at the current position.
Definition at line 1260 of file utfiterator.h.
|
inline |
Pre-increment operator.
Definition at line 1292 of file utfiterator.h.
|
inline |
Post-increment operator.
*iter++ still works. Definition at line 1314 of file utfiterator.h.
|
inline |
Pre-decrement operator.
Only enabled if UnitIter is a bidirectional_iterator (including a pointer).
Definition at line 1346 of file utfiterator.h.
Referenced by U_HEADER_ONLY_NAMESPACE::UTFIterator< CP32, behavior, UnitIter, LimitIter, typename >::operator--().
|
inline |
Post-decrement operator.
Only enabled if UnitIter is a bidirectional_iterator (including a pointer).
Definition at line 1366 of file utfiterator.h.
References U_HEADER_ONLY_NAMESPACE::UTFIterator< CP32, behavior, UnitIter, LimitIter, typename >::operator--().
|
inline |
Decodes the code unit sequence at the current position.
Used like iter->codePoint() or iter->stringView() etc.
iter->codePoint() etc. works. Definition at line 1277 of file utfiterator.h.
|
default |
Copy assignment operator.
|
defaultnoexcept |
Move assignment operator.
|
inline |
| other | Another iterator |
Definition at line 1186 of file utfiterator.h.
Referenced by U_HEADER_ONLY_NAMESPACE::UTFIterator< CP32, behavior, UnitIter, LimitIter, typename >::operator!=().
|
friend |
| s | A unit iterator sentinel |
| iter | A UTFIterator |
Definition at line 1251 of file utfiterator.h.
|
friend |
| iter | A UTFIterator |
| s | A unit iterator sentinel |
Definition at line 1240 of file utfiterator.h.
|
friend |
| s | A unit iterator sentinel |
| iter | A UTFIterator |
Definition at line 1227 of file utfiterator.h.
|
friend |
| iter | A UTFIterator |
| s | A unit iterator sentinel |
Definition at line 1208 of file utfiterator.h.