00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef VCSN_XML_BUILDERS_HH
00019 # define VCSN_XML_BUILDERS_HH
00020
00031 # include <string>
00032
00033 # include <xercesc/sax2/Attributes.hpp>
00034 # include <xercesc/util/XMLString.hpp>
00035 # include <xercesc/dom/DOM.hpp>
00036
00037 # include <vaucanson/xml/handlers_base.hh>
00038
00039 namespace vcsn
00040 {
00041 namespace xml
00042 {
00046 template <typename T>
00047 class monGenHandler : public Handler
00048 {
00049 public:
00050 monGenHandler (xercesc::SAX2XMLReader* parser,
00051 Handler& root,
00052 T& monoid,
00053 const XMLCh* value = 0);
00054
00055 void
00056 start (const XMLCh* const uri,
00057 const XMLCh* const localname,
00058 const XMLCh* const qname,
00059 const xercesc::Attributes& attrs);
00060 void
00061 end (const XMLCh* const uri,
00062 const XMLCh* const localname,
00063 const XMLCh* const qname);
00064 private:
00065 T& monoid_;
00066 const XMLCh* value_;
00067 };
00068
00072 template <typename T>
00073 class FreeMonoidHandler : public Handler
00074 {
00075 public:
00076 FreeMonoidHandler (xercesc::SAX2XMLReader* parser,
00077 Handler& root,
00078 T& monoid);
00079
00080 void
00081 start (const XMLCh* const uri,
00082 const XMLCh* const localname,
00083 const XMLCh* const qname,
00084 const xercesc::Attributes& attrs);
00085 void
00086 end (const XMLCh* const uri,
00087 const XMLCh* const localname,
00088 const XMLCh* const qname);
00089 private:
00090 T& monoid_;
00091
00092 Handler* mongenh_;
00093 UnsupHandler unsuph_;
00094 };
00095
00096 namespace builders
00097 {
00098 template <typename T>
00099 typename T::monoid_t*
00100 create_monoid (T&,
00101 const XMLCh* const localname,
00102 const xercesc::Attributes& attrs);
00103
00104 template <typename T>
00105 Handler*
00106 create_monoidh (T& monoid,
00107 const xercesc::Attributes& attrs,
00108 xercesc::SAX2XMLReader* parser,
00109 Handler& root);
00110
00111 template <typename T>
00112 void
00113 insert_generator(T& monoid,
00114 const std::string& str);
00115
00116 }
00117
00121 template <typename T>
00122 class NumSemiringHandler : public Handler
00123 {
00124 public:
00125 NumSemiringHandler (xercesc::SAX2XMLReader* parser,
00126 Handler& root,
00127 T& semiring);
00128
00129 void
00130 start (const XMLCh* const uri,
00131 const XMLCh* const localname,
00132 const XMLCh* const qname,
00133 const xercesc::Attributes& attrs);
00134 void
00135 end (const XMLCh* const uri,
00136 const XMLCh* const localname,
00137 const XMLCh* const qname);
00138 private:
00139 T& semiring_;
00140
00141 UnsupHandler unsuph_;
00142 };
00143
00144 namespace builders
00145 {
00146 template <typename T>
00147 typename T::semiring_t*
00148 create_semiring (T&,
00149 const XMLCh* const localname,
00150 const xercesc::Attributes& attrs);
00151
00152 template <typename T>
00153 Handler*
00154 create_semiringh (T& semiring,
00155 const xercesc::Attributes& attrs,
00156 xercesc::SAX2XMLReader* parser,
00157 Handler& root);
00158
00159 }
00160
00164 template <typename T>
00165 class RegexpHandler;
00166
00167 namespace builders
00168 {
00169
00170 template <typename S, typename T>
00171 RegexpHandler<S>*
00172 create_monElmth(xercesc::SAX2XMLReader* parser,
00173 RegexpHandler<T>& root,
00174 S param);
00175
00176 template <typename T>
00177 RegexpHandler<T>*
00178 create_weight(xercesc::SAX2XMLReader* parser,
00179 RegexpHandler<T>& root,
00180 T param,
00181 const xercesc::Attributes& attrs);
00182 }
00183
00187 namespace builders
00188 {
00189 template <typename T>
00190 void
00191 check_monoid_consistency (T& param,
00192 const XMLCh* const localname,
00193 const xercesc::Attributes& attrs);
00194
00195 template <typename T>
00196 void
00197 check_semiring_consistency (T& param,
00198 const XMLCh* const localname,
00199 const xercesc::Attributes& attrs);
00200 }
00201
00205 namespace builders
00206 {
00207 template <typename T>
00208 void
00209 create_semiring_node(const T& semiring,
00210 xercesc::DOMDocument* doc,
00211 xercesc::DOMElement* root);
00212
00213 template <typename T>
00214 void
00215 create_monoid_node(const T& monoid,
00216 xercesc::DOMDocument* doc,
00217 xercesc::DOMElement* root);
00218
00219 template <typename T>
00220 void
00221 create_regexp_node(const T&,
00222 xercesc::DOMDocument* doc,
00223 xercesc::DOMElement* root);
00224
00225 template <typename T>
00226 void
00227 create_monElmt_node(const T&,
00228 xercesc::DOMDocument* doc,
00229 xercesc::DOMElement* root);
00230
00231 }
00232 }
00233 }
00234
00235 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00236 # include <vaucanson/xml/builders.hxx>
00237 # endif // VCSN_USE_INTERFACE_ONLY || !VCSN_USE_LIB
00238
00239 #endif // !VCSN_XML_BUILDERS_HH