OpenTTD Source: Utf8View::iterator Class Reference

OpenTTD Source 15.3

Public Types | Public Member Functions | Private Attributes
Utf8View::iterator Class Reference

Bidirectional input iterator over codepoints. More...

`#include <utf8.hpp>`

## Public Types
using | value_type = char32_t
using | difference_type = std::ptrdiff_t
using | iterator_category = std::bidirectional_iterator_tag
using | pointer = void
using | reference = void

## Public Member Functions
| iterator (std::string_view src, size_t position)
size_t | GetByteOffset () const
bool | operator== (const iterator &rhs) const
std::strong_ordering | operator<=> (const iterator &rhs) const
char32_t | operator* () const
iterator & | operator++ ()
iterator | operator++ (int)
iterator & | operator-- ()
iterator | operator-- (int)

## Private Attributes
std::string_view | src
size_t | position = 0

## Detailed Description

Bidirectional input iterator over codepoints.

If invalid encodings are present:

- the iterator will skip overlong encodings, and
- dereferencing returns a placeholder char '?'.

Definition at line 43 of file utf8.hpp.

## Member Typedef Documentation

## ◆ difference_type

using Utf8View::iterator::difference_type = std::ptrdiff_t

Definition at line 48 of file utf8.hpp.

## ◆ iterator_category

using Utf8View::iterator::iterator_category = std::bidirectional_iterator_tag

Definition at line 49 of file utf8.hpp.

## ◆ pointer

using Utf8View::iterator::pointer = void

Definition at line 50 of file utf8.hpp.

## ◆ reference

using Utf8View::iterator::reference = void

Definition at line 51 of file utf8.hpp.

## ◆ value_type

using Utf8View::iterator::value_type = char32_t

Definition at line 47 of file utf8.hpp.

## Constructor & Destructor Documentation

## ◆ iterator()

Utf8View::iterator::iterator | ( | std::string_view | src,
|  | size_t | position
| ) |  |
| inline

Definition at line 54 of file utf8.hpp.

## Member Function Documentation

## ◆ GetByteOffset()

size_t Utf8View::iterator::GetByteOffset | ( |  | ) | const
| inline

Definition at line 56 of file utf8.hpp.

## ◆ operator*()

char32_t Utf8View::iterator::operator* | ( |  | ) | const
| inline

Definition at line 73 of file utf8.hpp.

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

iterator & Utf8View::iterator::operator++ | ( |  | ) |
| inline

Definition at line 80 of file utf8.hpp.

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

iterator Utf8View::iterator::operator++ | ( | int |  | ) |
| inline

Definition at line 90 of file utf8.hpp.

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

iterator & Utf8View::iterator::operator-- | ( |  | ) |
| inline

Definition at line 97 of file utf8.hpp.

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

iterator Utf8View::iterator::operator-- | ( | int |  | ) |
| inline

Definition at line 106 of file utf8.hpp.

## ◆ operator<=>()

std::strong_ordering Utf8View::iterator::operator<=> | ( | const iterator & | rhs | ) | const
| inline

Definition at line 67 of file utf8.hpp.

## ◆ operator==()

bool Utf8View::iterator::operator== | ( | const iterator & | rhs | ) | const
| inline

Definition at line 61 of file utf8.hpp.

## Field Documentation

## ◆ position

size_t Utf8View::iterator::position = 0
| private

Definition at line 45 of file utf8.hpp.

## ◆ src

std::string_view Utf8View::iterator::src
| private

Definition at line 44 of file utf8.hpp.

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

- src/core/utf8.hpp