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