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

- File List
- File Members

# xml_exp_visitor.hh

Go to the documentation of this file.

    00001 // xml_exp_visitor.hh: this file is part of the Vaucanson project.
    00002 //
    00003 // Vaucanson, a generic library for finite state machines.
    00004 //
    00005 // Copyright (C) 2006, 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_XML_EXP_VISITOR_HH
    00019 # define VCSN_XML_XML_EXP_VISITOR_HH
    00020
    00029 # include <xercesc/dom/DOM.hpp>
    00030 # include <xercesc/util/XMLString.hpp>
    00031 # include <xercesc/util/PlatformUtils.hpp>
    00032 # include <vaucanson/misc/usual_macros.hh>
    00033 # include <string>
    00034 # include <cstddef>
    00035
    00036 # include <vaucanson/algebra/implementation/series/rat/nodes.hh>
    00037 # include <vaucanson/algebra/implementation/series/rat/exp.hh>
    00038
    00039
    00040 namespace vcsn {
    00041
    00042   namespace rat {
    00043
    00044     template<typename M_, typename W_>
    00045     class XmlExpVisitor : public ConstNodeVisitor<M_, W_>
    00046     {
    00047     public:
    00048       XmlExpVisitor(xercesc::DOMDocument* doc, const char* node_name);
    00049
    00050       virtual void
    00051       product(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
    00052
    00053       virtual void
    00054       sum(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
    00055
    00056       virtual void
    00057       star(const Node<M_, W_>* node);
    00058
    00059       virtual void
    00060       left_weight(const W_&, const Node<M_, W_>* node);
    00061
    00062       virtual void
    00063       right_weight(const W_&, const Node<M_, W_>* node);
    00064
    00065       virtual void
    00066       constant(const M_& m);
    00067
    00068       virtual void zero();
    00069
    00070       virtual void one();
    00071
    00072       xercesc::DOMElement* get() const;
    00073
    00074       xercesc::DOMDocument* set(xercesc::DOMDocument* v);
    00075
    00076     protected:
    00077       void sum_or_product(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
    00078       void weight_or_star(const Node<M_, W_>* node);
    00079       template <typename T>
    00080       void set_weight(const T& w, xercesc::DOMElement* node);
    00081       template <typename S, typename T>
    00082       void set_weight(const rat::exp<S, T>& w, xercesc::DOMElement* node);
    00083
    00084     protected:
    00085       xercesc::DOMDocument*     doc_;
    00086       xercesc::DOMElement*      label_;
    00087       xercesc::DOMElement*      current_;
    00088     };
    00089
    00090   } // rat
    00091
    00092 } // vcsn
    00093
    00094 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
    00095 #  include <vaucanson/xml/xml_exp_visitor.hxx>
    00096 # endif // VCSN_USE_INTERFACE_ONLY
    00097
    00098 #endif // ! VCSN_XML_XML_EXP_VISITOR_HH