Vaucanson 1.4
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, 2008 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         const 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         DocAutHandler<Auto>*    doc_handler_;
00077         Auto&                   a_;
00078     };
00079 
00080     /*
00081      * Parser class dedicated to the parse a rational expression.
00082      */
00083     template <typename T>
00084     class RegExpParser : public Parser
00085     {
00086       public:
00087         RegExpParser (T& r, bool check = true);
00088         virtual ~RegExpParser ();
00089 
00090         void
00091         parse (std::istream& in);
00092 
00093       protected:
00094         DocRegExpHandler<T>*    doc_handler_;
00095         T&                      r_;
00096     };
00097   } // !xml
00098 } // !vcsn
00099 
00100 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00101 # include <vaucanson/xml/parsers.hxx>
00102 # endif // VCSN_USE_INTERFACE_ONLY
00103 
00104 #endif // !VCSN_XML_PARSERS_HH