Salome HOME
NRI : Merge from V1_2.
[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     SUPERV::ListOfStrings aPythonFunction ;
58     GraphBase::SLink aLink ;
59 //    SALOME_SuperVisionBase::ServicesParameterValue aLinkValue ;
60     CORBA::Any aLinkValue ;
61     int X ;
62     int Y ;
63     int VXSize ;
64     vector<int > VX ;
65     vector<int > VY ;
66     QString     errorProt;
67
68     GraphBase::SGraph aDataFlow ;
69
70   public:
71
72     XmlHandler();
73     XmlHandler( CORBA::ORB_ptr Orb , const bool aConstructor );
74     virtual ~XmlHandler();
75
76     GraphBase::SGraph & GetDataFlow() {
77            return aDataFlow ; } ;
78
79     // return the error protocol if parsing failed
80     QString errorProtocol();
81   
82     // overloaded handler functions
83     bool startDocument();
84     bool startElement( const QString& namespaceURI, const QString& localName, 
85                        const QString& qName, const QXmlAttributes& atts );
86     bool endElement( const QString& namespaceURI, const QString& localName,
87                      const QString& qName );
88     bool characters( const QString& ch );
89   
90     QString errorString();
91   
92     bool fatalError   (const QXmlParseException& exception);
93
94     SUPERV::SDate StringToDate( QString& qstrDate) const; 
95
96     const long getdepth() const { return depth ; } ;
97     const string getfieldname( const long adepth ) const { return fieldname[adepth] ; } ;
98     const string getfieldvalue( const long adepth ) const { return fieldvalue[adepth] ; } ;
99
100   };
101
102 } ;
103