X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..2019e5afdaf7fd0ad21607848710348bbc3be256:/ArithmeticEvaluator.h diff --git a/ArithmeticEvaluator.h b/ArithmeticEvaluator.h index f6d478b..67f50a5 100644 --- a/ArithmeticEvaluator.h +++ b/ArithmeticEvaluator.h @@ -30,16 +30,22 @@ public: ArithmeticEvaluator(); ArithmeticEvaluator(const QString& _expression) throw(int); + //getters + inline QList getVariableNames() { return varNames; } + + // setters void setExpression(const QString& _expression) throw(int); - inline void setVariablesValue(const QHash& _varValues) { varValues = _varValues; } + void setVariablesValue(const QHash& _varValues); inline void setVariableValue(const QString& var, double value) { varValues.insert(var,value); } inline void setVariableMarkers(const QString& _markers) { varMarkers = _markers; } void print(); double evaluate() throw(int); + inline QString getError() { return errorMessage; } protected: QStringList expression; + QList varNames; // the names of variables that ARE in the expression QHash varValues; QString varMarkers; // a sequence of symbols that are allowed to start a variable. $ is by default QString opMarkers; // a sequence if symbols used as operators. +-*/ is the hard-coded default @@ -54,6 +60,10 @@ protected: bool checkAfterPar(const QString& _expression, int offset); double evalFunction(int indexFunc, double value); + + void setVariableNames(const QString &_expression); + + QString errorMessage; };