Class CToken#
Defined in File lexer_toml_token.h
Class Documentation#
-
class CToken#
Contains lexed information for the parser.
Public Types
Public Functions
-
CToken()#
Default constructor.
-
explicit CToken(const TTokenList &rTokenList, EBoundary eBoundary)#
Constructor to construct a boundary token (beginning or end of the token list).
- Parameters:
rTokenList – [in] Reference to the token list this token resides in.
eBoundary – [in] The boundary type to define.
-
explicit CToken(ETokenCategory eCategory)#
Constructs a new Token object with a given category (can be anything, except key, string, integer, boolean, time and error).
- Parameters:
eCategory – [in] The initial token category value for the token to be constructed.
-
CToken(ETokenCategory eCategory, const std::string &rssContent, ETokenStringType eStringType = ETokenStringType::not_specified)#
Constructs a new Token object with a given category (can only be a key, a string or an error).
- Parameters:
eCategory – [in] The token category value for the token to be constructed.
rssContent – [in] Reference to the string value.
eStringType – [in] The type of string that should be used.
-
explicit CToken(ETokenCategory eCategory, int64_t iContent)#
Constructs a new Token object with a given category (can only be an integer value).
- Parameters:
eCategory – [in] The token category value for the token to be constructed.
iContent – [in] The integer value.
-
explicit CToken(ETokenCategory eCategory, double dContent)#
Constructs a new Token object with a given category (can only be a floating point value).
- Parameters:
eCategory – [in] The token category value for the token to be constructed.
dContent – [in] The double precision floating point value.
-
explicit CToken(ETokenCategory eCategory, bool bContent)#
Constructs a new Token object with a given category (can only be a boolean value).
- Parameters:
eCategory – [in] The token category value for the token to be constructed
bContent – [in] The boolean value.
-
CToken(ETokenCategory eCategory, const sdv::toml::XTOMLParseException &rexcept)#
Error token.
- Parameters:
eCategory – [in] The token category value for the token to be constructed (category error or terminated).
rexcept – [in] Reference to the exception that was triggered.
-
CToken(const CToken &rToken)#
Copy constructor.
- Parameters:
rToken – [in] Reference to the token to copy from.
-
CToken(CToken &&rToken)#
Move constructor.
- Parameters:
rToken – [in] Reference to the token to move from.
-
~CToken()#
Destructor.
-
CToken &operator=(const CToken &rToken)#
Copy assignment operator.
- Parameters:
rToken – [in] Reference to the token to copy from.
- Returns:
Reference to this token.
-
CToken &operator=(CToken &&rToken)#
Move constructor.
- Parameters:
rToken – [in] Reference to the token to move from.
- Returns:
Reference to this token.
-
bool operator==(const CToken &rToken) const#
Check whether the supplied token is identical to this token. The tokens are identical if the token iterators of the token list are identical, or if they don’t have a token iterator, have identical category and value.
- Parameters:
rToken – [in] Reference to the token to use for the comparison.
- Returns:
Returns whether the supplied token is identical.
-
bool operator!=(const CToken &rToken) const#
Check whether the supplied token is not identical to this token. The tokens are identical if the token iterators of the token list are identical, or if they don’t have a token iterator, have identical category and value.
- Parameters:
rToken – [in] Reference to the token to use for the comparison.
- Returns:
Returns whether the supplied token is not identical.
-
operator bool() const#
Checks whether the token is initialized with any token other then ETokenCategory::token_none.
- Returns:
Returns whether the token is initialized.
-
const CToken &Next(size_t nSkip = 0) const#
Quick navigation through the token list. Get the next token in the token list.
- Parameters:
nSkip – [in] The amount of tokens to skip while getting the next token.
- Returns:
Returns the next token or an none-token when the end of the token list has been reached or no tokenlist assignment has been made for this token.
-
const CToken &Prev(size_t nSkip = 0) const#
Quick navigation through the token list. Get the previous token in the token list.
- Parameters:
nSkip – [in] The amount of tokens to skip while getting the previous token.
- Returns:
Returns the previous token or an none-token when the begin of the token list has been reached or no tokenlist assignment has been made for this token.
-
const CToken &JumpToBegin() const#
Quick navigation through the token list to the begin of the token list.
- Returns:
Returns the first token of the token list.
-
const CToken &JumpToEnd() const#
Quick navigation through the token list to the end of the token list.
Remark
The last token of the token list will return “false” when tested. It can be used to iterate backwards through the token list.
- Returns:
Returns the one beyond the last token of the token list.
-
ETokenCategory Category() const#
Return the current category.
- Returns:
The token category.
-
ETokenStringType StringType() const#
Get the token string type.
- Returns:
Returns the string type for the key or string token. Returns ETokenStringType::not_specified when there is no string type defined or the token isn’t string based.
-
std::string StringValue() const#
Get the string value. Will be filled for keys, strings and errors.
- Returns:
The string value or empty string when the category type is invalid.
-
int64_t IntegerValue() const#
Get the integer value. Will be filled for a integer number.
- Returns:
The integer value or zero when the category type is invalid.
-
double FloatValue() const#
Get the floating point number value. Will be filled for a floating point number.
- Returns:
The floating point number value value or 0.0 when the category type is invalid.
-
bool BooleanValue() const#
Get the boolean value. Will be filled for a boolean.
- Returns:
The boolean value or false when the category type is invalid.
-
const std::string &RawString() const#
Get the associated raw string.
- Returns:
Reference to the raw string.
-
uint32_t TokenIndex() const#
The token index identifies the token order.
- Returns:
The unique index of this token.
-
CToken()#