NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
Encapsulation of the data for a single formula token. More...
#include <muParserToken.h>
Public Member Functions | |
ParserToken () | |
Constructor (default). More... | |
ParserToken (const ParserToken &a_Tok) | |
Create token from another one. More... | |
ParserToken & | operator= (const ParserToken &a_Tok) |
Assignement operator. More... | |
void | Assign (const ParserToken &a_Tok) |
Copy token information from argument. More... | |
ParserToken & | Set (ECmdCode a_iType, const TString &a_strTok=TString()) |
Assign a token type. More... | |
ParserToken & | Set (const ParserCallback &a_pCallback, const TString &a_sTok) |
Set Callback type. More... | |
ParserToken & | SetVal (TBase a_fVal, const TString &a_strTok=TString()) |
Make this token a value token. More... | |
ParserToken & | SetVar (TBase *a_pVar, const TString &a_strTok) |
make this token a variable token. More... | |
ParserToken & | SetString (const TString &a_strTok, std::size_t 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 |
bool | IsOptimizable () const |
generic_fun_type | GetFuncAddr () const |
Return the address of the callback function assoziated with function and operator tokens. More... | |
TBase | GetVal () const |
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... | |
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... | |
value_type | m_fVal |
the value More... | |
std::unique_ptr< ParserCallback > | 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 61 of file muParserToken.h.
|
inline |
Constructor (default).
Sets token to an neutral state of type cmUNKNOWN.
nothrow |
Definition at line 83 of file muParserToken.h.
|
inline |
Create token from another one.
Implemented by calling Assign(...)
nothrow |
Definition at line 100 of file muParserToken.h.
References mu::ParserToken< TBase, TString >::Assign().
|
inline |
Copy token information from argument.
nothrow |
Definition at line 123 of file muParserToken.h.
References mu::ParserToken< TBase, TString >::m_fVal, mu::ParserToken< TBase, TString >::m_iCode, mu::ParserToken< TBase, TString >::m_iIdx, mu::ParserToken< TBase, TString >::m_iType, mu::ParserToken< TBase, TString >::m_pCallback, mu::ParserToken< TBase, TString >::m_pTok, mu::ParserToken< TBase, TString >::m_strTok, and mu::ParserToken< TBase, TString >::m_strVal.
Referenced by mu::ParserToken< TBase, TString >::operator=(), and mu::ParserToken< TBase, TString >::ParserToken().
|
inline |
Return the number of function arguments.
Valid only if m_iType==CmdFUNC.
Definition at line 384 of file muParserToken.h.
References mu::ecINTERNAL_ERROR, and mu::ParserToken< TBase, TString >::m_pCallback.
Referenced by mu::ParserBase::ApplyFunc(), and mu::ParserBase::ApplyStrFunc().
|
inline |
Definition at line 310 of file muParserToken.h.
References mu::cmOPRT_BIN, mu::ecINTERNAL_ERROR, and mu::ParserToken< TBase, TString >::m_pCallback.
Referenced by mu::ParserBase::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 403 of file muParserToken.h.
References mu::ParserToken< TBase, TString >::m_strTok.
Referenced by mu::ParserBase::ApplyFunc(), mu::ParserBase::ApplyStrFunc(), mu::ParserBase::CreateRPN(), mu::ParserTokenReader::IsFunTok(), mu::ParserTokenReader::IsInfixOpTok(), mu::ParserTokenReader::IsUndefVarTok(), and mu::ParserBase::StackDump().
|
inline |
Return the token type.
nothrow |
Definition at line 272 of file muParserToken.h.
References mu::ParserToken< TBase, TString >::m_iCode, and mu::ParserToken< TBase, TString >::m_pCallback.
Referenced by mu::ParserBase::ApplyFunc(), mu::ParserBase::ApplyIfElse(), mu::ParserBase::ApplyRemainingOprt(), mu::ParserBase::CreateRPN(), mu::ParserBase::GetOprtAssociativity(), mu::ParserBase::GetOprtPrecedence(), mu::ParserTokenReader::IsBuiltIn(), mu::ParserTokenReader::IsInfixOpTok(), and mu::ParserTokenReader::ReadNextToken().
|
inline |
Return the address of the callback function assoziated with function and operator tokens.
exception_type | if token type is non of:
|
Definition at line 341 of file muParserToken.h.
References mu::ParserToken< TBase, TString >::m_pCallback.
Referenced by mu::ParserBase::ApplyFunc(), and mu::ParserBase::ApplyStrFunc().
|
inline |
Return Index associated with the token related data.
In cmSTRFUNC - This is the index to a string table in the main parser.
Definition at line 258 of file muParserToken.h.
References mu::cmSTRING, mu::ecINTERNAL_ERROR, mu::ParserToken< TBase, TString >::m_iCode, and mu::ParserToken< TBase, TString >::m_iIdx.
|
inline |
Definition at line 298 of file muParserToken.h.
References mu::cmOPRT_BIN, mu::cmOPRT_INFIX, mu::ecINTERNAL_ERROR, and mu::ParserToken< TBase, TString >::m_pCallback.
Referenced by mu::ParserBase::GetOprtPrecedence().
|
inline |
Definition at line 285 of file muParserToken.h.
References mu::ParserToken< TBase, TString >::m_iType, and mu::ParserToken< TBase, TString >::m_pCallback.
Referenced by mu::ParserBase::ApplyBinOprt(), mu::ParserBase::ApplyFunc(), and mu::ParserBase::StackDump().
|
inline |
\biref Get value of the token.
Only applicable to variable and value tokens.
exception_type | if token is no value/variable token. |
Definition at line 352 of file muParserToken.h.
References mu::cmVAL, mu::cmVAR, mu::ecVAL_EXPECTED, mu::ParserToken< TBase, TString >::m_fVal, mu::ParserToken< TBase, TString >::m_iCode, and mu::ParserToken< TBase, TString >::m_pTok.
Referenced by mu::ParserBase::ApplyIfElse(), mu::ParserBase::CreateRPN(), and mu::ParserBase::StackDump().
|
inline |
Get address of a variable token.
Valid only if m_iType==CmdVar.
exception_type | if token is no variable token. |
Definition at line 371 of file muParserToken.h.
References mu::cmVAR, mu::ecINTERNAL_ERROR, mu::ParserToken< TBase, TString >::m_iCode, and mu::ParserToken< TBase, TString >::m_pTok.
Referenced by mu::ParserBase::CreateRPN().
|
inline |
Definition at line 319 of file muParserToken.h.
References mu::ecINTERNAL_ERROR, and mu::ParserToken< TBase, TString >::m_pCallback.
Referenced by mu::ParserBase::ApplyFunc().
|
inline |
Assignement operator.
Copy token state from another token and return this. Implemented by calling Assign(...).
nothrow |
Definition at line 112 of file muParserToken.h.
References mu::ParserToken< TBase, TString >::Assign().
|
inline |
Set Callback type.
Definition at line 165 of file muParserToken.h.
References mu::ParserCallback::GetAddr(), mu::ParserCallback::GetCode(), mu::ParserToken< TBase, TString >::m_iCode, mu::ParserToken< TBase, TString >::m_iIdx, mu::ParserToken< TBase, TString >::m_iType, mu::ParserToken< TBase, TString >::m_pCallback, mu::ParserToken< TBase, TString >::m_pTok, mu::ParserToken< TBase, TString >::m_strTok, and mu::tpVOID.
|
inline |
Assign a token type.
Token may not be of type value, variable or function. Those have seperate set functions.
Definition at line 147 of file muParserToken.h.
References mu::cmFUNC, mu::cmVAL, mu::cmVAR, mu::ParserToken< TBase, TString >::m_iCode, mu::ParserToken< TBase, TString >::m_iIdx, mu::ParserToken< TBase, TString >::m_iType, mu::ParserToken< TBase, TString >::m_pTok, mu::ParserToken< TBase, TString >::m_strTok, and mu::tpVOID.
Referenced by mu::ParserTokenReader::IsArgSep(), mu::ParserTokenReader::IsBuiltIn(), mu::ParserTokenReader::IsEOF(), mu::ParserTokenReader::IsFunTok(), mu::ParserTokenReader::IsInfixOpTok(), mu::ParserTokenReader::IsOprt(), and mu::ParserTokenReader::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. |
exception_type | if #a_iIdx<0 or m_iType!=cmSTRING |
Definition at line 242 of file muParserToken.h.
References mu::cmSTRING, mu::ecINTERNAL_ERROR, mu::ParserToken< TBase, TString >::m_iCode, and mu::ParserToken< TBase, TString >::m_iIdx.
Referenced by mu::ParserBase::CreateRPN().
|
inline |
Make this token a variable token.
Member variables not necessary for variable tokens will be invalidated.
nothrow |
Definition at line 223 of file muParserToken.h.
References mu::cmSTRING, mu::ParserToken< TBase, TString >::m_iCode, mu::ParserToken< TBase, TString >::m_iIdx, mu::ParserToken< TBase, TString >::m_iType, mu::ParserToken< TBase, TString >::m_pCallback, mu::ParserToken< TBase, TString >::m_pTok, mu::ParserToken< TBase, TString >::m_strTok, and mu::tpSTR.
Referenced by mu::ParserTokenReader::IsString(), and mu::ParserTokenReader::IsStrVarTok().
|
inline |
Make this token a value token.
Member variables not necessary for value tokens will be invalidated.
nothrow |
Definition at line 186 of file muParserToken.h.
References mu::cmVAL, mu::ParserToken< TBase, TString >::m_fVal, mu::ParserToken< TBase, TString >::m_iCode, mu::ParserToken< TBase, TString >::m_iIdx, mu::ParserToken< TBase, TString >::m_iType, mu::ParserToken< TBase, TString >::m_pCallback, mu::ParserToken< TBase, TString >::m_pTok, mu::ParserToken< TBase, TString >::m_strTok, and mu::tpDBL.
Referenced by mu::ParserBase::ApplyFunc(), mu::ParserBase::ApplyStrFunc(), and mu::ParserTokenReader::IsValTok().
|
inline |
make this token a variable token.
Member variables not necessary for variable tokens will be invalidated.
nothrow |
Definition at line 206 of file muParserToken.h.
References mu::cmVAR, mu::ParserToken< TBase, TString >::m_iCode, mu::ParserToken< TBase, TString >::m_iIdx, mu::ParserToken< TBase, TString >::m_iType, mu::ParserToken< TBase, TString >::m_pCallback, mu::ParserToken< TBase, TString >::m_pTok, mu::ParserToken< TBase, TString >::m_strTok, and mu::tpDBL.
Referenced by mu::ParserTokenReader::IsUndefVarTok(), and mu::ParserTokenReader::IsVarTok().
|
private |
the value
Definition at line 71 of file muParserToken.h.
Referenced by mu::ParserToken< TBase, TString >::Assign(), mu::ParserToken< TBase, TString >::GetVal(), and mu::ParserToken< TBase, TString >::SetVal().
|
private |
Type of the token; The token type is a constant of type ECmdCode.
Definition at line 65 of file muParserToken.h.
Referenced by mu::ParserToken< TBase, TString >::Assign(), mu::ParserToken< TBase, TString >::GetCode(), mu::ParserToken< TBase, TString >::GetIdx(), mu::ParserToken< TBase, TString >::GetVal(), mu::ParserToken< TBase, TString >::GetVar(), mu::ParserToken< TBase, TString >::Set(), mu::ParserToken< TBase, TString >::SetIdx(), mu::ParserToken< TBase, TString >::SetString(), mu::ParserToken< TBase, TString >::SetVal(), and mu::ParserToken< TBase, TString >::SetVar().
|
private |
An otional index to an external buffer storing the token data.
Definition at line 68 of file muParserToken.h.
Referenced by mu::ParserToken< TBase, TString >::Assign(), mu::ParserToken< TBase, TString >::GetIdx(), mu::ParserToken< TBase, TString >::Set(), mu::ParserToken< TBase, TString >::SetIdx(), mu::ParserToken< TBase, TString >::SetString(), mu::ParserToken< TBase, TString >::SetVal(), and mu::ParserToken< TBase, TString >::SetVar().
|
private |
Definition at line 66 of file muParserToken.h.
Referenced by mu::ParserToken< TBase, TString >::Assign(), mu::ParserToken< TBase, TString >::GetType(), mu::ParserToken< TBase, TString >::Set(), mu::ParserToken< TBase, TString >::SetString(), mu::ParserToken< TBase, TString >::SetVal(), and mu::ParserToken< TBase, TString >::SetVar().
|
private |
Definition at line 72 of file muParserToken.h.
Referenced by mu::ParserToken< TBase, TString >::Assign(), mu::ParserToken< TBase, TString >::GetArgCount(), mu::ParserToken< TBase, TString >::GetAssociativity(), mu::ParserToken< TBase, TString >::GetCode(), mu::ParserToken< TBase, TString >::GetFuncAddr(), mu::ParserToken< TBase, TString >::GetPri(), mu::ParserToken< TBase, TString >::GetType(), mu::ParserToken< TBase, TString >::IsOptimizable(), mu::ParserToken< TBase, TString >::Set(), mu::ParserToken< TBase, TString >::SetString(), mu::ParserToken< TBase, TString >::SetVal(), and mu::ParserToken< TBase, TString >::SetVar().
|
private |
Stores Token pointer; not applicable for all tokens.
Definition at line 67 of file muParserToken.h.
Referenced by mu::ParserToken< TBase, TString >::Assign(), mu::ParserToken< TBase, TString >::GetVal(), mu::ParserToken< TBase, TString >::GetVar(), mu::ParserToken< TBase, TString >::Set(), mu::ParserToken< TBase, TString >::SetString(), mu::ParserToken< TBase, TString >::SetVal(), and mu::ParserToken< TBase, TString >::SetVar().
|
private |
Token string.
Definition at line 69 of file muParserToken.h.
Referenced by mu::ParserToken< TBase, TString >::Assign(), mu::ParserToken< TBase, TString >::GetAsString(), mu::ParserToken< TBase, TString >::Set(), mu::ParserToken< TBase, TString >::SetString(), mu::ParserToken< TBase, TString >::SetVal(), and mu::ParserToken< TBase, TString >::SetVar().
|
private |
Value for string variables.
Definition at line 70 of file muParserToken.h.
Referenced by mu::ParserToken< TBase, TString >::Assign().