Classes | Public Member Functions | List of all members
IterativeScannedTokens< TokenT > Class Template Reference

A ScannedTokens adaptor that provides an iteration API. More...

#include <ScannedTokens.hpp>

Classes

class  const_iterator
 Scanned tokens const iterator. More...
 
class  ConstElement
 Returned by const iterators when accessing elements. More...
 
class  Element
 Returned by non-const iterators when accessing elements. More...
 
class  iterator
 Scanned tokens non-const iterator. More...
 

Public Member Functions

 IterativeScannedTokens (ScannedTokens< TokenT > &scannedTokens_)
 Create a scanned tokens data structure, specifying the source URI and the source text. More...
 
void addToken (TokenT token, unsigned int startOffset)
 Add a token to the data structure, specifying the token and the start offset into the text. More...
 
const_iterator begin () const
 Get a const iterator positioned at the beginning of the data. More...
 
iterator begin ()
 Get a non-const iterator positioned at the beginning of the data. More...
 
const_iterator end () const
 Get a const iterator positioned at the end of the data. More...
 
iterator end ()
 Get a non-const iterator positioned at the end of the data. More...
 
unsigned int getStartOffset (unsigned int index) const
 Get the start offset of the token with the specified index. More...
 
unsigned int & getStartOffset (unsigned int index)
 Get a reference to the start offset of the token with the specified index. More...
 
const std::vector< unsigned int > & getStartOffsets () const
 Get the start offsets vector. More...
 
TokenT getToken (unsigned int index) const
 Get the token with the specified index. More...
 
TokenT & getToken (unsigned int index)
 Get a reference to the token with the specified index. More...
 
const std::vector< TokenT > & getTokens () const
 Get the token vector. More...
 
std::string && moveTextOut ()
 Move the input text string to its final destination. More...
 
size_t size () const
 Get the number of tokens. More...
 

Detailed Description

template<typename TokenT>
class Balau::Lang::IterativeScannedTokens< TokenT >

A ScannedTokens adaptor that provides an iteration API.

Constructor & Destructor Documentation

◆ IterativeScannedTokens()

IterativeScannedTokens ( ScannedTokens< TokenT > &  scannedTokens_)
inlineexplicit

Create a scanned tokens data structure, specifying the source URI and the source text.

The token data must be supplied via calls to addToken().

Member Function Documentation

◆ addToken()

void addToken ( TokenT  token,
unsigned int  startOffset 
)
inline

Add a token to the data structure, specifying the token and the start offset into the text.

◆ begin() [1/2]

const_iterator begin ( ) const
inline

Get a const iterator positioned at the beginning of the data.

◆ begin() [2/2]

iterator begin ( )
inline

Get a non-const iterator positioned at the beginning of the data.

◆ end() [1/2]

const_iterator end ( ) const
inline

Get a const iterator positioned at the end of the data.

◆ end() [2/2]

iterator end ( )
inline

Get a non-const iterator positioned at the end of the data.

◆ getStartOffset() [1/2]

unsigned int getStartOffset ( unsigned int  index) const
inline

Get the start offset of the token with the specified index.

◆ getStartOffset() [2/2]

unsigned int& getStartOffset ( unsigned int  index)
inline

Get a reference to the start offset of the token with the specified index.

◆ getStartOffsets()

const std::vector<unsigned int>& getStartOffsets ( ) const
inline

Get the start offsets vector.

◆ getToken() [1/2]

TokenT getToken ( unsigned int  index) const
inline

Get the token with the specified index.

◆ getToken() [2/2]

TokenT& getToken ( unsigned int  index)
inline

Get a reference to the token with the specified index.

◆ getTokens()

const std::vector<TokenT>& getTokens ( ) const
inline

Get the token vector.

◆ moveTextOut()

std::string&& moveTextOut ( )
inline

Move the input text string to its final destination.

The scanned tokens instance must not be used after the move is performed.

Returns
the input text string as an rvalue

◆ size()

size_t size ( ) const
inline

Get the number of tokens.


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