Salome HOME
Copyrights update
[modules/gui.git] / src / Qtx / QtxStdOperations.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:      QtxStdOperations.h
20 // Author:    Alexander SOLOVYOV
21
22 #ifndef __QTX_STD_OPERATIONS_HEADER__
23 #define __QTX_STD_OPERATIONS_HEADER__
24
25 #include "Qtx.h"
26 #include "QtxOperations.h"
27
28 //================================================================
29 // Class    : 
30 // Purpose  : 
31 //================================================================
32 class QTX_EXPORT QtxStdOperations : public QtxOperations
33 {
34 public:
35     QtxStdOperations();
36     virtual ~QtxStdOperations();
37
38     virtual void opersList( QStringList& ) const;
39     virtual void bracketsList( QStringList&, bool open ) const;
40
41     virtual QtxParser::Error isValid( const QString&,
42                                       const QVariant::Type,
43                                       const QVariant::Type ) const;
44 protected: 
45     typedef QValueList< QVariant::Type > ListOfTypes;
46
47     void addOperations( const QStringList& );
48     void addTypes( const ListOfTypes& );
49
50 private:
51     QStringList myOpers;
52     ListOfTypes myTypes;
53 };
54
55 //================================================================
56 // Class    : 
57 // Purpose  : 
58 //================================================================
59 class QTX_EXPORT QtxArithmetics : public QtxStdOperations
60 {
61 public:
62     QtxArithmetics();
63     virtual ~QtxArithmetics();
64
65     virtual bool  createValue( const QString&, QtxValue& ) const;
66     virtual int   prior( const QString&, bool isBin ) const;
67     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
68 };
69
70 //================================================================
71 // Class    : 
72 // Purpose  : 
73 //================================================================
74 class QTX_EXPORT QtxLogic : public QtxStdOperations
75 {
76 public:
77     QtxLogic();
78     virtual ~QtxLogic();
79
80     virtual bool  createValue( const QString&, QtxValue& ) const;
81     virtual int   prior( const QString&, bool isBin ) const;
82     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
83 };
84
85 //================================================================
86 // Class    : 
87 // Purpose  : 
88 //================================================================
89 class QTX_EXPORT QtxFunctions : public QtxStdOperations
90 {
91 public:
92     QtxFunctions();
93     virtual ~QtxFunctions();
94
95     virtual bool  createValue( const QString&, QtxValue& ) const;
96     virtual int   prior( const QString&, bool isBin ) const;
97     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
98 };
99
100 //================================================================
101 // Class    : 
102 // Purpose  : 
103 //================================================================
104 class QTX_EXPORT QtxStrings : public QtxStdOperations
105 {
106 public:
107     QtxStrings();
108     virtual ~QtxStrings();
109
110     virtual bool  createValue( const QString&, QtxValue& ) const;
111     virtual int   prior( const QString&, bool isBin ) const;
112     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
113 };
114
115 //================================================================
116 // Class    : 
117 // Purpose  : 
118 //================================================================
119 class QTX_EXPORT QtxSets : public QtxStdOperations
120 {
121 public:
122     typedef QValueList< QtxValue > ValueSet;
123
124 public:
125     QtxSets();
126     virtual ~QtxSets();
127
128     virtual void bracketsList( QStringList&, bool open ) const;
129     virtual bool createValue( const QString&, QtxValue& ) const;
130     virtual int  prior( const QString&, bool isBin ) const;
131     virtual QtxParser::Error isValid( const QString&,
132                                       const QVariant::Type,
133                                       const QVariant::Type ) const;
134     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
135
136     static void add( ValueSet&, const QtxValue& );
137     static void add( ValueSet&, const ValueSet& );
138     static void remove( ValueSet&, const QtxValue& );
139     static void remove( ValueSet&, const ValueSet& );
140 };
141
142
143 #endif