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_XML_XML_CHOOSER_HH) and \
00021 (not defined (VCSN_SANITY_CHECK) or defined (VCSN_USE_XML))
00022 # define VCSN_XML_XML_CHOOSER_HH
00023
00024 # ifndef VCSN_USE_XML
00025 # error Vaucanson XML support is disabled.
00026 # endif
00027
00038 # include <string>
00039 # include <sstream>
00040 # include <xercesc/dom/DOM.hpp>
00041
00042 # include <vaucanson/design_pattern/element.hh>
00043 # include <vaucanson/boolean_automaton.hh>
00044 # include <vaucanson/z_automaton.hh>
00045 # include <vaucanson/z_max_plus_automaton.hh>
00046 # include <vaucanson/z_min_plus_automaton.hh>
00047 # include <vaucanson/r_automaton.hh>
00048 # include <vaucanson/fmp_transducer.hh>
00049 # include <vaucanson/boolean_transducer.hh>
00050 # include <vaucanson/tools/usual_macros.hh>
00051 # include <vaucanson/xml/tools.hh>
00052
00053
00054 namespace vcsn
00055 {
00056 namespace xml
00057 {
00065 template <class S, class T>
00066 struct xml_chooser_base
00067 {
00068 const char* choose_start_tag();
00069 void create_type_tag(const Element<S, T>&, xercesc::DOMDocument*,
00070 xercesc::DOMElement*);
00071 void create_label(xercesc::DOMDocument*,
00072 htransition_t, const Element<S, T>&,
00073 xercesc::DOMElement*, bool use_label_node);
00074 void create_initial_label(xercesc::DOMDocument*,
00075 hstate_t, const Element<S, T>&,
00076 xercesc::DOMElement*, bool use_label_node);
00077 void create_final_label(xercesc::DOMDocument*,
00078 hstate_t, const Element<S, T>&,
00079 xercesc::DOMElement*, bool use_label_node);
00080 };
00081
00089 template <class S, class T>
00090 struct xml_chooser : xml_chooser_base<S, T>
00091 {};
00092
00100 template <class S, class T>
00101 struct xml_chooser<Automata<S>, T> : xml_chooser_base<Automata<S>, T>
00102 {};
00103
00111 template <class S, class T>
00112 struct xml_chooser<Transducer<S>, T> : xml_chooser_base<Transducer<S>, T>
00113 {
00114 const char* choose_start_tag();
00115 void create_type_tag(const Element<Transducer<S>, T>&,
00116 xercesc::DOMDocument*, xercesc::DOMElement*);
00117 };
00118
00128 # define TParmFMP \
00129 template <class S, class T, class M1, class M2>
00130 # define FMPtype \
00131 Automata< \
00132 vcsn::algebra::Series<S, vcsn::algebra::FreeMonoidProduct<M1, M2> > \
00133 >, T
00134
00135 TParmFMP
00136 struct xml_chooser<FMPtype> : xml_chooser_base<FMPtype>
00137 {
00138 const char* choose_start_tag();
00139 void create_type_tag(const Element<FMPtype>&, xercesc::DOMDocument*,
00140 xercesc::DOMElement*);
00141 };
00142
00143
00144 }
00145
00146 }
00147
00148
00149
00150 # ifndef VCSN_USE_INTERFACE_ONLY
00151 # include <vaucanson/xml/xml_chooser.hxx>
00152 # endif // VCSN_USE_INTERFACE_ONLY
00153
00154
00155 #endif // ! VCSN_XML_XML_CHOOSER_HH && (! VCSN_SANITY_CHECK || VCSN_USE_XML)