muParser API -  1.35
Classes | Public Member Functions | List of all members
mu::ParserInt Class Reference

Mathematical expressions parser. More...

#include <muParserInt.h>

Inheritance diagram for mu::ParserInt:
Inheritance graph
[legend]

Public Member Functions

 ParserInt ()
 Constructor. More...
 
void InitFun () override
 Initialize the default functions.
 
void InitOprt () override
 Initialize operators.
 
void InitConst () override
 
void InitCharSets () override
 
- Public Member Functions inherited from mu::ParserBase
 ParserBase ()
 Constructor. More...
 
 ParserBase (const ParserBase &a_Parser)
 Copy constructor. More...
 
ParserBaseoperator= (const ParserBase &a_Parser)
 Assignment operator. More...
 
value_type Eval () const
 Calculate the result. More...
 
value_typeEval (int &nStackSize) const
 Evaluate an expression containing comma separated subexpressions. More...
 
void Eval (value_type *results, int nBulkSize)
 
int GetNumResults () const
 Return the number of results on the calculation stack. More...
 
void SetExpr (const string_type &a_sExpr)
 Set the formula. More...
 
void SetVarFactory (facfun_type a_pFactory, void *pUserData=nullptr)
 Set a function that can create variable pointer for unknown expression variables. More...
 
void SetDecSep (char_type cDecSep)
 Set the decimal separator. More...
 
void SetThousandsSep (char_type cThousandsSep=0)
 Sets the thousands operator. More...
 
void ResetLocale ()
 Resets the locale. More...
 
void EnableOptimizer (bool a_bIsOn=true)
 Enable or disable the formula optimization feature. More...
 
void EnableBuiltInOprt (bool a_bIsOn=true)
 Enable or disable the built in binary operators. More...
 
bool HasBuiltInOprt () const
 Query status of built in variables. More...
 
void AddValIdent (identfun_type a_pCallback)
 Add a value parsing function. More...
 
template<typename T >
void DefineFun (const string_type &a_strName, T a_pFun, bool a_bAllowOpt=true)
 Define a parser function without arguments. More...
 
template<typename T >
void DefineFunUserData (const string_type &a_strName, T a_pFun, void *a_pUserData, bool a_bAllowOpt=true)
 Define a parser function with user data (not null). More...
 
void DefineOprt (const string_type &a_strName, fun_type2 a_pFun, unsigned a_iPri=0, EOprtAssociativity a_eAssociativity=oaLEFT, bool a_bAllowOpt=false)
 Define a binary operator. More...
 
void DefineConst (const string_type &a_sName, value_type a_fVal)
 Add a user defined constant. More...
 
void DefineStrConst (const string_type &a_sName, const string_type &a_strVal)
 Define a new string constant. More...
 
void DefineVar (const string_type &a_sName, value_type *a_fVar)
 Add a user defined variable. More...
 
void DefinePostfixOprt (const string_type &a_strFun, fun_type1 a_pOprt, bool a_bAllowOpt=true)
 Add a user defined operator. More...
 
void DefineInfixOprt (const string_type &a_strName, fun_type1 a_pOprt, int a_iPrec=prINFIX, bool a_bAllowOpt=true)
 Add a user defined operator. More...
 
void ClearVar ()
 Clear all user defined variables. More...
 
void ClearFun ()
 Clear all functions. More...
 
void ClearConst ()
 Clear all user defined constants. More...
 
void ClearInfixOprt ()
 Clear the user defined Prefix operators. More...
 
void ClearPostfixOprt ()
 Clear all user defined postfix operators. More...
 
void ClearOprt ()
 Clear all user defined binary operators. More...
 
void RemoveVar (const string_type &a_strVarName)
 Remove a variable from internal storage. More...
 
const varmap_typeGetUsedVar () const
 Return a map containing the used variables only.
 
const varmap_typeGetVar () const
 Return a map containing the used variables only.
 
const valmap_typeGetConst () const
 Return a map containing all parser constants.
 
const string_typeGetExpr () const
 Retrieve the formula.
 
const funmap_typeGetFunDef () const
 Return prototypes of all parser functions. More...
 
string_type GetVersion (EParserVersionInfo eInfo=pviFULL) const
 Returns the version of muparser. More...
 
const ParserByteCodeGetByteCode () const
 Returns a copy of the bytecode of the current expression.
 
const char_type ** GetOprtDef () const
 Get the default symbols used for the built in operators. More...
 
void DefineNameChars (const char_type *a_szCharset)
 Define the set of valid characters to be used in names of functions, variables, constants.
 
void DefineOprtChars (const char_type *a_szCharset)
 Define the set of valid characters to be used in names of binary operators and postfix operators.
 
void DefineInfixOprtChars (const char_type *a_szCharset)
 Define the set of valid characters to be used in names of infix operators.
 
const char_typeValidNameChars () const
 Virtual function that defines the characters allowed in name identifiers. More...
 
const char_typeValidOprtChars () const
 Virtual function that defines the characters allowed in operator definitions. More...
 
const char_typeValidInfixOprtChars () const
 Virtual function that defines the characters allowed in infix operator definitions. More...
 
void SetArgSep (char_type cArgSep)
 Set argument separator. More...
 
void SetByteCode (const ParserByteCode &a_ByteCode)
 Restore a previously saved bytecode.
 
char_type GetArgSep () const
 Get the argument separator character.
 

Additional Inherited Members

- Public Types inherited from mu::ParserBase
typedef ParserError exception_type
 Type of the error class. More...
 
- Static Public Member Functions inherited from mu::ParserBase
static void EnableDebugDump (bool bDumpCmd, bool bDumpStack)
 Enable the dumping of bytecode and stack content on the console. More...
 
- Protected Member Functions inherited from mu::ParserBase
void Init ()
 Initialize user defined functions. More...
 
void Error (EErrorCodes a_iErrc, int a_iPos=static_cast< int >(mu::string_type::npos), const string_type &a_strTok=string_type()) const
 Create an error containing the parse error position. More...
 
virtual void OnDetectVar (string_type *pExpr, int &nStart, int &nEnd)
 
- Static Protected Attributes inherited from mu::ParserBase
static const char_typec_DefaultOprt []
 Identifiers for built in binary operators. More...
 
static std::locale s_locale = std::locale(std::locale::classic(), new change_dec_sep<char_type>('.'))
 The locale used by the parser.
 
static bool g_DbgDumpCmdCode = false
 
static bool g_DbgDumpStack = false
 

Detailed Description

Mathematical expressions parser.

This version of the parser handles only integer numbers. It disables the built in operators thus it is slower than muParser. Integer values are stored in the double value_type and converted if needed.

Definition at line 49 of file muParserInt.h.

Constructor & Destructor Documentation

mu::ParserInt::ParserInt ( )

Constructor.

Call ParserBase class constructor and trigger Function, Operator and Constant initialization.

Definition at line 205 of file muParserInt.cpp.

206  :ParserBase()
207  {
208  AddValIdent(IsVal); // lowest priority
209  AddValIdent(IsBinVal);
210  AddValIdent(IsHexVal); // highest priority
211 
212  InitCharSets();
213  InitFun();
214  InitOprt();
215  }
void AddValIdent(identfun_type a_pCallback)
Add a value parsing function.
void InitOprt() override
Initialize operators.
ParserBase()
Constructor.
void InitFun() override
Initialize the default functions.

The documentation for this class was generated from the following files: