Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/kernel.git] / src / ModuleCatalog / SALOME_ModuleCatalog_Handler.hxx
1 //  SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : SALOME_ModuleCatalog_Handler.hxx
25 //  Author : Estelle Deville
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef SALOME_CATALOG_HANDLER_H
30 #define SALOME_CATALOG_HANDLER_H
31
32 #include "SALOME_ModuleCatalog_Parser.hxx"
33 #include <qxml.h>
34 #include <string>
35 #include <stack>
36 #include <map>
37
38 #if defined MODULECATALOG_EXPORTS
39 #if defined WIN32
40 #define MODULECATALOG_EXPORT __declspec( dllexport )
41 #else
42 #define MODULECATALOG_EXPORT
43 #endif
44 #else
45 #if defined WNT
46 #define MODULECATALOG_EXPORT __declspec( dllimport )
47 #else
48 #define MODULECATALOG_EXPORT
49 #endif
50 #endif
51
52 class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler : public QXmlDefaultHandler 
53 {
54 public:
55   //! standard constructor
56   SALOME_ModuleCatalog_Handler();
57
58   //! standard destructor
59   virtual ~SALOME_ModuleCatalog_Handler();
60
61
62   //! method to overload handler function startDocument
63   /*! Is called before a xml file is parsed
64    \return true if no error was detected
65   */ 
66   virtual bool startDocument();
67
68
69   //! method to overload handler function startElement
70   /*! 
71    \param QString argument by value
72    \param QString argument by value
73    \param QString argument by value
74    \param QXmlAttributes argument by value
75    \return true if no error was detected
76   */
77   virtual bool startElement(const QString&, const QString &,
78                             const QString& qName, const QXmlAttributes& atts); 
79
80   //! method to overload handler function endElement
81   /*!
82    \param QString argument by value
83    \param QString argument by value
84    \param QString argument by value
85    \return true if no error was detected
86    \sa _Find
87   */   
88   virtual bool endElement(const QString&, const QString &,
89                           const QString& qName);
90   
91
92   //! method to overload handler function characters
93   /*!
94    \param QString argument by value
95    \return true if no error was detected
96   */
97   virtual bool characters(const QString& chars);
98   
99   //! method to overload handler function endDocument
100   /*! Is called at the end of the parsing
101    \return true if no error was detected
102   */
103   virtual bool endDocument();
104
105   //! method to overload handler function errorProtocol
106  /*!
107    \return the error message
108   */
109   virtual QString errorProtocol();
110
111   //! method to overload handler function fatalError
112   /*!
113     \param QXmlParseExecption argument by value
114     \return true if no error was detected
115   */
116   virtual bool fatalError(const QXmlParseException& exception);
117  
118 private:
119   QString errorProt ;
120
121   std::string content;
122
123   QString test_path_prefix_name ;
124   QString test_computer_name ;
125   QString test_path_prefix ;
126
127   QString test_component_name;
128   QString test_component_username;
129   QString test_component_type ;
130   QString test_component_multistudy ;
131   QString test_component_icon ;
132   QString test_component_impltype;
133   QString test_component_version;
134   QString test_component_comment;
135
136   QString test_interface_name;
137
138   QString test_service_name;
139   QString test_defaultservice;
140   QString test_typeofnode;
141
142   QString test_inParameter_type;
143   QString test_inParameter_name;
144   QString test_inParameter;
145   QString test_inParameter_list;
146
147   QString test_outParameter_type;
148   QString test_outParameter_name;
149   QString test_outParameter;
150   QString test_outParameter_list;
151
152   QString test_inDataStreamParameter_type;
153   QString test_inDataStreamParameter_name;
154   QString test_inDataStreamParameter_dependency;
155   QString test_inDataStreamParameter;
156   QString test_inDataStreamParameter_list;
157
158   QString test_outDataStreamParameter_type;
159   QString test_outDataStreamParameter_name;
160   QString test_outDataStreamParameter_dependency;
161   QString test_outDataStreamParameter;
162   QString test_outDataStreamParameter_list;
163
164   QString test_service;
165   QString test_service_list;
166   QString test_interface_list;
167   QString test_constraint;
168   
169   QString test_component;
170
171   ParserPathPrefix _pathPrefix;
172
173   ParserComponent _aModule;
174
175
176   ParserInterfaces _interfaceList;
177   ParserInterface  _aInterface;
178
179   ParserServices   _serviceList;
180   ParserService    _aService;
181
182   ParserParameters _inParamList;
183   ParserParameter  _inParam;
184
185   ParserParameters _outParamList;
186   ParserParameter  _outParam;
187
188   ParserDataStreamParameters _inDataStreamParamList;
189   ParserDataStreamParameter  _inDataStreamParam;
190
191   ParserDataStreamParameters _outDataStreamParamList;
192   ParserDataStreamParameter  _outDataStreamParam;
193
194   std::stack<QString> _xml_pile;
195 };
196
197 #endif // SALOME_CATALOG_HANDLER_H