Vaucanson  1.4.1
parsers.hh
Go to the documentation of this file.
1 // parsers.hh: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2007, 2008 The Vaucanson Group.
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // The complete GNU General Public Licence Notice can be found as the
13 // `COPYING' file in the root directory.
14 //
15 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
16 //
17 
18 #ifndef VCSN_XML_PARSERS_HH
19 # define VCSN_XML_PARSERS_HH
20 
31 # include <iostream>
32 
33 # include <xercesc/sax2/SAX2XMLReader.hpp>
34 
35 # include <vaucanson/xml/handlers.hh>
36 # include <vaucanson/xml/xmleq.hh>
37 
38 namespace vcsn
39 {
40  namespace xml
41  {
42  /*
43  * Parser class dedicated to parse an FSMXML document.
44  */
45  class Parser
46  {
47  public:
48  Parser (bool check = true);
49  virtual ~Parser ();
50 
51  protected:
52  const std::string&
53  get_xsd_path ();
54 
55  ErrHandler* err_handler_;
57  xercesc::SAX2XMLReader* parser_;
59  XMLEq eq_;
60  };
61 
62  /*
63  * Parser class dedicated to the parse an automaton.
64  */
65  template <typename Auto>
66  class AutParser : public Parser
67  {
68  public:
69  AutParser (Auto& a, bool check = true);
70  virtual ~AutParser ();
71 
72  void
73  parse (std::istream& in);
74 
75  protected:
76  DocAutHandler<Auto>* doc_handler_;
77  Auto& a_;
78  };
79 
80  /*
81  * Parser class dedicated to the parse a rational expression.
82  */
83  template <typename T>
84  class RegExpParser : public Parser
85  {
86  public:
87  RegExpParser (T& r, bool check = true);
88  virtual ~RegExpParser ();
89 
90  void
91  parse (std::istream& in);
92 
93  protected:
94  DocRegExpHandler<T>* doc_handler_;
95  T& r_;
96  };
97  } // !xml
98 } // !vcsn
99 
100 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
101 # include <vaucanson/xml/parsers.hxx>
102 # endif // VCSN_USE_INTERFACE_ONLY
103 
104 #endif // !VCSN_XML_PARSERS_HH