Interpret mathematical expressions. More...
#include <rexeval.h>
Classes | |
struct | OpData |
structure describing an operator More... | |
Public Types | |
enum | Operation { OP_Invalid = -1, OP_Add, OP_Sub, OP_Mul, OP_IDiv, OP_Mod, OP_Div, OP_Pow, OP_Equ, OP_And, OP_Or, OP_Not, OP_Great, OP_Small, OP_GreatEqu, OP_SmallEqu, OP_OParantesis, OP_CParantesis, OP_Max } |
lists all opperations that we know of | |
enum | Associativity { LeftAssoc, RightAssoc } |
types of associativity | |
typedef void(* | kbOperand )(RexEval *ev) |
type of callback used with operands | |
Public Member Functions | |
RexEval (const QString &s) | |
void | setError (const QString &s) |
bool | isOperatorSymbol (QChar c) const |
bool | hasErrors (void) const |
const QString & | errorString (void) const |
void | addOperator (const QString &s) |
void | addOperand (const QString &s) |
void | compute () |
OperandTk * | oneDouble (RexEval *ev, double &d1) |
OperandTk * | twoDoubles (RexEval *ev, double &d1, double &d2) |
double | resultDouble (void) |
QString | resultString (void) |
bool | resultBool (void) |
void | dumpChain (List2Dh *hdr) |
Static Public Member Functions | |
static int | cmpPrecedence (OperatorTk *op1, OperatorTk *op2) |
static bool | isAssociative (OperatorTk *op1, Associativity asoc) |
static bool | isOperator (BaseTk *btk) |
static void | opKbAdd (RexEval *ev) |
static void | opKbAnd (RexEval *ev) |
static void | opKbDiv (RexEval *ev) |
static void | opKbEqu (RexEval *ev) |
static void | opKbGreatEqu (RexEval *ev) |
static void | opKbGreat (RexEval *ev) |
static void | opKbIDiv (RexEval *ev) |
static void | opKbMod (RexEval *ev) |
static void | opKbMul (RexEval *ev) |
static void | opKbNot (RexEval *ev) |
static void | opKbOr (RexEval *ev) |
static void | opKbPow (RexEval *ev) |
static void | opKbSmallEqu (RexEval *ev) |
static void | opKbSmall (RexEval *ev) |
static void | opKbSub (RexEval *ev) |
Interpret mathematical expressions.
Inspired by http://www.technical-recipes.com/2011/a-mathematical-expression-parser-in-java-and-cpp/