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