Version: 6.3.1
Public Member Functions

QtxEvalSet Class Reference

Generic class for all the operations sets used in expressions.

#include <QtxEvalExpr.h>

Inheritance diagram for QtxEvalSet:
Inheritance graph

Public Member Functions

 QtxEvalSet ()
 Constructor.
virtual ~QtxEvalSet ()
 Destructor.
virtual QString name () const =0
 Get unique operations set name.
virtual void operationList (QStringList &) const =0
 Get the list of possible operations.
virtual void bracketsList (QStringList &, bool open) const =0
 Get list of brackets.
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 isValid (const QString &, const QVariant::Type, const QVariant::Type) const =0
 Check operation validity.
virtual QtxEvalExpr::Error calculate (const QString &, QVariant &, QVariant &) const =0
 Calculate the operation.

Constructor & Destructor Documentation

QtxEvalSet::QtxEvalSet ( )
QtxEvalSet::~QtxEvalSet ( ) [virtual]

Member Function Documentation

QString QtxEvalSet::name ( ) const [pure virtual]

Should be redefined in the successor classes.

Returns:
operations set name

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

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

Implemented in QtxEvalSetBase, and QtxEvalSetConst.

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 QtxEvalSetBase, QtxEvalSetSets, and QtxEvalSetConst.

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 QtxEvalSetArithmetic, QtxEvalSetLogic, QtxEvalSetMath, QtxEvalSetString, and QtxEvalSetConst.

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 QtxEvalSetArithmetic, QtxEvalSetLogic, QtxEvalSetMath, QtxEvalSetString, QtxEvalSetSets, and QtxEvalSetConst.

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 QtxEvalSetBase, QtxEvalSetSets, and QtxEvalSetConst.

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 QtxEvalSetArithmetic, QtxEvalSetLogic, QtxEvalSetMath, QtxEvalSetString, QtxEvalSetSets, and QtxEvalSetConst.

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS