Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members Related Pages

# content_model.h

Go to the documentation of this file.

    00001 /* -*- c++ -*- */
    00002 #ifndef AKAXISO2_CONTENT_MODEL_H__
    00003 #define AKAXISO2_CONTENT_MODEL_H__
    00004
    00010 #include <akaxiso2/configuration.h>
    00011 #include <akaxiso2/framework/entity_complements.h>
    00012 #include <akaxiso2/framework/simpletype.h>
    00013 #include <akaxiso2/framework/any.h>
    00014
    00015 #include <akaxiso2/framework/attribute.h>
    00016 #include <akaxiso2/framework/array.h>
    00017 #include <akaxiso2/framework/sequence.h>
    00018 #include <akaxiso2/framework/choice.h>
    00019 #include <akaxiso2/framework/all.h>
    00020 #include <akaxiso2/framework/simplecontent.h>
    00021 #include <akaxiso2/framework/document.h>
    00022 #include <akaxiso2/framework/document_factory.h>
    00023
    00024 #include <akaxiso2/builtin/builtin_xiso.h>
    00025 #include <akaxiso2/builtin/schema_builtin_xiso.h>
    00026
    00027
    00028 namespace aka2 {
    00029
    00038   template<class L>
    00039   inline void doctype(const std::string &name, const L &l) {
    00040     reset_for_new_document();
    00041     L::initialize();
    00042     system_document_factory().register_document_type(qname(name),
    00043                                                      L::dispatcher_);
    00044   }
    00045
    00053   inline void doctype(const std::string &name) {
    00054     reset_for_new_document();
    00055     system_document_factory().register_document_type(qname(name), wildcard_op::dispatcher_);
    00056   }
    00057
    00067   template<class L>
    00068   inline void doctype(const std::string &name, const L &l, const std::string &fixed_val) {
    00069     reset_for_new_document();
    00070     system_document_factory().register_document_type(qname(name),
    00071                                                      fixed<L>::dispatcher_,
    00072                                                      fixed<L>::create_default_op(),
    00073                                                      fixed_val);
    00074   }
    00075
    00076   bool element_equals(const void *lhs, const void *rhs, const element_op& op);
    00077   void element_construct(const node &nd);
    00078
    00086   template<class T, class L>
    00087   inline bool equals(const T &lhs, const T &rhs, const L &l) {
    00088     return element_equals(&lhs, &rhs, L::dispatcher_);
    00089   }
    00090
    00097   template<class T>
    00098   inline bool equals(const T &lhs, const T &rhs) {
    00099     return element_equals(&lhs, &rhs, xiso::leaf<T>::dispatcher_);
    00100   }
    00101
    00109   template<class T, class L>
    00110   inline void construct_element(T &e, const L &l) {
    00111     element_construct(node(&e, L::dispatcher_));
    00112   }
    00113
    00121   template<class T>
    00122   inline void construct_element(T &e) {
    00123     element_construct(node(&e, xiso::leaf<T>::dispatcher_));
    00124   }
    00125
    00132   template<class T, class L>
    00133   inline void copy_element(T &dest, const T &src, const L &l) {
    00134     L::dispatcher_.copy(&dest, &src);
    00135   }
    00136
    00144   template<class T>
    00145   inline void copy_element(T &dest, const T &src) {
    00146     xiso::leaf<T>::dispatcher_.copy(&dest, &src);
    00147   }
    00148
    00157   template<class T, class L>
    00158   inline T* replicate_element(const T &src, const L &l) {
    00159     void *ret = L::dispatcher_.replicate(&src);
    00160     return static_cast<T*>(ret);
    00161   }
    00162
    00170   template<class T>
    00171   inline T* replicate_element(const T &src) {
    00172     void *ret = xiso::leaf<T>::dispatcher_.replicate(&src);
    00173     return static_cast<T*>(ret);
    00174   }
    00175
    00176 } // namespace aka2
    00177
    00198 #endif
    00199