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
00054 # define FMPseries Element<vcsn::algebra::Series<S, vcsn::algebra::FreeMonoidProduct<M1, M2> >, T>
00055 # define SParamFMP template <class S, class T, class M1, class M2>
00056
00057
00058 namespace vcsn
00059 {
00060 namespace xml
00061 {
00065 template <typename T>
00066 class FreeMonoidProductHandler : public Handler
00067 {
00068 public:
00069 FreeMonoidProductHandler (xercesc::SAX2XMLReader* parser,
00070 Handler& root,
00071 T& monoid);
00072
00073 void
00074 start (const XMLCh* const uri,
00075 const XMLCh* const localname,
00076 const XMLCh* const qname,
00077 const xercesc::Attributes& attrs);
00078 void
00079 end (const XMLCh* const uri,
00080 const XMLCh* const localname,
00081 const XMLCh* const qname);
00082 private:
00083 T& monoid_;
00084 Handler* monoidh_;
00085 UnsupHandler unsuph_;
00086
00087 bool first_;
00088 };
00089
00090 namespace builders
00091 {
00092 TParamFMP
00093 typename FMPtype::monoid_t*
00094 create_monoid (FMPtype& aut,
00095 const XMLCh* const localname,
00096 const xercesc::Attributes& attrs);
00097
00098 template <typename M1, typename M2>
00099 Handler*
00100 create_monoidh (vcsn::algebra::FreeMonoidProduct<M1, M2>& monoid,
00101 const xercesc::Attributes& attrs,
00102 xercesc::SAX2XMLReader* parser,
00103 Handler& root);
00104 }
00105
00109 template <typename T>
00110 class ProdMonElmtHandler
00111 : public RegexpHandler<T>
00112 {
00113
00114 using RegexpHandler<T>::eq_;
00115 using RegexpHandler<T>::parser_;
00116 using RegexpHandler<T>::end_;
00117 using RegexpHandler<T>::param_;
00118 using RegexpHandler<T>::root_;
00119
00120 public:
00121 ProdMonElmtHandler (xercesc::SAX2XMLReader* parser,
00122 Handler& root,
00123 T param);
00124
00125 void
00126 start (const XMLCh* const uri,
00127 const XMLCh* const localname,
00128 const XMLCh* const qname,
00129 const xercesc::Attributes& attrs);
00130 void
00131 end (const XMLCh* const uri,
00132 const XMLCh* const localname,
00133 const XMLCh* const qname);
00134 protected:
00135 int in_;
00136 int count_;
00137
00138
00139 typedef typename T::monoid_elt_t::first_monoid_t first_monoid_t;
00140 typedef typename T::monoid_elt_t::second_monoid_t second_monoid_t;
00141 typedef typename T::monoid_elt_t::first_monoid_elt_t first_monoid_elt_t;
00142 typedef typename T::monoid_elt_t::second_monoid_elt_t second_monoid_elt_t;
00143 first_monoid_elt_t m1_;
00144 second_monoid_elt_t m2_;
00145 };
00146
00147 namespace builders
00148 {
00149 SParamFMP
00150 RegexpHandler<FMPseries >*
00151 create_monElmth(xercesc::SAX2XMLReader* parser,
00152 RegexpHandler<FMPseries >& root,
00153 FMPseries param);
00154 }
00155
00159 namespace builders
00160 {
00161 TParamFMP
00162 void
00163 check_monoid_consistency (FMPtype&,
00164 const XMLCh* const localname,
00165 const xercesc::Attributes& attrs);
00166 }
00167
00171 namespace builders
00172 {
00173 TParamFMP
00174 void
00175 create_monoid_node(const FMPtype& aut,
00176 xercesc::DOMDocument* doc,
00177 xercesc::DOMElement* root);
00178 }
00179 }
00180 }
00181
00182 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00183 # include <vaucanson/xml/contexts/fmp.hxx>
00184 # endif // VCSN_USE_INTERFACE_ONLY || !VCSN_USE_LIB
00185
00186 # undef SParamFMP
00187 # undef FMPseries
00188 # undef TParamFMP
00189 # undef FMPtype
00190
00191 #endif // !VCSN_XML_CONTEXTS_FMP_HH