ICU 78.1
78.1
|
Non-validating iterator over the code points in a Unicode string. More...
#include <utfiterator.h>
Public Types | |
using | value_type = UnsafeCodeUnits< 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 | UnsafeUTFIterator (UnitIter p) |
Constructor; the iterator/pointer should be at a code point boundary. More... | |
U_FORCE_INLINE | UnsafeUTFIterator () |
Default constructor. More... | |
U_FORCE_INLINE | UnsafeUTFIterator (UnsafeUTFIterator &&src) noexcept=default |
Move constructor. More... | |
U_FORCE_INLINE UnsafeUTFIterator & | operator= (UnsafeUTFIterator &&src) noexcept=default |
Move assignment operator. More... | |
U_FORCE_INLINE | UnsafeUTFIterator (const UnsafeUTFIterator &other)=default |
Copy constructor. More... | |
U_FORCE_INLINE UnsafeUTFIterator & | operator= (const UnsafeUTFIterator &other)=default |
Copy assignment operator. More... | |
U_FORCE_INLINE bool | operator== (const UnsafeUTFIterator &other) const |
U_FORCE_INLINE bool | operator!= (const UnsafeUTFIterator &other) const |
U_FORCE_INLINE UnsafeCodeUnits< 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 UnsafeUTFIterator & | operator++ () |
Pre-increment operator. More... | |
U_FORCE_INLINE UnsafeUTFIterator | operator++ (int) |
Post-increment operator. More... | |
template<typename Iter = UnitIter> | |
U_FORCE_INLINE std::enable_if_t< prv::bidirectional_iterator< Iter >, UnsafeUTFIterator & > | operator-- () |
Pre-decrement operator. More... | |
template<typename Iter = UnitIter> | |
U_FORCE_INLINE std::enable_if_t< prv::bidirectional_iterator< Iter >, UnsafeUTFIterator > | operator-- (int) |
Post-decrement operator. More... | |
Friends | |
class | std::reverse_iterator< UnsafeUTFIterator< CP32, UnitIter > > |
template<typename Sentinel > | |
U_FORCE_INLINE friend std::enable_if_t< !std::is_same_v< Sentinel, UnsafeUTFIterator > &&!std::is_same_v< Sentinel, UnitIter >, bool > | operator== (const UnsafeUTFIterator &iter, const Sentinel &s) |
template<typename Sentinel > | |
U_FORCE_INLINE friend std::enable_if_t< !std::is_same_v< Sentinel, UnsafeUTFIterator > &&!std::is_same_v< Sentinel, UnitIter >, bool > | operator== (const Sentinel &s, const UnsafeUTFIterator &iter) |
template<typename Sentinel > | |
U_FORCE_INLINE friend std::enable_if_t< !std::is_same_v< Sentinel, UnsafeUTFIterator > &&!std::is_same_v< Sentinel, UnitIter >, bool > | operator!= (const UnsafeUTFIterator &iter, const Sentinel &s) |
template<typename Sentinel > | |
U_FORCE_INLINE friend std::enable_if_t< !std::is_same_v< Sentinel, UnsafeUTFIterator > &&!std::is_same_v< Sentinel, UnitIter >, bool > | operator!= (const Sentinel &s, const UnsafeUTFIterator &iter) |
Non-validating iterator over the code points in a Unicode string.
The string must be well-formed.
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 unsafeUTFIterator() to have the compiler deduce the UnitIter type.
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 |
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 |
Definition at line 1920 of file utfiterator.h.
using U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::difference_type = prv::iter_difference_t<UnitIter> |
C++ iterator boilerplate.
This API is for internal use only.
Definition at line 1943 of file utfiterator.h.
using U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, 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 1945 of file utfiterator.h.
using U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::pointer = Proxy |
C++ iterator boilerplate.
This API is for internal use only.
Definition at line 1941 of file utfiterator.h.
using U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::reference = value_type |
C++ iterator boilerplate.
This API is for internal use only.
Definition at line 1939 of file utfiterator.h.
using U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::value_type = UnsafeCodeUnits<CP32, UnitIter> |
C++ iterator boilerplate.
This API is for internal use only.
Definition at line 1937 of file utfiterator.h.
|
inlineexplicit |
Constructor; the iterator/pointer should be at a code point boundary.
When using a code unit sentinel, then that sentinel also works as a sentinel for this code point iterator.
p | Initial position inside the range, or a range sentinel |
Definition at line 1959 of file utfiterator.h.
|
inline |
Default constructor.
Makes a non-functional iterator.
Definition at line 1965 of file utfiterator.h.
|
defaultnoexcept |
Move constructor.
|
default |
Copy constructor.
|
inline |
other | Another iterator |
Definition at line 1990 of file utfiterator.h.
References U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator==().
|
inline |
Decodes the code unit sequence at the current position.
Definition at line 2050 of file utfiterator.h.
|
inline |
Pre-increment operator.
Definition at line 2082 of file utfiterator.h.
|
inline |
Post-increment operator.
*iter++
still works. Definition at line 2104 of file utfiterator.h.
|
inline |
Pre-decrement operator.
Only enabled if UnitIter is a bidirectional_iterator (including a pointer).
Definition at line 2136 of file utfiterator.h.
Referenced by U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator--().
|
inline |
Post-decrement operator.
Only enabled if UnitIter is a bidirectional_iterator (including a pointer).
Definition at line 2156 of file utfiterator.h.
References U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, 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 2067 of file utfiterator.h.
|
default |
Copy assignment operator.
|
defaultnoexcept |
Move assignment operator.
|
inline |
other | Another iterator |
Definition at line 1982 of file utfiterator.h.
Referenced by U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator!=().
|
friend |
s | A unit iterator sentinel |
iter | An UnsafeUTFIterator |
Definition at line 2041 of file utfiterator.h.
|
friend |
iter | An UnsafeUTFIterator |
s | A unit iterator sentinel |
Definition at line 2030 of file utfiterator.h.
|
friend |
s | A unit iterator sentinel |
iter | An UnsafeUTFIterator |
Definition at line 2017 of file utfiterator.h.
|
friend |
iter | An UnsafeUTFIterator |
s | A unit iterator sentinel |
Definition at line 2002 of file utfiterator.h.