Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/superv.git] / src / GraphBase / DataFlowBase_XmlHandler.hxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : GraphBase_XmlHandler.hxx
25 //  Author : Arnaud RES
26 //  Module : SUPERV
27 //  $Header$
28
29 #define  INCLUDE_MENUITEM_DEF 
30 #define QT_ALTERNATE_QTSMANIP
31
32 #include "DataFlowBase_Graph.hxx"
33
34 #include <qxml.h>
35 #include <qstringlist.h>
36 #include <qaction.h>
37 #include <qlist.h>
38
39 //#include <SALOMEconfig.h>
40 //#include CORBA_CLIENT_HEADER(SALOME_SuperVision)
41
42
43 #define maxlevel 7
44
45 namespace GraphBase {
46
47   class XmlHandler : public QXmlDefaultHandler {
48
49     CORBA::ORB_ptr _Orb ;
50     bool dataflowxml ;
51     string fieldname[maxlevel] ;
52     string fieldvalue[maxlevel] ;
53     long step[maxlevel] ;
54     long depth ;
55     bool constructor ;
56     GraphBase::SNode aNode ;
57     SALOME_ModuleCatalog::ServicesParameter aParameter ;
58     GraphBase::InDataStreamParameter anInDataStreamParameter ;
59     GraphBase::OutDataStreamParameter anOutDataStreamParameter ;
60 //    SALOME_ModuleCatalog::ServicesDataStreamParameter aDataStreamParameter ;
61     SUPERV::ListOfStrings aPythonFunction ;
62     GraphBase::SLink aLink ;
63 //    SALOME_SuperVisionBase::ServicesParameterValue aLinkValue ;
64     CORBA::Any aLinkValue ;
65     CORBA::Any const *aLinkDoubleValue ;
66     int X ;
67     int Y ;
68     int VXSize ;
69     vector<int > VX ;
70     vector<int > VY ;
71     QString     errorProt;
72
73     int GraphsNumber ;
74     GraphBase::ListOfSGraphs aListOfDataFlows ;
75
76   public:
77
78     XmlHandler();
79     XmlHandler( CORBA::ORB_ptr Orb , const bool aConstructor );
80     virtual ~XmlHandler();
81
82     GraphBase::ListOfSGraphs & ListOfDataFlows() {
83                                return aListOfDataFlows ; } ;
84
85     // return the error protocol if parsing failed
86     QString errorProtocol();
87   
88     // overloaded handler functions
89     bool startDocument() ;
90     bool endDocument() ;
91     bool startElement( const QString& namespaceURI, const QString& localName, 
92                        const QString& qName, const QXmlAttributes& atts ) ;
93     bool endElement( const QString& namespaceURI, const QString& localName,
94                      const QString& qName ) ;
95     bool characters( const QString& ch ) ;
96   
97     QString errorString();
98   
99     bool fatalError( const QXmlParseException& exception);
100
101     SUPERV::SDate StringToDate( QString& qstrDate) const; 
102
103     const long getdepth() const { return depth ; } ;
104     const string getfieldname( const long adepth ) const { return fieldname[adepth] ; } ;
105     const string getfieldvalue( const long adepth ) const { return fieldvalue[adepth] ; } ;
106
107   };
108
109 } ;
110