- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# printers.hh

Go to the documentation of this file.

    00001 // printers.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_PRINTERS_HH
    00019 # define VCSN_XML_PRINTERS_HH
    00020
    00031 # include <vector>
    00032 # include <map>
    00033 # include <iostream>
    00034
    00035 # include <xercesc/dom/DOM.hpp>
    00036 # include <xercesc/util/XMLString.hpp>
    00037 # include <xercesc/util/PlatformUtils.hpp>
    00038
    00039 namespace vcsn
    00040 {
    00041   namespace xml
    00042   {
    00043     /*
    00044      * Printer class dedicated to parse an FSMXML document.
    00045      */
    00046     class Printer
    00047     {
    00048       public:
    00049         Printer ();
    00050         virtual ~Printer () = 0;
    00051     };
    00052
    00053     /*
    00054      * Printer class dedicated to the parse an automaton.
    00055      */
    00056     template <typename Auto>
    00057     class AutPrinter : public Printer
    00058     {
    00059       public:
    00060         AutPrinter (const Auto& aut, const std::string& name = "");
    00061         virtual ~AutPrinter ();
    00062
    00063         void
    00064         print (std::ostream& out);
    00065
    00066       protected:
    00067         typedef typename Auto::hstate_t                 hstate_t;
    00068         typedef typename Auto::htransition_t            htransition_t;
    00069         typedef std::map<hstate_t, std::string>         map_t;
    00070         typedef typename Auto::set_t                    auto_set_t;
    00071         typedef typename Auto::value_t                  auto_impl_t;
    00072         typedef typename Auto::series_set_elt_t         series_set_elt_t;
    00073
    00074         std::string
    00075         create_state(hstate_t s,
    00076                      xercesc::DOMElement* root);
    00077         void
    00078         create_transition(htransition_t e,
    00079                           xercesc::DOMElement* root);
    00080         void
    00081         create_initial(hstate_t s,
    00082                        xercesc::DOMElement* root);
    00083         void
    00084         create_final(hstate_t s,
    00085                      xercesc::DOMElement* root);
    00086
    00087         void
    00088         create_geometry(hstate_t&,
    00089                         xercesc::DOMElement* root);
    00090
    00091         const Auto&                     aut_;
    00092         const std::string&              name_;
    00093
    00094         map_t                   state2str_;
    00095
    00096         xercesc::DOMImplementation*     impl_;
    00097         xercesc::DOMDocument*           doc_;
    00098         xercesc::DOMElement*            root_;
    00099     };
    00100
    00101     /*
    00102      * Printer class dedicated to the parse a rational expression.
    00103      */
    00104     template <typename RE>
    00105     class RegExpPrinter : public Printer
    00106     {
    00107       public:
    00108         RegExpPrinter (const RE& regexp, const std::string& name = "");
    00109         virtual ~RegExpPrinter ();
    00110
    00111         void
    00112         print (std::ostream& out);
    00113
    00114       protected:
    00115         const RE&                       regexp_;
    00116         const std::string&              name_;
    00117
    00118         xercesc::DOMImplementation*     impl_;
    00119         xercesc::DOMDocument*           doc_;
    00120         xercesc::DOMElement*            root_;
    00121     };
    00122   } // !xml
    00123 } // !vcsn
    00124
    00125 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
    00126 # include <vaucanson/xml/printers.hxx>
    00127 # endif // VCSN_USE_INTERFACE_ONLY
    00128
    00129 #endif // !VCSN_XML_PRINTERS_HH