#include <muParserToken.h>
Public Types | |
| enum | ETokFlags { flVOLATILE = 1 } |
| Additional token flags. More... | |
Public Member Functions | |
| ParserToken () | |
| Constructor (default). | |
| ParserToken (const ParserToken &a_Tok) | |
| Create token from another one. | |
| ParserToken & | operator= (const ParserToken &a_Tok) |
| Assignement operator. | |
| void | Assign (const ParserToken &a_Tok) |
| Copy token information from argument. | |
| void | AddFlags (int a_iFlags) |
| Add additional flags to the token. | |
| bool | IsFlagSet (int a_iFlags) const |
| Check if a certain flag ist set. | |
| ParserToken & | Set (ECmdCode a_iType, const TString &a_strTok=TString()) |
| Assign a token type. | |
| ParserToken & | Set (const ParserCallback &a_pCallback, const TString &a_sTok) |
| Set Callback type. | |
| ParserToken & | SetVal (TBase a_fVal, const TString &a_strTok=TString()) |
| Make this token a value token. | |
| ParserToken & | SetVar (TBase *a_pVar, const TString &a_strTok) |
| make this token a variable token. | |
| ParserToken & | SetString (const TString &a_strTok, std::size_t a_iSize) |
| Make this token a variable token. | |
| void | SetIdx (int a_iIdx) |
| Set an index associated with the token related data. | |
| int | GetIdx () const |
| Return Index associated with the token related data. | |
| ECmdCode | GetCode () const |
| Return the token type. | |
| ETypeCode | GetType () const |
| int | GetPri () const |
| void * | GetFuncAddr () const |
| Return the address of the callback function assoziated with function and operator tokens. | |
| TBase | GetVal () const |
| TBase * | GetVar () const |
| Get address of a variable token. | |
| int | GetArgCount () const |
| Return the number of function arguments. | |
| const TString & | GetAsString () const |
| Return the token identifier. | |
Private Attributes | |
| ECmdCode | m_iCode |
| Type of the token; The token type is a constant of type ECmdCode. | |
| ETypeCode | m_iType |
| void * | m_pTok |
| Stores Token pointer; not applicable for all tokens. | |
| int | m_iFlags |
| Additional flags for the token. | |
| int | m_iIdx |
| An otional index to an external buffer storing the token data. | |
| TString | m_strTok |
| Token string. | |
| TString | m_strVal |
| Value for string variables. | |
| value_type | m_fVal |
| std::auto_ptr< ParserCallback > | m_pCallback |
Formula token implementation. Part of the Math Parser Package. Formula tokens can be either one of the following:
| enum mu::ParserToken::ETokFlags |
| mu::ParserToken< TBase, TString >::ParserToken | ( | ) | [inline] |
Constructor (default).
Sets token to an neutral state of type cmUNKNOWN.
| nothrow |
| mu::ParserToken< TBase, TString >::ParserToken | ( | const ParserToken< TBase, TString > & | a_Tok | ) | [inline] |
Create token from another one.
Implemented by calling Assign(...)
| nothrow |
| ParserToken& mu::ParserToken< TBase, TString >::operator= | ( | const ParserToken< TBase, TString > & | a_Tok | ) | [inline] |
Assignement operator.
Copy token state from another token and return this. Implemented by calling Assign(...).
| nothrow |
| void mu::ParserToken< TBase, TString >::Assign | ( | const ParserToken< TBase, TString > & | a_Tok | ) | [inline] |
Copy token information from argument.
| nothrow |
Referenced by mu::ParserToken< MUP_BASETYPE, MUP_STRING_TYPE >::operator=(), and mu::ParserToken< MUP_BASETYPE, MUP_STRING_TYPE >::ParserToken().
| void mu::ParserToken< TBase, TString >::AddFlags | ( | int | a_iFlags | ) | [inline] |
Add additional flags to the token.
Flags are currently used to mark volatile (non optimizeable) functions.
Referenced by mu::ParserBase::ApplyNumFunc(), mu::ParserBase::ApplyStrFunc(), mu::ParserToken< MUP_BASETYPE, MUP_STRING_TYPE >::Set(), mu::ParserToken< MUP_BASETYPE, MUP_STRING_TYPE >::SetString(), and mu::ParserToken< MUP_BASETYPE, MUP_STRING_TYPE >::SetVar().
| bool mu::ParserToken< TBase, TString >::IsFlagSet | ( | int | a_iFlags | ) | const [inline] |
Check if a certain flag ist set.
| nothrow |
Referenced by mu::ParserBase::ApplyNumFunc(), and mu::ParserBase::ApplyStrFunc().
| ParserToken& mu::ParserToken< TBase, TString >::Set | ( | ECmdCode | a_iType, | |
| const TString & | a_strTok = TString() | |||
| ) | [inline] |
Assign a token type.
Token may not be of type value, variable or function. Those have seperate set functions.
[assert] a_iType!=cmVAL
[assert] a_iType!=cmFUNC
m_pTok = 0
Referenced by mu::ParserTokenReader::IsBuiltIn(), mu::ParserTokenReader::IsEOF(), mu::ParserTokenReader::IsFunTok(), mu::ParserTokenReader::IsInfixOpTok(), mu::ParserTokenReader::IsOprt(), and mu::ParserTokenReader::IsPostOpTok().
| ParserToken& mu::ParserToken< TBase, TString >::SetVal | ( | TBase | a_fVal, | |
| const TString & | a_strTok = TString() | |||
| ) | [inline] |
Make this token a value token.
Member variables not necessary for value tokens will be invalidated.
| nothrow |
Referenced by mu::ParserBase::ApplyNumFunc(), mu::ParserBase::ApplyStrFunc(), and mu::ParserTokenReader::IsValTok().
| ParserToken& mu::ParserToken< TBase, TString >::SetVar | ( | TBase * | a_pVar, | |
| const TString & | a_strTok | |||
| ) | [inline] |
make this token a variable token.
Member variables not necessary for variable tokens will be invalidated.
| nothrow |
Referenced by mu::ParserTokenReader::IsUndefVarTok(), and mu::ParserTokenReader::IsVarTok().
| ParserToken& mu::ParserToken< TBase, TString >::SetString | ( | const TString & | a_strTok, | |
| std::size_t | a_iSize | |||
| ) | [inline] |
Make this token a variable token.
Member variables not necessary for variable tokens will be invalidated.
| nothrow |
Referenced by mu::ParserTokenReader::IsString().
| void mu::ParserToken< TBase, TString >::SetIdx | ( | int | a_iIdx | ) | [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 |
Referenced by mu::ParserBase::ParseString().
| int mu::ParserToken< TBase, TString >::GetIdx | ( | ) | const [inline] |
| ECmdCode mu::ParserToken< TBase, TString >::GetCode | ( | ) | const [inline] |
Return the token type.
| nothrow |
Referenced by mu::ParserBase::ApplyFunc(), mu::ParserBase::GetOprtPri(), mu::ParserTokenReader::IsBuiltIn(), and mu::ParserBase::ParseString().
| void* mu::ParserToken< TBase, TString >::GetFuncAddr | ( | ) | const [inline] |
Return the address of the callback function assoziated with function and operator tokens.
| exception_type | if token type is non of:
|
Referenced by mu::ParserBase::ApplyFunc(), mu::ParserBase::ApplyNumFunc(), mu::ParserBase::ApplyStrFunc(), and mu::ParserBase::ParseString().
| TBase mu::ParserToken< TBase, TString >::GetVal | ( | ) | const [inline] |
Get value of the token.
Only applicable to variable and value tokens.
| exception_type | if token is no value/variable token. |
Referenced by mu::ParserBase::ApplyNumFunc(), and mu::ParserBase::ParseString().
| TBase* mu::ParserToken< TBase, TString >::GetVar | ( | ) | const [inline] |
Get address of a variable token.
Valid only if m_iType==CmdVar.
| exception_type | if token is no variable token. |
Referenced by mu::ParserBase::ParseString().
| int mu::ParserToken< TBase, TString >::GetArgCount | ( | ) | const [inline] |
Return the number of function arguments.
Valid only if m_iType==CmdFUNC.
Referenced by mu::ParserBase::ApplyFunc(), mu::ParserBase::ApplyNumFunc(), and mu::ParserBase::ApplyStrFunc().
| const TString& mu::ParserToken< TBase, TString >::GetAsString | ( | ) | const [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 |
Referenced by mu::ParserBase::ApplyFunc(), mu::ParserBase::ApplyNumFunc(), mu::ParserBase::ApplyStrFunc(), mu::ParserTokenReader::IsFunTok(), mu::ParserTokenReader::IsInfixOpTok(), mu::ParserTokenReader::IsOprt(), mu::ParserTokenReader::IsUndefVarTok(), and mu::ParserBase::ParseString().
1.5.5