Salome HOME
Copyrights update
[modules/gui.git] / src / Qtx / QtxOperations.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
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.
7 // 
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/
18 //
19 // File:      QtxOperations.h
20 // Author:    Alexander SOLOVYOV
21
22 #ifndef __QTX_OPERATIONS_HEADER__
23 #define __QTX_OPERATIONS_HEADER__
24
25 #include "Qtx.h"
26 #include "QtxParser.h"
27
28 //================================================================
29 // Class    : 
30 // Purpose  : 
31 //================================================================
32 class QTX_EXPORT QtxOperations
33 {
34 public:
35     QtxOperations();
36     virtual ~QtxOperations();
37
38     virtual void  opersList( QStringList& ) const = 0;
39     //list of possible operations
40
41     virtual void  bracketsList( QStringList&, bool open ) const = 0;
42     //list of open/close brackets
43
44     virtual bool  createValue( const QString&, QtxValue& ) const;
45     //by default, the String value will be set, it corresponds to parameter
46     //base method returns false (always parameter)
47     //successor's method returns true if it has created custom value
48     //or call base if it hasn't
49
50     virtual int   prior( const QString&, bool isBin ) const = 0;
51     //returns prioritet of operation;
52     //if operation is impossible, it must return 0 or less
53
54     virtual QtxParser::Error isValid( const QString&,
55                                       const QVariant::Type,
56                                       const QVariant::Type ) const = 0;
57     //return OK if this parameter types is valid for operation
58     //return OperandsNotMatch or InvalidOperation otherwise
59
60     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const = 0;
61     //process binary operation with values
62     //for unary operation the second QtxValue will be passed as invalid
63 };
64
65 #endif