Version: 6.3.1
Public Member Functions | Protected Types | Protected Member Functions | Private Attributes

QtxEvalSetBase Class Reference

Generic class. Provides functionality for standard operations sets.

#include <QtxEvalExpr.h>

Inheritance diagram for QtxEvalSetBase:
Inheritance graph

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

typedef QList<QVariant::Type> QtxEvalSetBase.ListOfTypes [protected]

Constructor & Destructor Documentation

QtxEvalSetBase::QtxEvalSetBase ( )
QtxEvalSetBase::~QtxEvalSetBase ( ) [virtual]

Member Function Documentation

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

Implements QtxEvalSet.

References myOpers.

void QtxEvalSetBase::bracketsList ( QStringList &  list,
bool  open 
) const [virtual]
Parameters:
listreturning list of brackets
openif 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]

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)

Implements QtxEvalSet.

Reimplemented in QtxEvalSetSets.

References QtxEvalExpr.InvalidOperation, myTypes, QtxEvalExpr.OK, QtxEvalExpr.OperandsNotMatch, and QtxEvalSet.priority().

void QtxEvalSetBase::addTypes ( const ListOfTypes list) [protected]
Parameters:
listoperand types to be added

References myTypes.

void QtxEvalSetBase::addOperations ( const QStringList &  list) [protected]
Parameters:
listoperations to be added

References myOpers.

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

Should be redefined in the successor classes.

Returns:
operations set name

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

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:
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, inherited]

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::calculate ( const QString &  op,
QVariant &  v1,
QVariant &  v2 
) const [pure virtual, inherited]

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.


Field Documentation

QStringList QtxEvalSetBase.myOpers [private]
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