Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QtxEvalSet Class Referenceabstract

Generic class for all the operations sets used in expressions.

#include <QtxEvalExpr.h>

Inheritance diagram for QtxEvalSet:
Inheritance graph

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...
 

Constructor & Destructor Documentation

QtxEvalSet::QtxEvalSet ( )
QtxEvalSet::~QtxEvalSet ( )
virtual

Member Function Documentation

void QtxEvalSet::bracketsList ( QStringList &  list,
bool  open 
) const
pure virtual
Parameters
listreturning list of brackets
openif true, collect opening brackets, or closing brackets otherwise

Implemented in QtxEvalSetConst, QtxEvalSetSets, and QtxEvalSetBase.

QtxEvalExpr::Error QtxEvalSet::calculate ( const QString &  op,
QVariant &  v1,
QVariant &  v2 
) const
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.

Parameters
opoperation name
v1first argument (not valid for unary prefix operations)
v2second argument (not valid for unary postfix operations)
Returns
error code (QtxEvalExpr::Error)

Implemented in QtxEvalSetConst, QtxEvalSetSets, QtxEvalSetString, QtxEvalSetMath, QtxEvalSetLogic, and QtxEvalSetArithmetic.

bool QtxEvalSet::createValue ( const QString &  str,
QVariant &  val 
) const
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.

Parameters
strstring representration of the value
valreturning value
Returns
true if str can be evaluated as custom value and false otherwise (parameter)

Reimplemented in QtxEvalSetConst, QtxEvalSetString, QtxEvalSetMath, QtxEvalSetLogic, and QtxEvalSetArithmetic.

QtxEvalExpr::Error QtxEvalSet::isValid ( const QString &  op,
const QVariant::Type  t1,
const QVariant::Type  t2 
) const
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.

Parameters
opoperation
t1first operand type
t2second operand type
Returns
error code (QtxEvalExpr::Error)

Implemented in QtxEvalSetConst, QtxEvalSetSets, and QtxEvalSetBase.

QString QtxEvalSet::name ( ) const
pure virtual

Should be redefined in the successor classes.

Returns
operations set name

Implemented in QtxEvalSetConst, QtxEvalSetSets, QtxEvalSetString, QtxEvalSetMath, QtxEvalSetLogic, and QtxEvalSetArithmetic.

void QtxEvalSet::operationList ( QStringList &  list) const
pure virtual
Parameters
listreturning list of operations supported by the class

Implemented in QtxEvalSetConst, and QtxEvalSetBase.

int QtxEvalSet::priority ( const QString &  op,
bool  isBin 
) const
pure virtual

Operation priority counts from 1. If the operation is impossible, this function should return value <= 0.

Parameters
opoperation
isBintrue if the operation is binary and false if it is unary
Returns
operation priority

Implemented in QtxEvalSetConst, QtxEvalSetSets, QtxEvalSetString, QtxEvalSetMath, QtxEvalSetLogic, and QtxEvalSetArithmetic.


The documentation for this class was generated from the following files: