26 #ifndef MU_PARSER_TOKEN_H
27 #define MU_PARSER_TOKEN_H
60 template<
typename TBase,
typename TString>
81 std::auto_ptr<ParserCallback> m_pCallback;
135 m_iCode = a_Tok.m_iCode;
136 m_pTok = a_Tok.m_pTok;
137 m_iFlags = a_Tok.m_iFlags;
138 m_strTok = a_Tok.m_strTok;
139 m_iIdx = a_Tok.m_iIdx;
140 m_strVal = a_Tok.m_strVal;
141 m_iType = a_Tok.m_iType;
142 m_fVal = a_Tok.m_fVal;
144 m_pCallback.reset(a_Tok.m_pCallback.get() ? a_Tok.m_pCallback->Clone() : 0);
155 m_iFlags |= a_iFlags;
165 #if defined(_MSC_VER)
166 #pragma warning( disable : 4800 )
169 return (
bool)(m_iFlags & a_iFlags);
171 #if defined(_MSC_VER)
172 #pragma warning( default : 4800 ) // int: Variable set to boolean value (may degrade performance)
190 assert(a_iType!=
cmVAR);
191 assert(a_iType!=
cmVAL);
210 m_iCode = a_pCallback.
GetCode();
219 if (!m_pCallback->IsOptimizable())
241 m_pCallback.reset(0);
259 m_pTok = (
void*)a_pVar;
260 m_pCallback.reset(0);
278 m_iIdx =
static_cast<int>(a_iSize);
281 m_pCallback.reset(0);
326 if (m_pCallback.get())
328 return m_pCallback->GetCode();
339 if (m_pCallback.get())
341 return m_pCallback->GetType();
352 if ( !m_pCallback.get())
358 return m_pCallback->GetPri();
378 return (m_pCallback.get()) ? m_pCallback->GetAddr() : 0;
391 case cmVAL:
return m_fVal;
392 case cmVAR:
return *((TBase*)m_pTok);
408 return (TBase*)m_pTok;
418 assert(m_pCallback.get());
420 if (!m_pCallback->GetAddr())
423 return m_pCallback->GetArgc();
code for infix operators
Definition: muParserDef.h:184
user defined binary operator
Definition: muParserDef.h:182
ParserToken & SetVar(TBase *a_pVar, const TString &a_strTok)
make this token a variable token.
Definition: muParserToken.h:252
int GetArgCount() const
Return the number of function arguments.
Definition: muParserToken.h:416
TBase * GetVar() const
Get address of a variable token.
Definition: muParserToken.h:403
bool IsFlagSet(int a_iFlags) const
Check if a certain flag ist set.
Definition: muParserToken.h:163
Internal error of any kind.
Definition: muParserError.h:83
const muChar_t muFloat_t a_fVal
Definition: muParserDLL.h:107
ParserToken & SetVal(TBase a_fVal, const TString &a_strTok=TString())
Make this token a value token.
Definition: muParserToken.h:231
void Assign(const ParserToken &a_Tok)
Copy token information from argument.
Definition: muParserToken.h:133
Mark a token that depends on a variable or a function that is not conservative.
Definition: muParserToken.h:68
ParserToken & operator=(const ParserToken &a_Tok)
Assignement operator.
Definition: muParserToken.h:122
ECmdCode GetCode() const
Return the callback code.
Definition: muParserCallback.cpp:211
ParserToken & SetString(const TString &a_strTok, std::size_t a_iSize)
Make this token a variable token.
Definition: muParserToken.h:272
Code for a function item.
Definition: muParserDef.h:179
ETokFlags
Additional token flags.
Definition: muParserToken.h:66
unsigned const muChar_t muFloat_t ** a_pVar
Definition: muParserDLL.h:145
int GetIdx() const
Return Index associated with the token related data.
Definition: muParserToken.h:310
void AddFlags(int a_iFlags)
Add additional flags to the token.
Definition: muParserToken.h:153
ETypeCode
Types internally used by the parser.
Definition: muParserDef.h:192
ParserToken()
Constructor (default).
Definition: muParserToken.h:92
Error class of the parser.
Definition: muParserError.h:119
ECmdCode
Bytecode values.
Definition: muParserDef.h:154
MUP_BASETYPE value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:222
String type (Function arguments and constants only, no string variables)
Definition: muParserDef.h:194
A numerical function has been called with a non value type of argument.
Definition: muParserError.h:59
ECmdCode GetCode() const
Return the token type.
Definition: muParserToken.h:324
Namespace for mathematical applications.
Definition: muParser.cpp:47
TBase GetVal() const
Get value of the token.
Definition: muParserToken.h:387
ParserToken & Set(ECmdCode a_iType, const TString &a_strTok=TString())
Assign a token type.
Definition: muParserToken.h:187
ETypeCode GetType() const
Definition: muParserToken.h:337
int GetPri() const
Definition: muParserToken.h:350
void * GetFuncAddr() const
Return the address of the callback function assoziated with function and operator tokens...
Definition: muParserToken.h:376
value item
Definition: muParserDef.h:178
Undefined type.
Definition: muParserDef.h:196
Definition of the parser callback class.
void * GetAddr() const
Get the callback address for the parser function.
Definition: muParserCallback.cpp:203
void SetIdx(int a_iIdx)
Set an index associated with the token related data.
Definition: muParserToken.h:294
uninitialized item
Definition: muParserDef.h:186
Code for a string token.
Definition: muParserDef.h:181
variable item
Definition: muParserDef.h:177
Encapsulation of the data for a single formula token.
Definition: muParserToken.h:61
const TString & GetAsString() const
Return the token identifier.
Definition: muParserToken.h:435
Floating point variables.
Definition: muParserDef.h:195
ParserToken(const ParserToken &a_Tok)
Create token from another one.
Definition: muParserToken.h:110
Encapsulation of prototypes for a numerical parser function.
Definition: muParserCallback.h:51
ParserToken & Set(const ParserCallback &a_pCallback, const TString &a_sTok)
Set Callback type.
Definition: muParserToken.h:206
This file defines the error class used by the parser.