Encapsulation of the data for a single formula token. More...
#include <qmuparsertoken.h>
Public Member Functions | |
QmuParserToken () | |
Constructor (default). More... | |
QmuParserToken (const QmuParserToken &a_Tok) | |
Create token from another one. More... | |
QmuParserToken & | operator= (const QmuParserToken &a_Tok) |
Assignement operator. More... | |
void | Assign (const QmuParserToken &a_Tok) |
Copy token information from argument. More... | |
QmuParserToken & | Set (ECmdCode a_iType, const TString &a_strTok=TString()) |
Assign a token type. More... | |
QmuParserToken & | Set (const QmuParserCallback &a_pCallback, const TString &a_sTok) |
Set Callback type. More... | |
QmuParserToken & | SetVal (TBase a_fVal, const TString &a_strTok=TString()) |
Make this token a value token. More... | |
QmuParserToken & | SetVar (TBase *a_pVar, const TString &a_strTok) |
make this token a variable token. More... | |
QmuParserToken & | SetString (const TString &a_strTok, int a_iSize) |
Make this token a variable token. More... | |
void | SetIdx (int a_iIdx) |
Set an index associated with the token related data. More... | |
int | GetIdx () const |
Return Index associated with the token related data. More... | |
ECmdCode | GetCode () const |
Return the token type. More... | |
ETypeCode | GetType () const |
int | GetPri () const |
EOprtAssociativity | GetAssociativity () const |
generic_fun_type | GetFuncAddr () const |
Return the address of the callback function assoziated with function and operator tokens. More... | |
TBase | GetVal () const |
Get value of the token. More... | |
TBase * | GetVar () const |
Get address of a variable token. More... | |
int | GetArgCount () const |
Return the number of function arguments. More... | |
const TString & | GetAsString () const |
Return the token identifier. More... | |
Static Public Member Functions | |
template<class FunctionPtr > | |
static FunctionPtr | union_cast (void *objectPtr) |
Private Attributes | |
ECmdCode | m_iCode |
Type of the token; The token type is a constant of type ECmdCode. More... | |
ETypeCode | m_iType |
void * | m_pTok |
Stores Token pointer; not applicable for all tokens. More... | |
int | m_iIdx |
An otional index to an external buffer storing the token data. More... | |
TString | m_strTok |
Token string. More... | |
TString | m_strVal |
Value for string variables. More... | |
qreal | m_fVal |
the value More... | |
std::unique_ptr< QmuParserCallback > | m_pCallback |
Encapsulation of the data for a single formula token.
Formula token implementation. Part of the Math Parser Package. Formula tokens can be either one of the following:
Definition at line 58 of file qmuparsertoken.h.
|
inline |
Constructor (default).
Sets token to an neutral state of type cmUNKNOWN.
nothrow |
Definition at line 69 of file qmuparsertoken.h.
|
inline |
Create token from another one.
Implemented by calling Assign(...)
nothrow |
Definition at line 83 of file qmuparsertoken.h.
References qmu::QmuParserToken< TBase, TString >::Assign().
|
inline |
Copy token information from argument.
nothrow |
Definition at line 114 of file qmuparsertoken.h.
References qmu::QmuParserToken< TBase, TString >::m_fVal, qmu::QmuParserToken< TBase, TString >::m_iCode, qmu::QmuParserToken< TBase, TString >::m_iIdx, qmu::QmuParserToken< TBase, TString >::m_iType, qmu::QmuParserToken< TBase, TString >::m_pCallback, qmu::QmuParserToken< TBase, TString >::m_pTok, qmu::QmuParserToken< TBase, TString >::m_strTok, and qmu::QmuParserToken< TBase, TString >::m_strVal.
Referenced by qmu::QmuParserToken< TBase, TString >::operator=(), and qmu::QmuParserToken< TBase, TString >::QmuParserToken().
|
inline |
Return the number of function arguments.
Valid only if m_iType==CmdFUNC.
Definition at line 444 of file qmuparsertoken.h.
References qmu::ecINTERNAL_ERROR, and qmu::QmuParserToken< TBase, TString >::m_pCallback.
Referenced by qmu::QmuParserBase::ApplyFunc(), and qmu::QmuParserBase::ApplyStrFunc().
|
inline |
Definition at line 318 of file qmuparsertoken.h.
References qmu::cmOPRT_BIN, qmu::ecINTERNAL_ERROR, and qmu::QmuParserToken< TBase, TString >::m_pCallback.
Referenced by qmu::QmuParserBase::GetOprtAssociativity().
|
inline |
Return the token identifier.
If m_iType is cmSTRING the token identifier is the value of the string argument for a string function.
nothrow |
Definition at line 466 of file qmuparsertoken.h.
References qmu::QmuParserToken< TBase, TString >::m_strTok.
Referenced by qmu::QmuParserBase::ApplyFunc(), qmu::QmuParserBase::ApplyStrFunc(), qmu::QmuParserBase::CreateRPN(), qmu::QmuParserTokenReader::IsFunTok(), qmu::QmuParserTokenReader::IsInfixOpTok(), qmu::QmuParserTokenReader::IsUndefVarTok(), and qmu::QmuParserBase::StackDump().
|
inline |
Return the token type.
nothrow |
Definition at line 276 of file qmuparsertoken.h.
References qmu::QmuParserToken< TBase, TString >::m_iCode, and qmu::QmuParserToken< TBase, TString >::m_pCallback.
Referenced by qmu::QmuParserBase::ApplyFunc(), qmu::QmuParserBase::ApplyIfElse(), qmu::QmuParserBase::CreateRPN(), qmu::QmuParserBase::GetOprtAssociativity(), qmu::QmuParserBase::GetOprtPrecedence(), qmu::QmuParserTokenReader::IsBuiltIn(), and qmu::QmuParserBase::StackDump().
|
inline |
Return the address of the callback function assoziated with function and operator tokens.
QmuParserError | if token type is non of:
|
Definition at line 361 of file qmuparsertoken.h.
References qmu::QmuParserToken< TBase, TString >::m_pCallback.
Referenced by qmu::QmuParserBase::ApplyFunc(), and qmu::QmuParserBase::ApplyStrFunc().
|
inline |
Return Index associated with the token related data.
In cmSTRFUNC - This is the index to a string table in the main parser.
QmuParserError | if m_iIdx<0 or m_iType!=cmSTRING |
Definition at line 259 of file qmuparsertoken.h.
References qmu::cmSTRING, qmu::ecINTERNAL_ERROR, qmu::QmuParserToken< TBase, TString >::m_iCode, and qmu::QmuParserToken< TBase, TString >::m_iIdx.
|
inline |
Definition at line 302 of file qmuparsertoken.h.
References qmu::cmOPRT_BIN, qmu::cmOPRT_INFIX, qmu::ecINTERNAL_ERROR, and qmu::QmuParserToken< TBase, TString >::m_pCallback.
Referenced by qmu::QmuParserBase::GetOprtPrecedence().
|
inline |
Definition at line 289 of file qmuparsertoken.h.
References qmu::QmuParserToken< TBase, TString >::m_iType, and qmu::QmuParserToken< TBase, TString >::m_pCallback.
Referenced by qmu::QmuParserBase::ApplyBinOprt(), qmu::QmuParserBase::ApplyFunc(), and qmu::QmuParserBase::StackDump().
|
inline |
Get value of the token.
Only applicable to variable and value tokens.
QmuParserError | if token is no value/variable token. |
Definition at line 374 of file qmuparsertoken.h.
References qmu::cmADD, qmu::cmARG_SEP, qmu::cmASSIGN, qmu::cmBC, qmu::cmBO, qmu::cmDIV, qmu::cmELSE, qmu::cmEND, qmu::cmENDIF, qmu::cmEQ, qmu::cmFUNC, qmu::cmFUNC_BULK, qmu::cmFUNC_STR, qmu::cmGE, qmu::cmGT, qmu::cmIF, qmu::cmLAND, qmu::cmLE, qmu::cmLOR, qmu::cmLT, qmu::cmMUL, qmu::cmNEQ, qmu::cmOPRT_BIN, qmu::cmOPRT_INFIX, qmu::cmOPRT_POSTFIX, qmu::cmPOW, qmu::cmPOW2, qmu::cmSTRING, qmu::cmSUB, qmu::cmUNKNOWN, qmu::cmVAL, qmu::cmVAR, qmu::cmVARMUL, qmu::cmVARPOW2, qmu::cmVARPOW3, qmu::cmVARPOW4, qmu::ecVAL_EXPECTED, qmu::QmuParserToken< TBase, TString >::m_fVal, qmu::QmuParserToken< TBase, TString >::m_iCode, and qmu::QmuParserToken< TBase, TString >::m_pTok.
Referenced by qmu::QmuParserBase::ApplyIfElse(), qmu::QmuParserBase::CreateRPN(), and qmu::QmuParserBase::StackDump().
|
inline |
Get address of a variable token.
Valid only if m_iType==CmdVar.
QmuParserError | if token is no variable token. |
Definition at line 428 of file qmuparsertoken.h.
References qmu::cmVAR, qmu::ecINTERNAL_ERROR, qmu::QmuParserToken< TBase, TString >::m_iCode, and qmu::QmuParserToken< TBase, TString >::m_pTok.
Referenced by qmu::QmuParserBase::CreateRPN().
|
inline |
Assignement operator.
Copy token state from another token and return this. Implemented by calling Assign(...).
nothrow |
Definition at line 98 of file qmuparsertoken.h.
References qmu::QmuParserToken< TBase, TString >::Assign().
|
inline |
Set Callback type.
Definition at line 159 of file qmuparsertoken.h.
References qmu::QmuParserCallback::GetAddr(), qmu::QmuParserCallback::GetCode(), qmu::QmuParserToken< TBase, TString >::m_iCode, qmu::QmuParserToken< TBase, TString >::m_iIdx, qmu::QmuParserToken< TBase, TString >::m_iType, qmu::QmuParserToken< TBase, TString >::m_pCallback, qmu::QmuParserToken< TBase, TString >::m_pTok, qmu::QmuParserToken< TBase, TString >::m_strTok, and qmu::tpVOID.
|
inline |
Assign a token type.
Token may not be of type value, variable or function. Those have seperate set functions.
Definition at line 139 of file qmuparsertoken.h.
References qmu::cmFUNC, qmu::cmVAL, qmu::cmVAR, qmu::QmuParserToken< TBase, TString >::m_iCode, qmu::QmuParserToken< TBase, TString >::m_iIdx, qmu::QmuParserToken< TBase, TString >::m_iType, qmu::QmuParserToken< TBase, TString >::m_pTok, qmu::QmuParserToken< TBase, TString >::m_strTok, and qmu::tpVOID.
Referenced by qmu::QmuParserTokenReader::IsArgSep(), qmu::QmuParserTokenReader::IsBuiltIn(), qmu::QmuParserTokenReader::IsEOF(), qmu::QmuParserTokenReader::IsFunTok(), qmu::QmuParserTokenReader::IsInfixOpTok(), qmu::QmuParserTokenReader::IsOprt(), and qmu::QmuParserTokenReader::IsPostOpTok().
|
inline |
Set an index associated with the token related data.
In cmSTRFUNC - This is the index to a string table in the main parser.
a_iIdx | The index the string function result will take in the bytecode parser. |
QmuParserError | if #a_iIdx<0 or m_iType!=cmSTRING |
Definition at line 240 of file qmuparsertoken.h.
References qmu::cmSTRING, qmu::ecINTERNAL_ERROR, qmu::QmuParserToken< TBase, TString >::m_iCode, and qmu::QmuParserToken< TBase, TString >::m_iIdx.
Referenced by qmu::QmuParserBase::CreateRPN().
|
inline |
Make this token a variable token.
Member variables not necessary for variable tokens will be invalidated.
nothrow |
Definition at line 220 of file qmuparsertoken.h.
References qmu::cmSTRING, qmu::QmuParserToken< TBase, TString >::m_iCode, qmu::QmuParserToken< TBase, TString >::m_iIdx, qmu::QmuParserToken< TBase, TString >::m_iType, qmu::QmuParserToken< TBase, TString >::m_pCallback, qmu::QmuParserToken< TBase, TString >::m_pTok, qmu::QmuParserToken< TBase, TString >::m_strTok, and qmu::tpSTR.
Referenced by qmu::QmuParserTokenReader::IsString(), and qmu::QmuParserTokenReader::IsStrVarTok().
|
inline |
Make this token a value token.
Member variables not necessary for value tokens will be invalidated.
nothrow |
Definition at line 181 of file qmuparsertoken.h.
References qmu::cmVAL, qmu::QmuParserToken< TBase, TString >::m_fVal, qmu::QmuParserToken< TBase, TString >::m_iCode, qmu::QmuParserToken< TBase, TString >::m_iIdx, qmu::QmuParserToken< TBase, TString >::m_iType, qmu::QmuParserToken< TBase, TString >::m_pCallback, qmu::QmuParserToken< TBase, TString >::m_pTok, qmu::QmuParserToken< TBase, TString >::m_strTok, and qmu::tpDBL.
Referenced by qmu::QmuParserBase::ApplyFunc(), qmu::QmuParserBase::ApplyStrFunc(), and qmu::QmuParserTokenReader::IsValTok().
|
inline |
make this token a variable token.
Member variables not necessary for variable tokens will be invalidated.
nothrow |
Definition at line 202 of file qmuparsertoken.h.
References qmu::cmVAR, qmu::QmuParserToken< TBase, TString >::m_iCode, qmu::QmuParserToken< TBase, TString >::m_iIdx, qmu::QmuParserToken< TBase, TString >::m_iType, qmu::QmuParserToken< TBase, TString >::m_pCallback, qmu::QmuParserToken< TBase, TString >::m_pTok, qmu::QmuParserToken< TBase, TString >::m_strTok, and qmu::tpDBL.
Referenced by qmu::QmuParserTokenReader::IsUndefVarTok(), and qmu::QmuParserTokenReader::IsVarTok().
|
inlinestatic |
Definition at line 330 of file qmuparsertoken.h.
|
private |
the value
Definition at line 477 of file qmuparsertoken.h.
Referenced by qmu::QmuParserToken< TBase, TString >::Assign(), qmu::QmuParserToken< TBase, TString >::GetVal(), and qmu::QmuParserToken< TBase, TString >::SetVal().
|
private |
Type of the token; The token type is a constant of type ECmdCode.
Definition at line 471 of file qmuparsertoken.h.
Referenced by qmu::QmuParserToken< TBase, TString >::Assign(), qmu::QmuParserToken< TBase, TString >::GetCode(), qmu::QmuParserToken< TBase, TString >::GetIdx(), qmu::QmuParserToken< TBase, TString >::GetVal(), qmu::QmuParserToken< TBase, TString >::GetVar(), qmu::QmuParserToken< TBase, TString >::Set(), qmu::QmuParserToken< TBase, TString >::SetIdx(), qmu::QmuParserToken< TBase, TString >::SetString(), qmu::QmuParserToken< TBase, TString >::SetVal(), and qmu::QmuParserToken< TBase, TString >::SetVar().
|
private |
An otional index to an external buffer storing the token data.
Definition at line 474 of file qmuparsertoken.h.
Referenced by qmu::QmuParserToken< TBase, TString >::Assign(), qmu::QmuParserToken< TBase, TString >::GetIdx(), qmu::QmuParserToken< TBase, TString >::Set(), qmu::QmuParserToken< TBase, TString >::SetIdx(), qmu::QmuParserToken< TBase, TString >::SetString(), qmu::QmuParserToken< TBase, TString >::SetVal(), and qmu::QmuParserToken< TBase, TString >::SetVar().
|
private |
Definition at line 472 of file qmuparsertoken.h.
Referenced by qmu::QmuParserToken< TBase, TString >::Assign(), qmu::QmuParserToken< TBase, TString >::GetType(), qmu::QmuParserToken< TBase, TString >::Set(), qmu::QmuParserToken< TBase, TString >::SetString(), qmu::QmuParserToken< TBase, TString >::SetVal(), and qmu::QmuParserToken< TBase, TString >::SetVar().
|
private |
Definition at line 478 of file qmuparsertoken.h.
Referenced by qmu::QmuParserToken< TBase, TString >::Assign(), qmu::QmuParserToken< TBase, TString >::GetArgCount(), qmu::QmuParserToken< TBase, TString >::GetAssociativity(), qmu::QmuParserToken< TBase, TString >::GetCode(), qmu::QmuParserToken< TBase, TString >::GetFuncAddr(), qmu::QmuParserToken< TBase, TString >::GetPri(), qmu::QmuParserToken< TBase, TString >::GetType(), qmu::QmuParserToken< TBase, TString >::Set(), qmu::QmuParserToken< TBase, TString >::SetString(), qmu::QmuParserToken< TBase, TString >::SetVal(), and qmu::QmuParserToken< TBase, TString >::SetVar().
|
private |
Stores Token pointer; not applicable for all tokens.
Definition at line 473 of file qmuparsertoken.h.
Referenced by qmu::QmuParserToken< TBase, TString >::Assign(), qmu::QmuParserToken< TBase, TString >::GetVal(), qmu::QmuParserToken< TBase, TString >::GetVar(), qmu::QmuParserToken< TBase, TString >::Set(), qmu::QmuParserToken< TBase, TString >::SetString(), qmu::QmuParserToken< TBase, TString >::SetVal(), and qmu::QmuParserToken< TBase, TString >::SetVar().
|
private |
Token string.
Definition at line 475 of file qmuparsertoken.h.
Referenced by qmu::QmuParserToken< TBase, TString >::Assign(), qmu::QmuParserToken< TBase, TString >::GetAsString(), qmu::QmuParserToken< TBase, TString >::Set(), qmu::QmuParserToken< TBase, TString >::SetString(), qmu::QmuParserToken< TBase, TString >::SetVal(), and qmu::QmuParserToken< TBase, TString >::SetVar().
|
private |
Value for string variables.
Definition at line 476 of file qmuparsertoken.h.
Referenced by qmu::QmuParserToken< TBase, TString >::Assign().