Base Framework
Public Member Functions | Protected Types | Static Protected Member Functions | Protected Attributes | List of all members
UTF8Iterator Class Reference

#include <base/iterator/UTF8Iterator.h>

Public Member Functions

 UTF8Iterator (Pointer value) noexcept
 
 UTF8Iterator (const UTF8Iterator &copy) noexcept
 
UTF8Iteratoroperator= (const UTF8Iterator &assign) noexcept
 
UTF8Iteratoroperator++ ()
 
UTF8Iterator operator++ (int) noexcept
 
UTF8Iteratoroperator+= (Distance distance) noexcept
 
bool operator== (const UTF8Iterator &compare) const noexcept
 
bool operator!= (const UTF8Iterator &compare) const noexcept
 
bool operator< (const UTF8Iterator &compare) const noexcept
 
bool operator<= (const UTF8Iterator &compare) const noexcept
 
bool operator>= (const UTF8Iterator &compare) const noexcept
 
bool operator> (const UTF8Iterator &compare) const noexcept
 
bool hasValidCode () const
 
void skip () noexcept
 
ucs4 operator* () const
 
ucs4 operator[] (Distance index) const
 

Protected Types

typedef MemoryDiff Distance
 
typedef ForwardIterator Category
 

Static Protected Member Functions

static Pointer next (Pointer src, ucs4 &ch)
 

Protected Attributes

const typedef uint8 * Pointer
 
Pointer element = nullptr
 

Detailed Description

Iterator used to traverse UTF-8.

Constructor & Destructor Documentation

◆ UTF8Iterator() [1/2]

UTF8Iterator::UTF8Iterator ( Pointer  value)
inlinenoexcept

Initializes iterator.

Parameters
valueThe initial value of the iterator.

◆ UTF8Iterator() [2/2]

UTF8Iterator::UTF8Iterator ( const UTF8Iterator copy)
inlinenoexcept

Initializes iterator from other iterator.

Member Function Documentation

◆ hasValidCode()

bool UTF8Iterator::hasValidCode ( ) const
inline

Returns true if the UTF-8 encoding is valid at the current position. Does NOT check if code is an allowed UCS4 code as such should be skipped fully.

◆ next()

static Pointer UTF8Iterator::next ( Pointer  src,
ucs4 &  ch 
)
inlinestaticprotected

Reads UCS4 (doesnt check if UCS4 code is disallowed).

◆ operator!=()

bool UTF8Iterator::operator!= ( const UTF8Iterator compare) const
inlinenoexcept

Returns true if the iterators aren't equal.

◆ operator*()

ucs4 UTF8Iterator::operator* ( ) const
inline

Access the element.

◆ operator++() [1/2]

UTF8Iterator& UTF8Iterator::operator++ ( )
inline

Prefix increment.

◆ operator++() [2/2]

UTF8Iterator UTF8Iterator::operator++ ( int  )
inlinenoexcept

Postfix increment.

◆ operator+=()

UTF8Iterator& UTF8Iterator::operator+= ( Distance  distance)
inlinenoexcept

Moves the specified distance forward.

◆ operator<()

bool UTF8Iterator::operator< ( const UTF8Iterator compare) const
inlinenoexcept

Returns true if this iterator is less than the specified iterator.

◆ operator<=()

bool UTF8Iterator::operator<= ( const UTF8Iterator compare) const
inlinenoexcept

Returns true if this iterator is less than or equal to the specified iterator.

◆ operator=()

UTF8Iterator& UTF8Iterator::operator= ( const UTF8Iterator assign)
inlinenoexcept

Initializes iterator from other iterator.

◆ operator==()

bool UTF8Iterator::operator== ( const UTF8Iterator compare) const
inlinenoexcept

Returns true if the iterators are equal.

◆ operator>()

bool UTF8Iterator::operator> ( const UTF8Iterator compare) const
inlinenoexcept

Returns true if this iterator is greater than the specified iterator.

◆ operator>=()

bool UTF8Iterator::operator>= ( const UTF8Iterator compare) const
inlinenoexcept

Returns true if this iterator is greater than or equal to the specified iterator.

◆ operator[]()

ucs4 UTF8Iterator::operator[] ( Distance  index) const
inline

Returns the element at the specified index from this element.

◆ skip()

void UTF8Iterator::skip ( )
inlinenoexcept

Skip a single byte - not encoded character. Used to skip bad codes only.

Member Data Documentation

◆ element

Pointer UTF8Iterator::element = nullptr
protected

The position of the iterator.