xml_chooser.hh

00001 // xml_chooser.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2005, 2006 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 #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   } // !xml
00145 
00146 } // !vcsn
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)

Generated on Fri Jul 28 12:18:56 2006 for Vaucanson by  doxygen 1.4.6