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 public:
00112 ProdMonElmtHandler (xercesc::SAX2XMLReader* parser,
00113 Handler& root,
00114 T param);
00115
00116 void
00117 start (const XMLCh* const uri,
00118 const XMLCh* const localname,
00119 const XMLCh* const qname,
00120 const xercesc::Attributes& attrs);
00121 void
00122 end (const XMLCh* const uri,
00123 const XMLCh* const localname,
00124 const XMLCh* const qname);
00125 protected:
00126 int in_;
00127 int count_;
00128
00129
00130 typedef typename T::monoid_elt_t::first_monoid_t first_monoid_t;
00131 typedef typename T::monoid_elt_t::second_monoid_t second_monoid_t;
00132 typedef typename T::monoid_elt_t::first_monoid_elt_t first_monoid_elt_t;
00133 typedef typename T::monoid_elt_t::second_monoid_elt_t second_monoid_elt_t;
00134 first_monoid_elt_t m1_;
00135 second_monoid_elt_t m2_;
00136 };
00137
00138 namespace builders
00139 {
00140 SParamFMP
00141 RegexpHandler<FMPseries >*
00142 create_monElmth(xercesc::SAX2XMLReader* parser,
00143 RegexpHandler<FMPseries >& root,
00144 FMPseries param);
00145 }
00146
00150 namespace builders
00151 {
00152 TParamFMP
00153 void
00154 check_monoid_consistency (FMPtype&,
00155 const XMLCh* const localname,
00156 const xercesc::Attributes& attrs);
00157 }
00158
00162 namespace builders
00163 {
00164 TParamFMP
00165 void
00166 create_monoid_node(const FMPtype& aut,
00167 xercesc::DOMDocument* doc,
00168 xercesc::DOMElement* root);
00169 }
00170 }
00171 }
00172
00173 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00174 # include <vaucanson/xml/contexts/fmp.hxx>
00175 # endif // VCSN_USE_INTERFACE_ONLY || !VCSN_USE_LIB
00176
00177 # undef SParamFMP
00178 # undef FMPseries
00179 # undef TParamFMP
00180 # undef FMPtype
00181
00182 #endif // !VCSN_XML_CONTEXTS_FMP_HH