Salome HOME
First stable version after merging with V3_2_2
[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.hxx>
33
34 #include "SALOME_ModuleCatalog_Parser.hxx"
35 #include <qxml.h>
36 #include <string>
37 #include <stack>
38 #include <map>
39
40 class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler : public QXmlDefaultHandler 
41 {
42 public:
43   //! standard constructor
44   SALOME_ModuleCatalog_Handler();
45
46   //! standard destructor
47   virtual ~SALOME_ModuleCatalog_Handler();
48
49
50   //! method to overload handler function startDocument
51   /*! Is called before a xml file is parsed
52    \return true if no error was detected
53   */ 
54   virtual bool startDocument();
55
56
57   //! method to overload handler function startElement
58   /*! 
59    \param QString argument by value
60    \param QString argument by value
61    \param QString argument by value
62    \param QXmlAttributes argument by value
63    \return true if no error was detected
64   */
65   virtual bool startElement(const QString&, const QString &,
66                             const QString& qName, const QXmlAttributes& atts); 
67
68   //! method to overload handler function endElement
69   /*!
70    \param QString argument by value
71    \param QString argument by value
72    \param QString argument by value
73    \return true if no error was detected
74    \sa _Find
75   */   
76   virtual bool endElement(const QString&, const QString &,
77                           const QString& qName);
78   
79
80   //! method to overload handler function characters
81   /*!
82    \param QString argument by value
83    \return true if no error was detected
84   */
85   virtual bool characters(const QString& chars);
86   
87   //! method to overload handler function endDocument
88   /*! Is called at the end of the parsing
89    \return true if no error was detected
90   */
91   virtual bool endDocument();
92
93   //! method to overload handler function errorProtocol
94  /*!
95    \return the error message
96   */
97   virtual QString errorProtocol();
98
99   //! method to overload handler function fatalError
100   /*!
101     \param QXmlParseExecption argument by value
102     \return true if no error was detected
103   */
104   virtual bool fatalError(const QXmlParseException& exception);
105  
106 private:
107   QString errorProt ;
108
109   std::string content;
110
111   QString test_path_prefix_name ;
112   QString test_computer_name ;
113   QString test_path_prefix ;
114
115   QString test_component_name;
116   QString test_component_username;
117   QString test_component_type ;
118   QString test_component_multistudy ;
119   QString test_component_icon ;
120   QString test_component_impltype;
121   QString test_component_version;
122   QString test_component_comment;
123
124   QString test_interface_name;
125
126   QString test_service_name;
127   QString test_defaultservice;
128   QString test_typeofnode;
129
130   QString test_inParameter_type;
131   QString test_inParameter_name;
132   QString test_inParameter;
133   QString test_inParameter_list;
134
135   QString test_outParameter_type;
136   QString test_outParameter_name;
137   QString test_outParameter;
138   QString test_outParameter_list;
139
140   QString test_inDataStreamParameter_type;
141   QString test_inDataStreamParameter_name;
142   QString test_inDataStreamParameter_dependency;
143   QString test_inDataStreamParameter;
144   QString test_inDataStreamParameter_list;
145
146   QString test_outDataStreamParameter_type;
147   QString test_outDataStreamParameter_name;
148   QString test_outDataStreamParameter_dependency;
149   QString test_outDataStreamParameter;
150   QString test_outDataStreamParameter_list;
151
152   QString test_service;
153   QString test_service_list;
154   QString test_interface_list;
155   QString test_constraint;
156   
157   QString test_component;
158
159   ParserPathPrefix _pathPrefix;
160
161   ParserComponent _aModule;
162
163
164   ParserInterfaces _interfaceList;
165   ParserInterface  _aInterface;
166
167   ParserServices   _serviceList;
168   ParserService    _aService;
169
170   ParserParameters _inParamList;
171   ParserParameter  _inParam;
172
173   ParserParameters _outParamList;
174   ParserParameter  _outParam;
175
176   ParserDataStreamParameters _inDataStreamParamList;
177   ParserDataStreamParameter  _inDataStreamParam;
178
179   ParserDataStreamParameters _outDataStreamParamList;
180   ParserDataStreamParameter  _outDataStreamParam;
181
182   std::stack<QString> _xml_pile;
183 };
184
185 #endif // SALOME_CATALOG_HANDLER_H