00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef VCSN_XML_CONTEXTS_RW_HH
00019 # define VCSN_XML_CONTEXTS_RW_HH
00020
00031 # include <string>
00032
00033 # include <xercesc/sax2/Attributes.hpp>
00034 # include <xercesc/util/XMLString.hpp>
00035
00036 # include <vaucanson/xml/handlers_base.hh>
00037 # include <vaucanson/xml/builders.hh>
00038 # include <vaucanson/xml/regexp.hh>
00039 # include <vaucanson/xml/xml_exp_visitor.hh>
00040
00041 # include <vaucanson/automata/concept/transducer.hh>
00042 # include <vaucanson/algebra/implementation/series/series.hh>
00043
00044 # define TRANStype \
00045 Element<Transducer<S>, T>
00046
00047 # define TRANSseries \
00048 Element<vcsn::algebra::Series<vcsn::algebra::Series<R, S>, T>, U>
00049
00050 # define SParamTRANS \
00051 template <typename R, typename S, typename T, typename U>
00052
00053 # define TRANSsemiring \
00054 vcsn::algebra::Series<S, T>
00055
00056 namespace vcsn
00057 {
00058 namespace xml
00059 {
00063 template <typename T>
00064 class SeriesSemiringHandler : public Handler
00065 {
00066 public:
00067 SeriesSemiringHandler (xercesc::SAX2XMLReader* parser,
00068 Handler& root,
00069 T& semiring);
00070
00071 void
00072 start (const XMLCh* const uri,
00073 const XMLCh* const localname,
00074 const XMLCh* const qname,
00075 const xercesc::Attributes& attrs);
00076 void
00077 end (const XMLCh* const uri,
00078 const XMLCh* const localname,
00079 const XMLCh* const qname);
00080 private:
00081 T& semiring_;
00082 Handler* ssemiringh_;
00083 Handler* monoidh_;
00084 UnsupHandler unsuph_;
00085 };
00086
00087 SParamTRANS
00088 class WeightHandler<TRANSseries > : public RegexpHandler<TRANSseries >
00089 {
00090 public:
00091 WeightHandler (xercesc::SAX2XMLReader* parser,
00092 Handler& root,
00093 TRANSseries param);
00094
00095 void
00096 start (const XMLCh* const uri,
00097 const XMLCh* const localname,
00098 const XMLCh* const qname,
00099 const xercesc::Attributes& attrs);
00100 void
00101 end (const XMLCh* const uri,
00102 const XMLCh* const localname,
00103 const XMLCh* const qname);
00104
00105 protected:
00106 typedef typename TRANSseries::set_t::semiring_t series_set_t;
00107 typedef typename TRANSseries::value_t::semiring_elt_value_t series_set_elt_value_t;
00108 typedef vcsn::Element<series_set_t, series_set_elt_value_t> series_set_elt_t;
00109
00110 RegexpHandler<series_set_elt_t>*
00111 create_weighth(const XMLCh* const localname);
00112
00113 RegexpHandler<series_set_elt_t>* weighth_;
00114 };
00115
00116 namespace builders
00117 {
00118 template <typename S, typename T>
00119 typename TRANStype::semiring_t*
00120 create_semiring (TRANStype&,
00121 const XMLCh* const localname,
00122 const xercesc::Attributes& attrs);
00123
00124 template <typename S, typename T>
00125 Handler*
00126 create_semiringh(TRANSsemiring& semiring,
00127 const xercesc::Attributes& attrs,
00128 xercesc::SAX2XMLReader* parser,
00129 Handler& root);
00130
00131 }
00132
00133 namespace builders
00134 {
00135 SParamTRANS
00136 RegexpHandler<TRANSseries >*
00137 create_weighth(xercesc::SAX2XMLReader* parser,
00138 RegexpHandler<TRANSseries >& root,
00139 TRANSseries param,
00140 const xercesc::Attributes& attrs);
00141 }
00145 namespace builders
00146 {
00147 template <typename S, typename T>
00148 const char* get_semiring_operations(const vcsn::algebra::Series<S, T>&);
00149 }
00150
00151 namespace builders
00152 {
00153 template <typename S, typename T>
00154 void
00155 create_semiring_node(const TRANStype&,
00156 xercesc::DOMDocument* doc,
00157 xercesc::DOMElement* root);
00158 }
00159 }
00160 }
00161
00162 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00163 # include <vaucanson/xml/contexts/rw.hxx>
00164 # endif // VCSN_USE_INTERFACE_ONLY || !VCSN_USE_LIB
00165
00166 # undef TRANStype
00167 # undef TRANSseries
00168 # undef SParamTRANS
00169 # undef TRANSsemiring
00170
00171 #endif // !VCSN_XML_CONTEXTS_RW_HH