A class representing a list of tokens.
More...
#include <tokenList.hpp>
|
| TokenList ()=default |
|
| TokenList (const std::vector< std::any > &data) |
| 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 > |
const ReturnType & | get (const size_t &idx) const |
| Retrieves the value associated with the given index, 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 () |
|
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 21 of file tokenList.hpp.
◆ TokenList() [1/3]
NeoFOAM::TokenList::TokenList |
( |
| ) |
|
|
default |
◆ TokenList() [2/3]
NeoFOAM::TokenList::TokenList |
( |
const std::vector< std::any > & |
data | ) |
|
Construct a TokenList object from a vector of std::any.
- Parameters
-
data | A vector of std::any. |
◆ TokenList() [3/3]
NeoFOAM::TokenList::TokenList |
( |
const std::initializer_list< std::any > & |
initList | ) |
|
Construct a TokenList object from an initializer list of std::any.
- Parameters
-
initList | An initializer list of std::any. |
◆ empty()
bool NeoFOAM::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 & NeoFOAM::TokenList::get |
( |
const size_t & |
idx | ) |
|
|
inline |
Retrieves the value associated with the given index, casting it to the specified type.
- Template Parameters
-
T | The type to cast the value to. |
- Parameters
-
idx | The index to retrieve the value for. |
- Returns
- A reference to the value associated with the index, casted to type T.
Definition at line 86 of file tokenList.hpp.
◆ get() [2/2]
template<typename ReturnType >
const ReturnType & NeoFOAM::TokenList::get |
( |
const size_t & |
idx | ) |
const |
|
inline |
Retrieves the value associated with the given index, casting it to the specified type.
- Template Parameters
-
T | The type to cast the value to. |
- Parameters
-
idx | The index to retrieve the value for. |
- Returns
- A const reference to the value associated with the index, casted to type T.
Definition at line 109 of file tokenList.hpp.
◆ insert()
void NeoFOAM::TokenList::insert |
( |
const std::any & |
value | ) |
|
Inserts a value into the token list.
- Parameters
-
value | The value to insert. |
◆ operator[]()
std::any & NeoFOAM::TokenList::operator[] |
( |
const size_t & |
idx | ) |
|
Retrieves the value associated with the given index.
- Parameters
-
idx | The index to retrieve the value for. |
- Returns
- A reference to the value associated with the index.
◆ popFront()
template<typename ReturnType >
ReturnType NeoFOAM::TokenList::popFront |
( |
| ) |
|
|
inline |
Removes first entry of TokenList and returns it.
- Template Parameters
-
T | The type to cast the value to. |
- Returns
- The first value.
Definition at line 64 of file tokenList.hpp.
◆ remove()
void NeoFOAM::TokenList::remove |
( |
size_t |
index | ) |
|
Removes a value from the token list based on the specified index.
- Parameters
-
index | The index of the value to remove. |
◆ size()
size_t NeoFOAM::TokenList::size |
( |
| ) |
const |
Retrieves the size of the token list.
- Returns
- The size of the token list.
◆ tokens()
std::vector< std::any > & NeoFOAM::TokenList::tokens |
( |
| ) |
|
The documentation for this class was generated from the following file:
- /home/runner/work/NeoFOAM/NeoFOAM/include/NeoFOAM/core/tokenList.hpp