NeoN
WIP Prototype of a modern OpenFOAM core
Loading...
Searching...
No Matches
Public Member Functions | List of all members
NeoN::TokenList Class Reference

A class representing a list of tokens. More...

#include <tokenList.hpp>

Public Member Functions

 TokenList ()
 
 TokenList (const TokenList &)
 
 TokenList (const std::vector< std::any > &data, size_t nextIndex=0)
 Construct a TokenList object from a vector of std::any.
 
 TokenList (const std::initializer_list< std::any > &initList)
 Construct a TokenList object from an initializer list of std::any.
 
void insert (const std::any &value)
 Inserts a value into the token list.
 
void remove (size_t index)
 Removes a value from the token list based on the specified index.
 
bool empty () const
 Checks if the token list is empty.
 
template<typename ReturnType >
ReturnType popFront ()
 Removes first entry of TokenList and returns it.
 
size_t size () const
 Retrieves the size of the token list.
 
template<typename ReturnType >
ReturnType & get (const size_t &idx)
 Retrieves the value associated with the given index, casting it to the specified type.
 
template<typename ReturnType >
ReturnType & next ()
 Retrieves the value associated with the nextIndex, casting it to the specified type.
 
template<typename ReturnType >
const ReturnType & get (const size_t &idx) const
 Retrieves the value associated with the given index, casting it to the specified type.
 
template<typename ReturnType >
const ReturnType & next () const
 Retrieves the value associated with the nextIndex, casting it to the specified type.
 
std::any & operator[] (const size_t &idx)
 Retrieves the value associated with the given index.
 
std::vector< std::any > & tokens ()
 

Detailed Description

A class representing a list of tokens.

The TokenList class provides functionality to store and manipulate a list of tokens. It supports insertion, removal, and retrieval of tokens of any type using std::any.

Definition at line 26 of file tokenList.hpp.

Constructor & Destructor Documentation

◆ TokenList() [1/4]

NeoN::TokenList::TokenList ( )

◆ TokenList() [2/4]

NeoN::TokenList::TokenList ( const TokenList )

◆ TokenList() [3/4]

NeoN::TokenList::TokenList ( const std::vector< std::any > &  data,
size_t  nextIndex = 0 
)

Construct a TokenList object from a vector of std::any.

Parameters
dataA vector of std::any.

◆ TokenList() [4/4]

NeoN::TokenList::TokenList ( const std::initializer_list< std::any > &  initList)

Construct a TokenList object from an initializer list of std::any.

Parameters
initListAn initializer list of std::any.

Member Function Documentation

◆ empty()

bool NeoN::TokenList::empty ( ) const

Checks if the token list is empty.

Returns
True if the token list is empty, false otherwise.

◆ get() [1/2]

template<typename ReturnType >
ReturnType & NeoN::TokenList::get ( const size_t idx)
inline

Retrieves the value associated with the given index, casting it to the specified type.

Template Parameters
TThe type to cast the value to.
Parameters
idxThe index to retrieve the value for.
Returns
A reference to the value associated with the index, casted to type T.

Definition at line 93 of file tokenList.hpp.

◆ get() [2/2]

template<typename ReturnType >
const ReturnType & NeoN::TokenList::get ( const size_t idx) const
inline

Retrieves the value associated with the given index, casting it to the specified type.

Template Parameters
TThe type to cast the value to.
Parameters
idxThe index to retrieve the value for.
Returns
A const reference to the value associated with the index, casted to type T.

Definition at line 135 of file tokenList.hpp.

◆ insert()

void NeoN::TokenList::insert ( const std::any &  value)

Inserts a value into the token list.

Parameters
valueThe value to insert.

◆ next() [1/2]

template<typename ReturnType >
ReturnType & NeoN::TokenList::next ( )
inline

Retrieves the value associated with the nextIndex, casting it to the specified type.

Template Parameters
TThe type to cast the value to.
Returns
A reference to the value associated with the index, casted to type T.

Definition at line 119 of file tokenList.hpp.

◆ next() [2/2]

template<typename ReturnType >
const ReturnType & NeoN::TokenList::next ( ) const
inline

Retrieves the value associated with the nextIndex, casting it to the specified type.

Template Parameters
TThe type to cast the value to.
Returns
A const reference to the value associated with the index, casted to type T.

Definition at line 161 of file tokenList.hpp.

◆ operator[]()

std::any & NeoN::TokenList::operator[] ( const size_t idx)

Retrieves the value associated with the given index.

Parameters
idxThe index to retrieve the value for.
Returns
A reference to the value associated with the index.

◆ popFront()

template<typename ReturnType >
ReturnType NeoN::TokenList::popFront ( )
inline

Removes first entry of TokenList and returns it.

Template Parameters
TThe type to cast the value to.
Returns
The first value.

Definition at line 71 of file tokenList.hpp.

◆ remove()

void NeoN::TokenList::remove ( size_t  index)

Removes a value from the token list based on the specified index.

Parameters
indexThe index of the value to remove.

◆ size()

size_t NeoN::TokenList::size ( ) const

Retrieves the size of the token list.

Returns
The size of the token list.

◆ tokens()

std::vector< std::any > & NeoN::TokenList::tokens ( )

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