1 #ifndef mathexpression_h 2 #define mathexpression_h 15 #include "generalmod.h" 36 virtual double getValue()
const = 0;
38 virtual int nrVariables()
const;
39 virtual const char* fullVariableExpression(
int)
const;
40 virtual void setVariableValue(
int,
double);
44 {
return varnms_.size(); }
46 {
return varnms_.get(idx).buf(); }
48 {
return varnms_.indexOf( nm ); }
49 int firstOccurVarName(
const char*)
const;
51 enum VarType { Variable, Constant, Recursive };
52 VarType getType(
int varidx)
const;
53 int getConstIdx(
int varidx)
const;
56 {
return isrecursive_; }
58 virtual Expression* clone()
const = 0;
60 virtual ~Expression();
62 const char* type()
const;
67 Expression(
int nrinputs);
69 int nrInputs()
const {
return inputs_.size(); }
70 bool setInput(
int, Expression* );
71 void copyInput( Expression* target )
const;
73 void addIfOK(
const char*);
114 bool inputsareseries=
true )
115 : inp_(str), abswarn_(false)
116 , inputsareseries_(inputsareseries) {}
121 static BufferString varNameOf(
const char* fullvarnm,
int* shift=0);
123 static int constIdxOf(
const char*);
137 bool findOuterParens(
char*,
int,
Expression*&)
const;
138 bool findOuterAbs(
char*,
int,
Expression*&)
const;
139 bool findQMarkOper(
char*,
int,
Expression*&)
const;
140 bool findAndOrOr(
char*,
int,
Expression*&)
const;
141 bool findInequality(
char*,
int,
Expression*&)
const;
142 bool findPlusAndMinus(
char*,
int,
Expression*&)
const;
144 bool findVariable(
char*,
int,
Expression*&)
const;
161 const char* d,
bool isop,
int n )
162 : symbol_(s), desc_(d)
163 , isoperator_(isop), nrargs_(n) {}
#define mExpClass(module)
Definition: commondefs.h:160
void dump(BufferString &str) const
Definition: mathexpression.h:63
const char * uniqueVarName(int idx) const
Definition: mathexpression.h:45
void setInput(const char *s)
Definition: mathexpression.h:118
const bool inputsareseries_
Definition: mathexpression.h:131
BufferString inp_
Definition: mathexpression.h:130
BufferString errmsg_
Definition: mathexpression.h:132
virtual void dumpSpecifics(BufferString &, int nrtabs) const
Definition: mathexpression.h:84
ObjectSet< Expression > inputs_
Definition: mathexpression.h:77
int nrInputs() const
Definition: mathexpression.h:69
Set of BufferString objects.
Definition: bufstringset.h:28
bool isrecursive_
Definition: mathexpression.h:79
bool abswarn_
Definition: mathexpression.h:133
ExpressionOperatorDesc(const char *s, const char *d, bool isop, int n)
Definition: mathexpression.h:160
Set of pointers to objects.
Definition: commontypes.h:32
int nrUniqueVarNames() const
Definition: mathexpression.h:43
bool foundOldAbs() const
Definition: mathexpression.h:126
const char * desc_
Definition: mathexpression.h:166
const char * symbol_
Definition: mathexpression.h:165
BufferString name_
Definition: mathexpression.h:180
const char * errMsg() const
Definition: mathexpression.h:125
Parsed Math expression.
Definition: mathexpression.h:32
Group of similar expression descs.
Definition: mathexpression.h:176
ObjectSet< TypeSet< int > > variableobj_
Definition: mathexpression.h:75
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
ObjectSet< TypeSet< int > > variablenr_
Definition: mathexpression.h:76
BufferString errmsg_
Definition: horizontracker.h:119
VarType
Definition: mathexpression.h:51
int indexOfUnVarName(const char *nm) const
Definition: mathexpression.h:47
Expression desc to build UI.
Definition: mathexpression.h:157
bool isRecursive() const
Definition: mathexpression.h:55
ExpressionParser(const char *str=0, bool inputsareseries=true)
Definition: mathexpression.h:113
int nrargs_
2 for normal operators
Definition: mathexpression.h:168
Parses a string with a mathematical expression.
Definition: mathexpression.h:109
bool isoperator_
if not, function
Definition: mathexpression.h:167
BufferStringSet varnms_
Definition: mathexpression.h:78
ObjectSet< ExpressionOperatorDesc > opers_
Definition: mathexpression.h:181