Generic class for all the operations sets used in expressions.
#include <QtxEvalExpr.h>

Public Member Functions | |
| QtxEvalSet () | |
| Constructor. More... | |
| virtual | ~QtxEvalSet () |
| Destructor. More... | |
| virtual QString | name () const =0 |
| Get unique operations set name. More... | |
| virtual void | operationList (QStringList &) const =0 |
| Get the list of possible operations. More... | |
| virtual void | bracketsList (QStringList &, bool open) const =0 |
| Get list of brackets. More... | |
| virtual bool | createValue (const QString &, QVariant &) const |
| Create value from its string representation. More... | |
| virtual int | priority (const QString &, bool isBin) const =0 |
| Get the operation priority. More... | |
| virtual QtxEvalExpr::Error | isValid (const QString &, const QVariant::Type, const QVariant::Type) const =0 |
| Check operation validity. More... | |
| virtual QtxEvalExpr::Error | calculate (const QString &, QVariant &, QVariant &) const =0 |
| Calculate the operation. More... | |
| QtxEvalSet::QtxEvalSet | ( | ) |
|
virtual |
|
pure virtual |
| list | returning list of brackets |
| open | if true, collect opening brackets, or closing brackets otherwise |
Implemented in QtxEvalSetConst, QtxEvalSetSets, and QtxEvalSetBase.
|
pure virtual |
Process binary operation with values v1 and v2. For unary operation the is invalid. The result of the operation is returned in the parameter v1.
| op | operation name |
| v1 | first argument (not valid for unary prefix operations) |
| v2 | second argument (not valid for unary postfix operations) |
Implemented in QtxEvalSetConst, QtxEvalSetSets, QtxEvalSetString, QtxEvalSetMath, QtxEvalSetLogic, and QtxEvalSetArithmetic.
|
virtual |
By default, the string value is set, that corresponds to the parameter. Base implementation always returns false (it means that string is evaluated to the parameter). Successor class can re-implement this method to return true if the argument being parsed can be evaluated as custom value.
| str | string representration of the value |
| val | returning value |
true if str can be evaluated as custom value and false otherwise (parameter) Reimplemented in QtxEvalSetConst, QtxEvalSetString, QtxEvalSetMath, QtxEvalSetLogic, and QtxEvalSetArithmetic.
|
pure virtual |
If the operation is valid, QtxEvalExpr::OK is returned. If types of operands are invalid, the function returns QtxEvalExpr::OperandsNotMatch or QtxEvalExpr::InvalidOperation.
| op | operation |
| t1 | first operand type |
| t2 | second operand type |
Implemented in QtxEvalSetConst, QtxEvalSetSets, and QtxEvalSetBase.
|
pure virtual |
Should be redefined in the successor classes.
Implemented in QtxEvalSetConst, QtxEvalSetSets, QtxEvalSetString, QtxEvalSetMath, QtxEvalSetLogic, and QtxEvalSetArithmetic.
|
pure virtual |
| list | returning list of operations supported by the class |
Implemented in QtxEvalSetConst, and QtxEvalSetBase.
|
pure virtual |
Operation priority counts from 1. If the operation is impossible, this function should return value <= 0.
| op | operation |
| isBin | true if the operation is binary and false if it is unary |
Implemented in QtxEvalSetConst, QtxEvalSetSets, QtxEvalSetString, QtxEvalSetMath, QtxEvalSetLogic, and QtxEvalSetArithmetic.