00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <vaucanson/config/system.hh>
00019
00020 #if not defined (VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_XML_EXP_VISITOR_HH) and \
00021 (not defined (VCSN_SANITY_CHECK) or defined (VCSN_USE_XML))
00022 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_XML_EXP_VISITOR_HH
00023
00024 # ifndef VCSN_USE_XML
00025 # error Vaucanson XML support is disabled.
00026 # endif
00027
00036 # include <xercesc/dom/DOM.hpp>
00037 # include <xercesc/util/XMLString.hpp>
00038 # include <xercesc/util/PlatformUtils.hpp>
00039 # include <vaucanson/tools/usual_macros.hh>
00040 # include <string>
00041 # include <cstddef>
00042
00043 # include <vaucanson/algebra/implementation/series/rat/nodes.hh>
00044
00045 namespace vcsn {
00046
00047 namespace rat {
00048
00049 template<typename M_, typename W_>
00050 class XmlExpVisitor : public ConstNodeVisitor<M_, W_>
00051 {
00052 protected:
00053 void
00054 sum_or_product(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
00055 void
00056 weight_or_star(const Node<M_, W_>* node);
00057
00058 public:
00059 XmlExpVisitor(xercesc::DOMDocument* doc, char* node_name) :
00060 doc_(doc),
00061 label_(doc_->createElement(STR2XML(node_name))),
00062 current_(label_)
00063 {}
00064
00065 virtual void
00066 product(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
00067
00068 virtual void
00069 sum(const Node<M_, W_>* left_, const Node<M_, W_>* right_);
00070
00071 virtual void
00072 star(const Node<M_, W_>* node);
00073
00074 virtual void
00075 left_weight(const W_&, const Node<M_, W_>* node);
00076
00077 virtual void
00078 right_weight(const W_&, const Node<M_, W_>* node);
00079
00080 virtual void
00081 constant(const M_& m);
00082
00083 virtual void zero();
00084
00085 virtual void one();
00086
00087 xercesc::DOMElement* get() const;
00088
00089 xercesc::DOMDocument* set(xercesc::DOMDocument* v)
00090 {
00091 this->doc_ = v;
00092 return this->doc_;
00093 }
00094
00095 protected:
00096 xercesc::DOMDocument* doc_;
00097 xercesc::DOMElement* label_;
00098 xercesc::DOMElement* current_;
00099 };
00100
00101 }
00102
00103 }
00104
00105 # ifndef VCSN_USE_INTERFACE_ONLY
00106 # include <vaucanson/algebra/implementation/series/rat/xml_exp_visitor.hxx>
00107 # endif // VCSN_USE_INTERFACE_ONLY
00108
00109 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_XML_EXP_VISITOR_HH &&
00110
00111