Provides set of operations with sequences for the parser.
#include <QtxEvalExpr.h>

Public Types | |
| typedef QList< QVariant > | ValueSet |
Public Member Functions | |
| QtxEvalSetSets () | |
| Constructor. | |
| virtual | ~QtxEvalSetSets () |
| Destructor. | |
| virtual void | bracketsList (QStringList &, bool open) const |
| Get list of brackets. | |
| virtual int | priority (const QString &, bool isBin) const |
| Get the operation priority. | |
| virtual QtxEvalExpr::Error | isValid (const QString &, const QVariant::Type, const QVariant::Type) const |
| Check operation validity. | |
| virtual QtxEvalExpr::Error | calculate (const QString &, QVariant &, QVariant &) const |
| Calculate the operation. | |
| virtual QString | name () const |
| Get operations set name. | |
| virtual void | operationList (QStringList &) const |
| Get the list of possible operations. | |
| virtual bool | createValue (const QString &, QVariant &) const |
| Create value from its string representation. | |
Static Public Member Functions | |
| static void | add (ValueSet &, const QVariant &) |
| Add new value v to the sequence set. | |
| static void | add (ValueSet &, const ValueSet &) |
| Add all values from sequence s2 to the sequence s1. | |
| static void | remove (ValueSet &, const QVariant &) |
| Remove value v from sequence set. | |
| static void | remove (ValueSet &, const ValueSet &) |
| Remove all values listed in the sequence s2 from the sequence s1. | |
| static QString | Name () |
| Get operations set name. | |
Protected Types | |
| typedef QList< QVariant::Type > | ListOfTypes |
Protected Member Functions | |
| void | addTypes (const ListOfTypes &) |
| Add operand types. | |
| void | addOperations (const QStringList &) |
| Add operation names to the internal list of operations. | |
| typedef QList<QVariant> QtxEvalSetSets.ValueSet |
typedef QList<QVariant::Type> QtxEvalSetBase.ListOfTypes [protected, inherited] |
| QtxEvalSetSets::QtxEvalSetSets | ( | ) |
References QtxEvalSetBase.addOperations(), and QtxEvalSetBase.addTypes().
| QtxEvalSetSets::~QtxEvalSetSets | ( | ) | [virtual] |
| void QtxEvalSetSets::bracketsList | ( | QStringList & | list, |
| bool | open | ||
| ) | const [virtual] |
| list | returning list of brackets |
| open | if true, collect opening brackets, or closing brackets otherwise |
Reimplemented from QtxEvalSetBase.
| int QtxEvalSetSets::priority | ( | const QString & | op, |
| bool | isBin | ||
| ) | const [virtual] |
Operation priority counts from 1. If the operation is impossible, this function returns value <= 0.
| op | operation |
| isBin | true if the operation is binary and false if it is unary |
Implements QtxEvalSet.
| QtxEvalExpr::Error QtxEvalSetSets::isValid | ( | const QString & | op, |
| const QVariant::Type | t1, | ||
| const QVariant::Type | t2 | ||
| ) | const [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 |
Reimplemented from QtxEvalSetBase.
References QtxEvalExpr.OK, and QtxEvalExpr.OperandsNotMatch.
| QtxEvalExpr::Error QtxEvalSetSets::calculate | ( | const QString & | op, |
| QVariant & | v1, | ||
| QVariant & | v2 | ||
| ) | const [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) |
Implements QtxEvalSet.
References add(), and QtxEvalExpr.OK.
| void QtxEvalSetSets::add | ( | ValueSet & | set, |
| const QVariant & | v | ||
| ) | [static] |
| set | sequence |
| v | value to be added |
| s1 | destination sequence |
| s2 | source sequence |
References add().
| void QtxEvalSetSets::remove | ( | ValueSet & | set, |
| const QVariant & | v | ||
| ) | [static] |
| set | sequence |
| v | value to be removed |
| s1 | sequence from which items are removed |
| s2 | sequence which items are removed |
| QString QtxEvalSetSets::Name | ( | ) | [static] |
| QString QtxEvalSetSets::name | ( | ) | const [virtual] |
| void QtxEvalSetBase::operationList | ( | QStringList & | list | ) | const [virtual, inherited] |
| list | returning list of operations supported by the class |
Implements QtxEvalSet.
References QtxEvalSetBase.myOpers.
| void QtxEvalSetBase::addTypes | ( | const ListOfTypes & | list | ) | [protected, inherited] |
| list | operand types to be added |
References QtxEvalSetBase.myTypes.
| void QtxEvalSetBase::addOperations | ( | const QStringList & | list | ) | [protected, inherited] |
| list | operations to be added |
References QtxEvalSetBase.myOpers.
| bool QtxEvalSet::createValue | ( | const QString & | str, |
| QVariant & | val | ||
| ) | const [virtual, inherited] |
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 QtxEvalSetArithmetic, QtxEvalSetLogic, QtxEvalSetMath, QtxEvalSetString, and QtxEvalSetConst.