Loading...
Searching...
No Matches
U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename > Class Template Reference

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.
using | reference = value_type
| C++ iterator boilerplate.
using | pointer = Proxy
| C++ iterator boilerplate.
using | difference_type = prv::iter_difference_t<UnitIter>
| C++ iterator boilerplate.
using | iterator_category
| C++ iterator boilerplate.

## Public Member Functions

U_FORCE_INLINE | UnsafeUTFIterator (UnitIter p)
| Constructor; the iterator/pointer should be at a code point boundary.
U_FORCE_INLINE | UnsafeUTFIterator ()
| Default constructor.
U_FORCE_INLINE | UnsafeUTFIterator (UnsafeUTFIterator &&src) noexcept=default
| Move constructor.
U_FORCE_INLINE UnsafeUTFIterator & | operator= (UnsafeUTFIterator &&src) noexcept=default
| Move assignment operator.
U_FORCE_INLINE | UnsafeUTFIterator (const UnsafeUTFIterator &other)=default
| Copy constructor.
U_FORCE_INLINE UnsafeUTFIterator & | operator= (const UnsafeUTFIterator &other)=default
| Copy assignment operator.
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.
U_FORCE_INLINE Proxy | operator-> () const
| Decodes the code unit sequence at the current position.
U_FORCE_INLINE UnsafeUTFIterator & | operator++ ()
| Pre-increment operator.
U_FORCE_INLINE UnsafeUTFIterator | operator++ (int)
| Post-increment operator.
template<typename Iter = UnitIter>
U_FORCE_INLINE std::enable_if_t< prv::bidirectional_iterator< Iter >, UnsafeUTFIterator & > | operator-- ()
| Pre-decrement operator.
template<typename Iter = UnitIter>
U_FORCE_INLINE std::enable_if_t< prv::bidirectional_iterator< Iter >, UnsafeUTFIterator > | operator-- (int)
| Post-decrement operator.

## 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)

## Detailed Description

template<typename CP32, typename UnitIter, typename = void>
class U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >

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).

Template Parameters

  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

Draft
  This API may be changed in the future versions and was introduced in ICU 78

See also
  unsafeUTFIterator

Definition at line 1952 of file utfiterator.h.

## Member Typedef Documentation

## difference_type

template<typename CP32, typename UnitIter, typename = void>

using U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::difference_type = prv::iter_difference_t<UnitIter>

C++ iterator boilerplate.

Internal
  Do not use. This API is for internal use only.

Definition at line 1975 of file utfiterator.h.

## iterator_category

template<typename CP32, typename UnitIter, typename = void>

using U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::iterator_category

Initial value:
std::conditional_t<
prv::bidirectional_iterator<UnitIter>,
std::bidirectional_iterator_tag,
std::forward_iterator_tag>
U_HEADER_ONLY_NAMESPACE::prv::bidirectional_iterator
constexpr bool bidirectional_iterator
Definition utfiterator.h:214

C++ iterator boilerplate.

Internal
  Do not use. This API is for internal use only.

Definition at line 1977 of file utfiterator.h.

## pointer

template<typename CP32, typename UnitIter, typename = void>

using U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::pointer = Proxy

C++ iterator boilerplate.

Internal
  Do not use. This API is for internal use only.

Definition at line 1973 of file utfiterator.h.

## reference

template<typename CP32, typename UnitIter, typename = void>

using U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::reference = value_type

C++ iterator boilerplate.

Internal
  Do not use. This API is for internal use only.

Definition at line 1971 of file utfiterator.h.

## value_type

template<typename CP32, typename UnitIter, typename = void>

using U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::value_type = UnsafeCodeUnits<CP32, UnitIter>

C++ iterator boilerplate.

Internal
  Do not use. This API is for internal use only.

Definition at line 1969 of file utfiterator.h.

## Constructor & Destructor Documentation

## UnsafeUTFIterator() [1/4]

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::UnsafeUTFIterator | ( | UnitIter | p | ) |

inline explicit

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.

Parameters

  p | Initial position inside the range, or a range sentinel

Draft
  This API may be changed in the future versions and was introduced in ICU 78

Definition at line 1991 of file utfiterator.h.

References U_FORCE_INLINE.

Referenced by operator!=, operator!=, operator!=(), operator++(), operator++(), operator--(), operator=(), operator=(), operator==, operator==, operator==(), UnsafeUTFIterator(), and UnsafeUTFIterator().

## UnsafeUTFIterator() [2/4]

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::UnsafeUTFIterator | ( |  | ) |

inline

Default constructor.

Makes a non-functional iterator.

Draft
  This API may be changed in the future versions and was introduced in ICU 78

Definition at line 1997 of file utfiterator.h.

References U_FORCE_INLINE.

## UnsafeUTFIterator() [3/4]

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::UnsafeUTFIterator | ( | UnsafeUTFIterator< CP32, UnitIter, typename > && | src | ) |

default noexcept

Move constructor.

Draft
  This API may be changed in the future versions and was introduced in ICU 78

References U_FORCE_INLINE, and UnsafeUTFIterator().

## UnsafeUTFIterator() [4/4]

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::UnsafeUTFIterator | ( | const UnsafeUTFIterator< CP32, UnitIter, typename > & | other | ) |

default

Copy constructor.

Draft
  This API may be changed in the future versions and was introduced in ICU 78

References U_FORCE_INLINE, and UnsafeUTFIterator().

## Member Function Documentation

## operator!=()

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE bool U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator!= | ( | const UnsafeUTFIterator< CP32, UnitIter, typename > & | other | ) | const

inline

Parameters

  other | Another iterator

Returns
  true if this iterator is not at the same position as the other one

Draft
  This API may be changed in the future versions and was introduced in ICU 78

Definition at line 2022 of file utfiterator.h.

References operator==(), U_FORCE_INLINE, and UnsafeUTFIterator().

## operator*()

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE UnsafeCodeUnits< CP32, UnitIter > U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator* | ( |  | ) | const

inline

Decodes the code unit sequence at the current position.

Returns
  CodeUnits with the decoded code point etc.

Draft
  This API may be changed in the future versions and was introduced in ICU 78

Definition at line 2082 of file utfiterator.h.

References U_FORCE_INLINE.

## operator++() [1/2]

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE UnsafeUTFIterator & U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator++ | ( |  | ) |

inline

Pre-increment operator.

Returns
  this iterator

Draft
  This API may be changed in the future versions and was introduced in ICU 78

Definition at line 2114 of file utfiterator.h.

References U_FORCE_INLINE, and UnsafeUTFIterator().

## operator++() [2/2]

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE UnsafeUTFIterator U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator++ | ( | int |  | ) |

inline

Post-increment operator.

Returns
  a copy of this iterator from before the increment. If UnitIter is a single-pass input_iterator, then this function returns an opaque proxy object so that `*iter++` still works.

Draft
  This API may be changed in the future versions and was introduced in ICU 78

Definition at line 2136 of file utfiterator.h.

References U_FORCE_INLINE, and UnsafeUTFIterator().

## operator--() [1/2]

template<typename CP32, typename UnitIter, typename = void>
template<typename Iter = UnitIter>

U_FORCE_INLINE std::enable_if_t< prv::bidirectional_iterator< Iter >, UnsafeUTFIterator & > U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator-- | ( |  | ) |

inline

Pre-decrement operator.

Only enabled if UnitIter is a bidirectional_iterator (including a pointer).

Returns
  this iterator

Draft
  This API may be changed in the future versions and was introduced in ICU 78

Definition at line 2168 of file utfiterator.h.

Referenced by operator--().

## operator--() [2/2]

template<typename CP32, typename UnitIter, typename = void>
template<typename Iter = UnitIter>

U_FORCE_INLINE std::enable_if_t< prv::bidirectional_iterator< Iter >, UnsafeUTFIterator > U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator-- | ( | int |  | ) |

inline

Post-decrement operator.

Only enabled if UnitIter is a bidirectional_iterator (including a pointer).

Returns
  a copy of this iterator from before the decrement.

Draft
  This API may be changed in the future versions and was introduced in ICU 78

Definition at line 2188 of file utfiterator.h.

References operator--(), and UnsafeUTFIterator().

## operator->()

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE Proxy U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator-> | ( |  | ) | const

inline

Decodes the code unit sequence at the current position.

Used like `iter->codePoint()` or `iter->stringView()` etc.

Returns
  CodeUnits with the decoded code point etc., wrapped into an opaque proxy object so that `iter->codePoint()` etc. works.

Draft
  This API may be changed in the future versions and was introduced in ICU 78

Definition at line 2099 of file utfiterator.h.

References U_FORCE_INLINE.

## operator=() [1/2]

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE UnsafeUTFIterator & U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator= | ( | const UnsafeUTFIterator< CP32, UnitIter, typename > & | other | ) |

default

Copy assignment operator.

Draft
  This API may be changed in the future versions and was introduced in ICU 78

References U_FORCE_INLINE, and UnsafeUTFIterator().

## operator=() [2/2]

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE UnsafeUTFIterator & U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator= | ( | UnsafeUTFIterator< CP32, UnitIter, typename > && | src | ) |

default noexcept

Move assignment operator.

Draft
  This API may be changed in the future versions and was introduced in ICU 78

References U_FORCE_INLINE, and UnsafeUTFIterator().

## operator==()

template<typename CP32, typename UnitIter, typename = void>

U_FORCE_INLINE bool U_HEADER_ONLY_NAMESPACE::UnsafeUTFIterator< CP32, UnitIter, typename >::operator== | ( | const UnsafeUTFIterator< CP32, UnitIter, typename > & | other | ) | const

inline

Parameters

  other | Another iterator

Returns
  true if this iterator is at the same position as the other one

Draft
  This API may be changed in the future versions and was introduced in ICU 78

Definition at line 2014 of file utfiterator.h.

References U_FORCE_INLINE, and UnsafeUTFIterator().

Referenced by operator!=().

## Friends And Related Symbol Documentation

## operator!= [1/2]

template<typename CP32, typename UnitIter, typename = void>
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< CP32, UnitIter, typename > & | iter )

friend

Parameters

  s | A unit iterator sentinel
  iter | An UnsafeUTFIterator

Returns
  true if the iterator’s position is not equal to the sentinel

Internal
  Do not use. This API is for internal use only.

Definition at line 2073 of file utfiterator.h.

References UnsafeUTFIterator().

## operator!= [2/2]

template<typename CP32, typename UnitIter, typename = void>
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< CP32, UnitIter, typename > & | iter,
|  | const Sentinel & | s )

friend

Parameters

  iter | An UnsafeUTFIterator
  s | A unit iterator sentinel

Returns
  true if the iterator’s position is not equal to the sentinel

Internal
  Do not use. This API is for internal use only.

Definition at line 2062 of file utfiterator.h.

References UnsafeUTFIterator().

## operator== [1/2]

template<typename CP32, typename UnitIter, typename = void>
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< CP32, UnitIter, typename > & | iter )

friend

Parameters

  s | A unit iterator sentinel
  iter | An UnsafeUTFIterator

Returns
  true if the iterator’s position is equal to the sentinel

Internal
  Do not use. This API is for internal use only.

Definition at line 2049 of file utfiterator.h.

References UnsafeUTFIterator().

## operator== [2/2]

template<typename CP32, typename UnitIter, typename = void>
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< CP32, UnitIter, typename > & | iter,
|  | const Sentinel & | s )

friend

Parameters

  iter | An UnsafeUTFIterator
  s | A unit iterator sentinel

Returns
  true if the iterator’s position is equal to the sentinel

Draft
  This API may be changed in the future versions and was introduced in ICU 78

Definition at line 2034 of file utfiterator.h.

References UnsafeUTFIterator().

## std::reverse_iterator< UnsafeUTFIterator< CP32, UnitIter > >

template<typename CP32, typename UnitIter, typename = void>

friend class std::reverse_iterator< UnsafeUTFIterator< CP32, UnitIter > >

friend

Definition at line 2188 of file utfiterator.h.

The documentation for this class was generated from the following file:

- common/unicode/utfiterator.h