Generic class. Provides functionality for standard operations sets.
#include <QtxEvalExpr.h>
Public Member Functions |
| | QtxEvalSetBase () |
| | Constructor.
|
| virtual | ~QtxEvalSetBase () |
| | Destructor.
|
| virtual void | operationList (QStringList &) const |
| | Get the list of possible operations.
|
| virtual void | bracketsList (QStringList &, bool open) const |
| | Get list of brackets.
|
| virtual QtxEvalExpr::Error | isValid (const QString &, const QVariant::Type, const QVariant::Type) const |
| | Check operation validity.
|
| virtual QString | name () const =0 |
| | Get unique operations set name.
|
| virtual bool | createValue (const QString &, QVariant &) const |
| | Create value from its string representation.
|
| virtual int | priority (const QString &, bool isBin) const =0 |
| | Get the operation priority.
|
| virtual QtxEvalExpr::Error | calculate (const QString &, QVariant &, QVariant &) const =0 |
| | Calculate the operation.
|
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.
|
Private Attributes |
| QStringList | myOpers |
| ListOfTypes | myTypes |
Member Typedef Documentation
Constructor & Destructor Documentation
| QtxEvalSetBase::QtxEvalSetBase |
( |
| ) |
|
| QtxEvalSetBase::~QtxEvalSetBase |
( |
| ) |
[virtual] |
Member Function Documentation
| void QtxEvalSetBase::operationList |
( |
QStringList & |
list | ) |
const [virtual] |
- Parameters:
-
| list | returning list of operations supported by the class |
Implements QtxEvalSet.
References myOpers.
| void QtxEvalSetBase::bracketsList |
( |
QStringList & |
list, |
|
|
bool |
open |
|
) |
| const [virtual] |
- Parameters:
-
| list | returning list of brackets |
| open | if true, collect opening brackets, or closing brackets otherwise |
Implements QtxEvalSet.
Reimplemented in QtxEvalSetSets.
| QtxEvalExpr::Error QtxEvalSetBase::isValid |
( |
const QString & |
op, |
|
|
const QVariant::Type |
t1, |
|
|
const QVariant::Type |
t2 |
|
) |
| const [virtual] |
| void QtxEvalSetBase::addTypes |
( |
const ListOfTypes & |
list | ) |
[protected] |
- Parameters:
-
| list | operand types to be added |
References myTypes.
| void QtxEvalSetBase::addOperations |
( |
const QStringList & |
list | ) |
[protected] |
- Parameters:
-
| list | operations to be added |
References myOpers.
| QString QtxEvalSet::name |
( |
| ) |
const [pure virtual, inherited] |
| 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.
- Parameters:
-
| str | string representration of the value |
| val | returning value |
- Returns:
true if str can be evaluated as custom value and false otherwise (parameter)
Reimplemented in QtxEvalSetArithmetic, QtxEvalSetLogic, QtxEvalSetMath, QtxEvalSetString, and QtxEvalSetConst.
| int QtxEvalSet::priority |
( |
const QString & |
op, |
|
|
bool |
isBin |
|
) |
| const [pure virtual, inherited] |
| QtxEvalExpr::Error QtxEvalSet::calculate |
( |
const QString & |
op, |
|
|
QVariant & |
v1, |
|
|
QVariant & |
v2 |
|
) |
| const [pure virtual, inherited] |
Field Documentation