Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/gui.git] / src / Qtx / QtxListOfOperations.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/ or email : webmaster.salome@opencascade.com
18 //
19 // File:      QtxListOfOperations.h
20 // Author:    Alexander SOLOVYOV
21
22 #ifndef __QTX_LIST_OF_OPERATIONS_HEADER__
23 #define __QTX_LIST_OF_OPERATIONS_HEADER__
24
25 #include "Qtx.h"
26 #include "QtxOperations.h"
27
28 #ifdef WIN32
29 #pragma warning( disable:4251 )
30 #endif
31
32
33 /*!
34   Class: QtxListOfOperations
35
36   This class provides special variant of QtxOperations. It contains list of QtxOperations* with 
37   fixed order. When it is necessary to calculate operation or get it's priority, this operation is
38   being found starting from first item. It makes possible to create unions of operations. Every QtxOperations*
39   has priority, which is added to priority of operation, so that it makes possible to increase priority of
40   whole group of operations
41 */
42 class QTX_EXPORT QtxListOfOperations : public QtxOperations
43 {
44 public:
45     QtxListOfOperations();
46     virtual ~QtxListOfOperations();
47
48     virtual void  opersList( QStringList& ) const;
49     virtual void  bracketsList( QStringList&, bool open ) const;
50
51     virtual bool  createValue( const QString&, QtxValue& ) const;
52     virtual int   prior    ( const QString&, bool isBin ) const;
53     virtual QtxParser::Error isValid( const QString&,
54                                       const QVariant::Type,
55                                       const QVariant::Type ) const;
56     virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
57
58     void clear  ();
59     bool has    ( const QString& ) const;
60     void append ( const QString&, QtxOperations*, int prior );
61     void prepend( const QString&, QtxOperations*, int prior );
62     void insert ( const QString&, QtxOperations*, int prior, int pos = -1 );
63     void remove ( const QString& );
64     int  count  () const;
65     QtxOperations* operations( const QString& ) const;
66
67 private:
68     typedef struct
69     {
70         QString        myName;
71         QtxOperations* myOperations;
72         int            myAddPrior;
73
74     } OperationSet;
75
76     typedef QValueList< OperationSet >     OperationSets;
77     typedef OperationSets::const_iterator  OperationSetsIterator;
78
79     OperationSets mySets;
80 };
81
82 #endif