A ScannedTokens adaptor that provides an iteration API.
More...
#include <ScannedTokens.hpp>
|
| 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...
|
|
template<typename TokenT>
class Balau::Lang::IterativeScannedTokens< TokenT >
A ScannedTokens adaptor that provides an iteration API.
◆ IterativeScannedTokens()
Create a scanned tokens data structure, specifying the source URI and the source text.
The token data must be supplied via calls to addToken().
◆ 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]
Get a const iterator positioned at the beginning of the data.
◆ begin() [2/2]
Get a non-const iterator positioned at the beginning of the data.
◆ end() [1/2]
Get a const iterator positioned at the end of the data.
◆ end() [2/2]
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 |
◆ 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()
Get the number of tokens.
The documentation for this class was generated from the following file: