Version: 9.12.0
QtxEvalSet Class Referenceabstract

Generic class for all the operations sets used in expressions. More...

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

Detailed Description

Generic class for all the operations sets used in expressions.

Constructor & Destructor Documentation

◆ QtxEvalSet()

QtxEvalSet::QtxEvalSet ( )

Constructor.

◆ ~QtxEvalSet()

QtxEvalSet::~QtxEvalSet ( )
virtual

Destructor.

Member Function Documentation

◆ bracketsList()

void QtxEvalSet::bracketsList ( QStringList &  list,
bool  open 
) const
pure virtual

Get list of brackets.

Parameters
listreturning list of brackets
openif true, collect opening brackets, or closing brackets otherwise

Implemented in QtxEvalSetConst, QtxEvalSetSets, and QtxEvalSetBase.

◆ calculate()

QtxEvalExpr::Error QtxEvalSet::calculate ( const QString &  op,
QVariant &  v1,
QVariant &  v2 
) const
pure virtual

Calculate the operation.

Process binary operation with values v1 and v2. For unary operation the \v2 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.

◆ createValue()

bool QtxEvalSet::createValue ( const QString &  str,
QVariant &  val 
) const
virtual

Create value from its string representation.

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.

◆ isValid()

QtxEvalExpr::Error QtxEvalSet::isValid ( const QString &  op,
const QVariant::Type  t1,
const QVariant::Type  t2 
) const
pure virtual

Check operation validity.

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.

◆ name()

QString QtxEvalSet::name ( ) const
pure virtual

Get unique operations set name.

Should be redefined in the successor classes.

Returns
operations set name

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

◆ operationList()

void QtxEvalSet::operationList ( QStringList &  list) const
pure virtual

Get the list of possible operations.

Parameters
listreturning list of operations supported by the class

Implemented in QtxEvalSetConst, and QtxEvalSetBase.

◆ priority()

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

Get the operation priority.

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: