00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef VCSN_XML_CONTEXTS_FMP_HH
00019 # define VCSN_XML_CONTEXTS_FMP_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
00040 # include <vaucanson/automata/concept/automata.hh>
00041 # include <vaucanson/automata/concept/automata_kind.hh>
00042 # include <vaucanson/algebra/implementation/series/series.hh>
00043 # include <vaucanson/algebra/concept/freemonoid_product.hh>
00044
00045 # define FMPtype \
00046 Element< \
00047 Automata< \
00048 vcsn::algebra::Series<S, vcsn::algebra::FreeMonoidProduct<M1, M2> >, \
00049 labels_are_series \
00050 >, \
00051 T>
00052 # define TParamFMP template <class S, class T, class M1, class M2>
00053 # define FMPsreptype algebra::SeriesRep<S, algebra::FreeMonoidProduct<M1, M2> >
00054
00055 # define FMPseries Element<vcsn::algebra::Series<S, vcsn::algebra::FreeMonoidProduct<M1, M2> >, T>
00056 # define SParamFMP template <class S, class T, class M1, class M2>
00057
00058
00059 namespace vcsn
00060 {
00061 namespace xml
00062 {
00066 template <typename T>
00067 class FreeMonoidProductHandler : public Handler
00068 {
00069 public:
00070 FreeMonoidProductHandler (xercesc::SAX2XMLReader* parser,
00071 Handler& root,
00072 T& monoid);
00073
00074 void
00075 start (const XMLCh* const uri,
00076 const XMLCh* const localname,
00077 const XMLCh* const qname,
00078 const xercesc::Attributes& attrs);
00079 void
00080 end (const XMLCh* const uri,
00081 const XMLCh* const localname,
00082 const XMLCh* const qname);
00083 private:
00084 T& monoid_;
00085 Handler* monoidh_;
00086 UnsupHandler unsuph_;
00087
00088 bool first_;
00089 };
00090
00094 template <typename S, typename M1, typename M2>
00095 class SeriesRepresentationHandler<FMPsreptype> : public Handler
00096 {
00097 public:
00098
00099 typedef FMPsreptype srep_t;
00100
00101 SeriesRepresentationHandler(xercesc::SAX2XMLReader* parser,
00102 Handler& root,
00103 srep_t& srep);
00104
00105 void start(const XMLCh* const uri,
00106 const XMLCh* const localname,
00107 const XMLCh* const qname,
00108 const xercesc::Attributes& attrs);
00109
00110 void end(const XMLCh* const uri,
00111 const XMLCh* const localname,
00112 const XMLCh* const qname);
00113
00114 private:
00115 srep_t& rep_;
00116
00117 Handler* reph_;
00118 UnsupHandler unsuph_;
00119 bool first_;
00120 };
00121
00122 namespace builders
00123 {
00124 TParamFMP
00125 typename FMPtype::monoid_t*
00126 create_monoid (FMPtype& aut,
00127 const XMLCh* const localname,
00128 const xercesc::Attributes& attrs,
00129 XMLEq&);
00130
00131 template <typename M1, typename M2>
00132 Handler*
00133 create_monoidh (vcsn::algebra::FreeMonoidProduct<M1, M2>& monoid,
00134 const xercesc::Attributes& attrs,
00135 xercesc::SAX2XMLReader* parser,
00136 Handler& root);
00137 }
00138
00142 template <typename T>
00143 class ProdMonElmtHandler
00144 : public RegexpHandler<T>
00145 {
00146
00147 using RegexpHandler<T>::eq_;
00148 using RegexpHandler<T>::parser_;
00149 using RegexpHandler<T>::end_;
00150 using RegexpHandler<T>::param_;
00151 using RegexpHandler<T>::root_;
00152
00153 public:
00154 ProdMonElmtHandler (xercesc::SAX2XMLReader* parser,
00155 Handler& root,
00156 T param);
00157
00158 void
00159 start (const XMLCh* const uri,
00160 const XMLCh* const localname,
00161 const XMLCh* const qname,
00162 const xercesc::Attributes& attrs);
00163 void
00164 end (const XMLCh* const uri,
00165 const XMLCh* const localname,
00166 const XMLCh* const qname);
00167 protected:
00168 int in_;
00169 int count_;
00170
00171
00172 typedef typename T::monoid_elt_t::first_monoid_t first_monoid_t;
00173 typedef typename T::monoid_elt_t::second_monoid_t second_monoid_t;
00174 typedef typename T::monoid_elt_t::first_monoid_elt_t first_monoid_elt_t;
00175 typedef typename T::monoid_elt_t::second_monoid_elt_t second_monoid_elt_t;
00176 first_monoid_elt_t m1_;
00177 second_monoid_elt_t m2_;
00178 };
00179
00180 namespace builders
00181 {
00182 SParamFMP
00183 RegexpHandler<FMPseries >*
00184 create_monElmth(xercesc::SAX2XMLReader* parser,
00185 RegexpHandler<FMPseries >& root,
00186 FMPseries param);
00187 }
00188
00192 namespace builders
00193 {
00194 TParamFMP
00195 void
00196 check_monoid_consistency (FMPtype&,
00197 const XMLCh* const localname,
00198 const xercesc::Attributes& attrs,
00199 XMLEq&);
00200 }
00201
00205 namespace builders
00206 {
00207 TParamFMP
00208 void
00209 create_type_writingData_node(const FMPtype& aut,
00210 xercesc::DOMDocument* doc,
00211 xercesc::DOMElement* root);
00212
00213 TParamFMP
00214 void
00215 create_monoid_node(const FMPtype& aut,
00216 xercesc::DOMDocument* doc,
00217 xercesc::DOMElement* root);
00218 }
00219 }
00220 }
00221
00222 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00223 # include <vaucanson/xml/contexts/fmp.hxx>
00224 # endif // VCSN_USE_INTERFACE_ONLY || !VCSN_USE_LIB
00225
00226 # undef SParamFMP
00227 # undef FMPseries
00228 # undef TParamFMP
00229 # undef FMPtype
00230
00231 #endif // !VCSN_XML_CONTEXTS_FMP_HH