MinitScript  0.9.31 PRE-BETA
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
UTF8CharacterIterator Class Reference

UTF8 string character iterator. More...

#include <minitscript/utilities/UTF8CharacterIterator.h>

Collaboration diagram for UTF8CharacterIterator:
Collaboration graph

Classes

class  UTF8PositionCache
 UTF8 cache entry. More...
 

Public Member Functions

 UTF8CharacterIterator (const string_view &stringView, UTF8PositionCache *cache=nullptr)
 Public constructor. More...
 
void reset () const
 Reset. More...
 
int64_t getBinaryPosition () const
 
void seekBinaryPosition (int64_t position) const
 Set underlying binary buffer position. More...
 
int64_t getCharacterPosition () const
 
void seekCharacterPosition (int64_t position) const
 Seek character position. More...
 
bool hasNext () const
 
int next () const
 

Private Member Functions

void addCacheEntry () const
 Add cache entry. More...
 

Private Attributes

const string_view stringView
 
int64_t binaryPosition { 0 }
 
int64_t characterPosition { 0 }
 
UTF8PositionCachecache
 

Detailed Description

UTF8 string character iterator.

Definition at line 18 of file UTF8CharacterIterator.h.

Constructor & Destructor Documentation

◆ UTF8CharacterIterator()

UTF8CharacterIterator ( const string_view &  stringView,
UTF8PositionCache cache = nullptr 
)
inline

Public constructor.

Parameters
stringViewstring view
cacheUTF8 position cache or nullptr if UTF8 positions should not be cached

Definition at line 90 of file UTF8CharacterIterator.h.

Member Function Documentation

◆ reset()

void reset ( ) const
inline

Reset.

Definition at line 96 of file UTF8CharacterIterator.h.

◆ getBinaryPosition()

int64_t getBinaryPosition ( ) const
inline
Returns
underlying binary buffer position

Definition at line 104 of file UTF8CharacterIterator.h.

◆ seekBinaryPosition()

void seekBinaryPosition ( int64_t  position) const
inline

Set underlying binary buffer position.

Parameters
positionunderlying buffer position

Definition at line 112 of file UTF8CharacterIterator.h.

◆ getCharacterPosition()

int64_t getCharacterPosition ( ) const
inline
Returns
character position

Definition at line 131 of file UTF8CharacterIterator.h.

◆ seekCharacterPosition()

void seekCharacterPosition ( int64_t  position) const
inline

Seek character position.

Parameters
positioncharacter position

Definition at line 139 of file UTF8CharacterIterator.h.

◆ hasNext()

bool hasNext ( ) const
inline
Returns
next character available

Definition at line 159 of file UTF8CharacterIterator.h.

◆ next()

int next ( ) const
inline
Returns
next character or -1 if an error occurred or no string left

Definition at line 165 of file UTF8CharacterIterator.h.

◆ addCacheEntry()

void addCacheEntry ( ) const
inlineprivate

Add cache entry.

Definition at line 238 of file UTF8CharacterIterator.h.

Member Data Documentation

◆ stringView

const string_view stringView
private

Definition at line 230 of file UTF8CharacterIterator.h.

◆ binaryPosition

int64_t binaryPosition { 0 }
mutableprivate

Definition at line 231 of file UTF8CharacterIterator.h.

◆ characterPosition

int64_t characterPosition { 0 }
mutableprivate

Definition at line 232 of file UTF8CharacterIterator.h.

◆ cache

UTF8PositionCache* cache
mutableprivate

Definition at line 233 of file UTF8CharacterIterator.h.


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