parsers.hh

Go to the documentation of this file.
00001 // parsers.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2007 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 
00018 #ifndef VCSN_XML_PARSERS_HH
00019 # define VCSN_XML_PARSERS_HH
00020 
00031 # include <iostream>
00032 
00033 # include <xercesc/sax2/SAX2XMLReader.hpp>
00034 
00035 # include <vaucanson/xml/handlers.hh>
00036 # include <vaucanson/xml/xmleq.hh>
00037 
00038 namespace vcsn
00039 {
00040   namespace xml
00041   {
00042     /*
00043      * Parser class dedicated to parse an FSMXML document.
00044      */
00045     class Parser
00046     {
00047       public:
00048         Parser (bool check = true);
00049         virtual ~Parser ();
00050 
00051       protected:
00052         std::string
00053         get_xsd_path ();
00054 
00055         ErrHandler*                     err_handler_;
00057         xercesc::SAX2XMLReader*         parser_;
00059         XMLEq                           eq_;
00060     };
00061 
00062     /*
00063      * Parser class dedicated to the parse an automaton.
00064      */
00065     template <typename Auto>
00066     class AutParser : public Parser
00067     {
00068       public:
00069         AutParser (Auto& a, bool check = true);
00070         virtual ~AutParser ();
00071 
00072         void
00073         parse (std::istream& in);
00074 
00075       protected:
00076         AutHandler<Auto>*       doc_handler_;
00077         Auto&                   a_;
00078     };
00079 
00080     /*
00081      * Parser class dedicated to the parse of list of automata.
00082      */
00083     class SessParser : public Parser
00084     {
00085       public:
00086         SessParser (bool check = true);
00087         virtual ~SessParser();
00088 
00089         void
00090         init (std::istream& in);
00091 
00092         template <typename Auto>
00093         bool
00094         operator() (Auto& a);
00095 
00096       private:
00097         bool                          got_more_;
00098         xercesc::XMLPScanToken        token_;
00099     };
00100   } // !xml
00101 } // !vcsn
00102 
00103 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00104 # include <vaucanson/xml/parsers.hxx>
00105 # endif // VCSN_USE_INTERFACE_ONLY
00106 
00107 #endif // !VCSN_XML_PARSERS_HH

Generated on Sun Jul 29 19:35:28 2007 for Vaucanson by  doxygen 1.5.2