#ifndef JEZUK_DOM_DOCUMENTTYPE_H #define JEZUK_DOM_DOCUMENTTYPE_H //////////////////////////// // C++ DOM definition // // $Id$ //////////////////////////// #include #include #include namespace Arabica { namespace DOM { template class Document_impl; template class DocumentType_impl; template > class DocumentType : public Node { typedef DocumentType_impl DocumentType_implT; public: typedef Node NodeT; typedef NamedNodeMap NamedNodeMapT; typedef DOMImplementation DOMImplementationT; DocumentType() : NodeT(0) { } DocumentType(DocumentType_implT* impl) : NodeT(impl) { } DocumentType(const DocumentType& rhs) : NodeT(rhs) { } explicit DocumentType(const NodeT& rhs) : NodeT(rhs) { if(NodeT::impl_ == 0) // null nodes can always be cast return; if(rhs.getNodeType() != NodeT::DOCUMENT_TYPE_NODE) throw DOMBadCast("DocumentType"); } // DocumentType const stringT& getName() const { return dtImpl()->getName(); } const NamedNodeMapT getEntities() const { return NamedNodeMapT(dtImpl()->getEntities()); } const NamedNodeMapT getNotations() const { return NamedNodeMapT(dtImpl()->getNotations()); } stringT getPublicId() const { return dtImpl()->getPublicId(); } stringT getSystemId() const { return dtImpl()->getSystemId(); } stringT getInternalSubset() const { return dtImpl()->getInternalSubset(); } protected: DocumentType_implT* dtImpl() const { return dynamic_cast(*NodeT::impl_); } friend class DOMImplementation; }; // class DocumentType ////////////////////////////////////////////////////////// template class DocumentType_impl : virtual public Node_impl { public: typedef NamedNodeMap_impl NamedNodeMap_implT; virtual ~DocumentType_impl() { } ///////////////////////////////////////////// // DOM::DocumentType methods virtual const stringT& getName() const = 0; virtual NamedNodeMap_implT* getEntities() = 0; virtual NamedNodeMap_implT* getNotations() = 0; virtual stringT getPublicId() const = 0; virtual stringT getSystemId() const = 0; virtual stringT getInternalSubset() const = 0; }; // class DocumentType_impl } // namespace DOM } // namespace Arabica #endif