1 // File: QtxOperations.h
2 // Author: Alexander SOLOVYOV
4 #ifndef __QTX_OPERATIONS_HEADER__
5 #define __QTX_OPERATIONS_HEADER__
10 //================================================================
13 //================================================================
14 class QTX_EXPORT QtxOperations
18 virtual ~QtxOperations();
20 virtual void opersList( QStringList& ) const = 0;
21 //list of possible operations
23 virtual void bracketsList( QStringList&, bool open ) const = 0;
24 //list of open/close brackets
26 virtual bool createValue( const QString&, QtxValue& ) const;
27 //by default, the String value will be set, it corresponds to parameter
28 //base method returns false (always parameter)
29 //successor's method returns true if it has created custom value
30 //or call base if it hasn't
32 virtual int prior( const QString&, bool isBin ) const = 0;
33 //returns prioritet of operation;
34 //if operation is impossible, it must return 0 or less
36 virtual QtxParser::Error isValid( const QString&,
38 const QVariant::Type ) const = 0;
39 //return OK if this parameter types is valid for operation
40 //return OperandsNotMatch or InvalidOperation otherwise
42 virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const = 0;
43 //process binary operation with values
44 //for unary operation the second QtxValue will be passed as invalid