Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[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 <qxml.h>
33 #include <qstringlist.h>
34 #include <qaction.h>
35 #include <qlist.h>
36
37 //#include <SALOMEconfig.h>
38 //#include CORBA_CLIENT_HEADER(SALOME_SuperVision)
39
40 #include "DataFlowBase_Graph.hxx"
41
42 #define maxlevel 7
43
44 namespace GraphBase {
45
46   class XmlHandler : public QXmlDefaultHandler {
47
48     CORBA::ORB_ptr _Orb ;
49     bool dataflowxml ;
50     string fieldname[maxlevel] ;
51     string fieldvalue[maxlevel] ;
52     long step[maxlevel] ;
53     long depth ;
54     bool constructor ;
55     GraphBase::SNode aNode ;
56     SALOME_ModuleCatalog::ServicesParameter aParameter ;
57     GraphBase::InDataStreamParameter anInDataStreamParameter ;
58     GraphBase::OutDataStreamParameter anOutDataStreamParameter ;
59 //    SALOME_ModuleCatalog::ServicesDataStreamParameter aDataStreamParameter ;
60     SUPERV::ListOfStrings aPythonFunction ;
61     GraphBase::SLink aLink ;
62 //    SALOME_SuperVisionBase::ServicesParameterValue aLinkValue ;
63     CORBA::Any aLinkValue ;
64     int X ;
65     int Y ;
66     int VXSize ;
67     vector<int > VX ;
68     vector<int > VY ;
69     QString     errorProt;
70
71     GraphBase::SGraph aDataFlow ;
72
73   public:
74
75     XmlHandler();
76     XmlHandler( CORBA::ORB_ptr Orb , const bool aConstructor );
77     virtual ~XmlHandler();
78
79     GraphBase::SGraph & GetDataFlow() {
80            return aDataFlow ; } ;
81
82     // return the error protocol if parsing failed
83     QString errorProtocol();
84   
85     // overloaded handler functions
86     bool startDocument();
87     bool startElement( const QString& namespaceURI, const QString& localName, 
88                        const QString& qName, const QXmlAttributes& atts );
89     bool endElement( const QString& namespaceURI, const QString& localName,
90                      const QString& qName );
91     bool characters( const QString& ch );
92   
93     QString errorString();
94   
95     bool fatalError   (const QXmlParseException& exception);
96
97     SUPERV::SDate StringToDate( QString& qstrDate) const; 
98
99     const long getdepth() const { return depth ; } ;
100     const string getfieldname( const long adepth ) const { return fieldname[adepth] ; } ;
101     const string getfieldvalue( const long adepth ) const { return fieldvalue[adepth] ; } ;
102
103   };
104
105 } ;
106