src/GraphBase/DataFlowBase_XmlHandler.hxx

Go to the documentation of this file.
00001 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
00002 //
00003 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
00005 // 
00006 //  This library is free software; you can redistribute it and/or 
00007 //  modify it under the terms of the GNU Lesser General Public 
00008 //  License as published by the Free Software Foundation; either 
00009 //  version 2.1 of the License. 
00010 // 
00011 //  This library is distributed in the hope that it will be useful, 
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00014 //  Lesser General Public License for more details. 
00015 // 
00016 //  You should have received a copy of the GNU Lesser General Public 
00017 //  License along with this library; if not, write to the Free Software 
00018 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
00019 // 
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 //
00023 //
00024 //  File   : GraphBase_XmlHandler.hxx
00025 //  Author : Arnaud RES
00026 //  Module : SUPERV
00027 //  $Header: /home/server/cvs/SUPERV/SUPERV_SRC/src/GraphBase/DataFlowBase_XmlHandler.hxx,v 1.8 2006/06/01 11:41:44 jfa Exp $
00028 
00029 #define  INCLUDE_MENUITEM_DEF 
00030 #define QT_ALTERNATE_QTSMANIP
00031 
00032 #include "DataFlowBase_Graph.hxx"
00033 
00034 #include <qxml.h>
00035 #include <qstringlist.h>
00036 #include <qaction.h>
00037 #include <qlist.h>
00038 
00039 //#include <SALOMEconfig.h>
00040 //#include CORBA_CLIENT_HEADER(SALOME_SuperVision)
00041 
00042 
00043 #define maxlevel 7
00044 
00045 namespace GraphBase {
00046 
00047   class XmlHandler : public QXmlDefaultHandler {
00048 
00049     CORBA::ORB_ptr _Orb ;
00050     bool dataflowxml ;
00051     string fieldname[maxlevel] ;
00052     string fieldvalue[maxlevel] ;
00053     long step[maxlevel] ;
00054     long depth ;
00055     bool constructor ;
00056     GraphBase::SNode aNode ;
00057     SALOME_ModuleCatalog::ServicesParameter aParameter ;
00058     GraphBase::InDataStreamParameter anInDataStreamParameter ;
00059     GraphBase::OutDataStreamParameter anOutDataStreamParameter ;
00060 //    SALOME_ModuleCatalog::ServicesDataStreamParameter aDataStreamParameter ;
00061     SUPERV::ListOfStrings aPythonFunction ;
00062     GraphBase::SLink aLink ;
00063 //    SALOME_SuperVisionBase::ServicesParameterValue aLinkValue ;
00064     CORBA::Any aLinkValue ;
00065     CORBA::Any const *aLinkDoubleValue ;
00066     int X ;
00067     int Y ;
00068     int VXSize ;
00069     vector<int > VX ;
00070     vector<int > VY ;
00071     QString     errorProt;
00072 
00073     int GraphsNumber ;
00074     GraphBase::ListOfSGraphs aListOfDataFlows ;
00075 
00076   public:
00077 
00078     XmlHandler();
00079     XmlHandler( CORBA::ORB_ptr Orb , const bool aConstructor );
00080     virtual ~XmlHandler();
00081 
00082     GraphBase::ListOfSGraphs & ListOfDataFlows() {
00083                                return aListOfDataFlows ; } ;
00084 
00085     // return the error protocol if parsing failed
00086     QString errorProtocol();
00087   
00088     // overloaded handler functions
00089     bool startDocument() ;
00090     bool endDocument() ;
00091     bool startElement( const QString& namespaceURI, const QString& localName, 
00092                  const QString& qName, const QXmlAttributes& atts ) ;
00093     bool endElement( const QString& namespaceURI, const QString& localName,
00094                      const QString& qName ) ;
00095     bool characters( const QString& ch ) ;
00096   
00097     QString errorString();
00098   
00099     bool fatalError( const QXmlParseException& exception);
00100 
00101     SUPERV::SDate StringToDate( QString& qstrDate) const; 
00102 
00103     const long getdepth() const { return depth ; } ;
00104     const string getfieldname( const long adepth ) const { return fieldname[adepth] ; } ;
00105     const string getfieldvalue( const long adepth ) const { return fieldvalue[adepth] ; } ;
00106 
00107   };
00108 
00109 } ;
00110