]> SALOME platform Git repositories - modules/gui.git/blob - src/Qtx/QtxStdOperations.h
Salome HOME
27245e95d98bde69c616c3c734824624971a7d17
[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 QtxStdOperations
30   Provides simplified interface for standard operations.
31   Conatins list of operation names, priority and possible types
32 */
33 class QTX_EXPORT QtxStdOperations : public QtxOperations
34 {
35 public:
36     QtxStdOperations();
37     virtual ~QtxStdOperations();
38
39     virtual void opersList( QStringList& ) const;
40     virtual void bracketsList( QStringList&, bool open ) const;
41
42     virtual QtxParser::Error isValid( const QString&,
43                                       const QVariant::Type,
44                                       const QVariant::Type ) const;
45 protected: 
46     typedef QValueList< QVariant::Type > ListOfTypes;
47
48     void addOperations( const QStringList& );
49     void addTypes( const ListOfTypes& );
50
51 private:
52     QStringList myOpers;
53     ListOfTypes myTypes;
54 };
55
56 /*!
57   \class QtxArithmetics
58   Provides set of arithmetic operations for parser
59 */
60 class QTX_EXPORT QtxArithmetics : public QtxStdOperations
61 {
62 public:
63     QtxArithmetics();
64     virtual ~QtxArithmetics();
65
66     virtual bool  createValue( const QString&, QtxValue& ) const;
67     virtual int   prior( const QString&, bool isBin ) const;
68     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
69 };
70
71 /*!
72   \class QtxLogic
73   Provides set of logic operations for parser
74 */
75 class QTX_EXPORT QtxLogic : public QtxStdOperations
76 {
77 public:
78     QtxLogic();
79     virtual ~QtxLogic();
80
81     virtual bool  createValue( const QString&, QtxValue& ) const;
82     virtual int   prior( const QString&, bool isBin ) const;
83     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
84 };
85
86 /*!
87   \class QtxFunctions
88   Provides set of more complex operations for parser (sqrt, sin, cos, etc)
89 */
90 class QTX_EXPORT QtxFunctions : public QtxStdOperations
91 {
92 public:
93     QtxFunctions();
94     virtual ~QtxFunctions();
95
96     virtual bool  createValue( const QString&, QtxValue& ) const;
97     virtual int   prior( const QString&, bool isBin ) const;
98     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
99 };
100
101 /*!
102   \class QtxStrings
103   Provides set of string operations for parser
104 */
105 class QTX_EXPORT QtxStrings : public QtxStdOperations
106 {
107 public:
108     QtxStrings();
109     virtual ~QtxStrings();
110
111     virtual bool  createValue( const QString&, QtxValue& ) const;
112     virtual int   prior( const QString&, bool isBin ) const;
113     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
114 };
115
116 /*!
117   \class QtxSets
118   Provides set of operations with sets for parser
119 */
120 class QTX_EXPORT QtxSets : public QtxStdOperations
121 {
122 public:
123     typedef QValueList< QtxValue > ValueSet;
124
125 public:
126     QtxSets();
127     virtual ~QtxSets();
128
129     virtual void bracketsList( QStringList&, bool open ) const;
130     virtual bool createValue( const QString&, QtxValue& ) const;
131     virtual int  prior( const QString&, bool isBin ) const;
132     virtual QtxParser::Error isValid( const QString&,
133                                       const QVariant::Type,
134                                       const QVariant::Type ) const;
135     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
136
137     static void add( ValueSet&, const QtxValue& );
138     static void add( ValueSet&, const ValueSet& );
139     static void remove( ValueSet&, const QtxValue& );
140     static void remove( ValueSet&, const ValueSet& );
141 };
142
143
144 #endif