1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 // File: QtxOperations.h
20 // Author: Alexander SOLOVYOV
22 #ifndef __QTX_OPERATIONS_HEADER__
23 #define __QTX_OPERATIONS_HEADER__
26 #include "QtxParser.h"
28 class QTX_EXPORT QtxOperations
32 virtual ~QtxOperations();
34 virtual void opersList( QStringList& ) const = 0;
35 //list of possible operations
37 virtual void bracketsList( QStringList&, bool open ) const = 0;
38 //list of open/close brackets
40 virtual bool createValue( const QString&, QtxValue& ) const;
41 //by default, the String value will be set, it corresponds to parameter
42 //base method returns false (always parameter)
43 //successor's method returns true if it has created custom value
44 //or call base if it hasn't
46 virtual int prior( const QString&, bool isBin ) const = 0;
47 //returns prioritet of operation;
48 //if operation is impossible, it must return 0 or less
50 virtual QtxParser::Error isValid( const QString&,
52 const QVariant::Type ) const = 0;
53 //return OK if this parameter types is valid for operation
54 //return OperandsNotMatch or InvalidOperation otherwise
56 virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const = 0;
57 //process binary operation with values
58 //for unary operation the second QtxValue will be passed as invalid