00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef VCSN_XML_REGEXP_HH
00019 # define VCSN_XML_REGEXP_HH
00020
00031 # include <map>
00032 # include <string>
00033
00034 # include <xercesc/sax2/SAX2XMLReader.hpp>
00035 # include <xercesc/sax2/XMLReaderFactory.hpp>
00036 # include <xercesc/sax2/DefaultHandler.hpp>
00037 # include <xercesc/sax2/Attributes.hpp>
00038
00039 # include <xercesc/sax/SAXException.hpp>
00040 # include <xercesc/util/XMLString.hpp>
00041
00042 # include <vaucanson/xml/xmleq.hh>
00043 # include <vaucanson/xml/strings.hh>
00044 # include <vaucanson/xml/handlers_base.hh>
00045 # include <vaucanson/xml/builders.hh>
00046
00047 namespace vcsn
00048 {
00049 namespace xml
00050 {
00054 template <typename T>
00055 class RegexpHandler : public Handler
00056 {
00057 public:
00058 RegexpHandler (xercesc::SAX2XMLReader* parser,
00059 Handler& root,
00060 T param);
00061 RegexpHandler (xercesc::SAX2XMLReader* parser,
00062 Handler& root,
00063 T param,
00064 XMLCh* end);
00065 virtual ~RegexpHandler ();
00066
00067 void
00068 start (const XMLCh* const uri,
00069 const XMLCh* const localname,
00070 const XMLCh* const qname,
00071 const xercesc::Attributes& attrs);
00072 void
00073 end (const XMLCh* const uri,
00074 const XMLCh* const localname,
00075 const XMLCh* const qname);
00076
00077 T& series();
00078
00079
00080 RegexpHandler<T>*
00081 create (const XMLCh* const localname);
00082
00083 protected:
00084 RegexpHandler<T>*
00085 create_weight (const xercesc::Attributes& attrs);
00086
00087 XMLCh* end_;
00088
00089 T param_;
00090
00091 RegexpHandler<T>* lefth_;
00092 };
00096 template <typename T>
00097 class WeightHandler : public RegexpHandler<T>
00098 {
00099
00100 using RegexpHandler<T>::parser_;
00101 using RegexpHandler<T>::eq_;
00102 using RegexpHandler<T>::root_;
00103 using RegexpHandler<T>::end_;
00104
00105 public:
00106 WeightHandler (xercesc::SAX2XMLReader* parser,
00107 Handler& root,
00108 T param);
00109
00110 void
00111 start (const XMLCh* const uri,
00112 const XMLCh* const localname,
00113 const XMLCh* const qname,
00114 const xercesc::Attributes& attrs);
00115 void
00116 end (const XMLCh* const uri,
00117 const XMLCh* const localname,
00118 const XMLCh* const qname);
00119 };
00123 template <typename T>
00124 class ExtMulHandler : public RegexpHandler<T>
00125 {
00126
00127 using RegexpHandler<T>::parser_;
00128 using RegexpHandler<T>::eq_;
00129 using RegexpHandler<T>::root_;
00130 using RegexpHandler<T>::end_;
00131 using RegexpHandler<T>::param_;
00132 using RegexpHandler<T>::lefth_;
00133 using RegexpHandler<T>::create_weight;
00134 using RegexpHandler<T>::create;
00135
00136 public:
00137 ExtMulHandler (xercesc::SAX2XMLReader* parser,
00138 Handler& root,
00139 T param,
00140 bool left);
00141 virtual ~ExtMulHandler();
00142
00143 void
00144 start (const XMLCh* const uri,
00145 const XMLCh* const localname,
00146 const XMLCh* const qname,
00147 const xercesc::Attributes& attrs);
00148 void
00149 end (const XMLCh* const uri,
00150 const XMLCh* const localname,
00151 const XMLCh* const qname);
00152 private:
00153 bool left_;
00154 RegexpHandler<T>* righth_;
00155 };
00159 template <typename T>
00160 class StarHandler : public RegexpHandler<T>
00161 {
00162
00163 using RegexpHandler<T>::parser_;
00164 using RegexpHandler<T>::eq_;
00165 using RegexpHandler<T>::root_;
00166 using RegexpHandler<T>::end_;
00167 using RegexpHandler<T>::param_;
00168 using RegexpHandler<T>::lefth_;
00169 using RegexpHandler<T>::create;
00170
00171 public:
00172 StarHandler (xercesc::SAX2XMLReader* parser,
00173 Handler& root,
00174 T param);
00175
00176 void
00177 start (const XMLCh* const uri,
00178 const XMLCh* const localname,
00179 const XMLCh* const qname,
00180 const xercesc::Attributes& attrs);
00181 void
00182 end (const XMLCh* const uri,
00183 const XMLCh* const localname,
00184 const XMLCh* const qname);
00185 private:
00186 int in_;
00187 };
00191 template <typename T>
00192 class ProductHandler : public RegexpHandler<T>
00193 {
00194
00195 using RegexpHandler<T>::parser_;
00196 using RegexpHandler<T>::eq_;
00197 using RegexpHandler<T>::root_;
00198 using RegexpHandler<T>::end_;
00199 using RegexpHandler<T>::param_;
00200 using RegexpHandler<T>::lefth_;
00201 using RegexpHandler<T>::create;
00202
00203 public:
00204 ProductHandler (xercesc::SAX2XMLReader* parser,
00205 Handler& root,
00206 T param);
00207 virtual ~ProductHandler ();
00208
00209 void
00210 start (const XMLCh* const uri,
00211 const XMLCh* const localname,
00212 const XMLCh* const qname,
00213 const xercesc::Attributes& attrs);
00214 void
00215 end (const XMLCh* const uri,
00216 const XMLCh* const localname,
00217 const XMLCh* const qname);
00218 private:
00219 int in_;
00220 RegexpHandler<T>* righth_;
00221 };
00225 template <typename T>
00226 class SumHandler : public RegexpHandler<T>
00227 {
00228
00229 using RegexpHandler<T>::parser_;
00230 using RegexpHandler<T>::eq_;
00231 using RegexpHandler<T>::root_;
00232 using RegexpHandler<T>::end_;
00233 using RegexpHandler<T>::param_;
00234 using RegexpHandler<T>::lefth_;
00235 using RegexpHandler<T>::create;
00236
00237 public:
00238 SumHandler (xercesc::SAX2XMLReader* parser,
00239 Handler& root,
00240 T param);
00241 virtual ~SumHandler ();
00242
00243 void
00244 start (const XMLCh* const uri,
00245 const XMLCh* const localname,
00246 const XMLCh* const qname,
00247 const xercesc::Attributes& attrs);
00248 void
00249 end (const XMLCh* const uri,
00250 const XMLCh* const localname,
00251 const XMLCh* const qname);
00252 private:
00253 int in_;
00254 RegexpHandler<T>* righth_;
00255 };
00259 template <typename T>
00260 class MonElmtHandler : public RegexpHandler<T>
00261 {
00262
00263 using RegexpHandler<T>::parser_;
00264 using RegexpHandler<T>::eq_;
00265 using RegexpHandler<T>::root_;
00266 using RegexpHandler<T>::end_;
00267 using RegexpHandler<T>::param_;
00268
00269 public:
00270 MonElmtHandler (xercesc::SAX2XMLReader* parser,
00271 Handler& root,
00272 T param);
00273
00274 void
00275 start (const XMLCh* const uri,
00276 const XMLCh* const localname,
00277 const XMLCh* const qname,
00278 const xercesc::Attributes& attrs);
00279 void
00280 end (const XMLCh* const uri,
00281 const XMLCh* const localname,
00282 const XMLCh* const qname);
00283 private:
00284 Handler* mongenh_;
00285 };
00289 template <typename T>
00290 class AtomHandler : public RegexpHandler<T>
00291 {
00292
00293 using RegexpHandler<T>::parser_;
00294 using RegexpHandler<T>::root_;
00295 using RegexpHandler<T>::end_;
00296
00297 public:
00298 AtomHandler (xercesc::SAX2XMLReader* parser,
00299 Handler& root,
00300 T param,
00301 XMLCh* end);
00302 void
00303 start (const XMLCh* const uri,
00304 const XMLCh* const localname,
00305 const XMLCh* const qname,
00306 const xercesc::Attributes& attrs);
00307 void
00308 end (const XMLCh* const uri,
00309 const XMLCh* const localname,
00310 const XMLCh* const qname);
00311 };
00312 }
00313 }
00314
00315 # if ! defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00316 # include <vaucanson/xml/regexp.hxx>
00317 # endif // !VCSN_USE_INTERFACE_ONLY || VCSN_USE_LIB
00318
00319 #endif // !VCSN_XML_REGEXP_HH