arabica/include/DOM/DocumentType.hpp

89 lines
2.7 KiB
C++
Raw Permalink Normal View History

2002-06-21 13:16:28 +02:00
#ifndef JEZUK_DOM_DOCUMENTTYPE_H
#define JEZUK_DOM_DOCUMENTTYPE_H
////////////////////////////
// C++ DOM definition
//
// $Id$
////////////////////////////
2007-09-05 00:55:47 +02:00
#include <DOM/Node.hpp>
#include <DOM/NamedNodeMap.hpp>
#include <DOM/DOMImplementation.hpp>
2002-06-21 13:16:28 +02:00
2007-09-05 13:47:13 +02:00
namespace Arabica
{
2002-06-21 13:16:28 +02:00
namespace DOM
{
template<class stringT, class string_adaptorT> class Document_impl;
template<class stringT, class string_adaptorT> class DocumentType_impl;
2002-06-21 13:16:28 +02:00
template<class stringT, class string_adaptorT = Arabica::default_string_adaptor<stringT> >
class DocumentType : public Node<stringT, string_adaptorT>
2002-06-21 13:16:28 +02:00
{
typedef DocumentType_impl<stringT, string_adaptorT> DocumentType_implT;
2002-06-21 13:16:28 +02:00
public:
typedef Node<stringT, string_adaptorT> NodeT;
typedef NamedNodeMap<stringT, string_adaptorT> NamedNodeMapT;
typedef DOMImplementation<stringT, string_adaptorT> DOMImplementationT;
DocumentType() : NodeT(0) { }
DocumentType(DocumentType_implT* impl) : NodeT(impl) { }
DocumentType(const DocumentType& rhs) : NodeT(rhs) { }
explicit DocumentType(const NodeT& rhs) : NodeT(rhs)
2002-06-21 13:16:28 +02:00
{
if(NodeT::impl_ == 0) // null nodes can always be cast
return;
if(rhs.getNodeType() != NodeT::DOCUMENT_TYPE_NODE)
2010-12-10 10:24:34 +01:00
throw DOMBadCast("DocumentType");
2002-06-21 13:16:28 +02:00
} // DocumentType
const stringT& getName() const { return dtImpl()->getName(); }
2002-06-21 13:16:28 +02:00
const NamedNodeMapT getEntities() const { return NamedNodeMapT(dtImpl()->getEntities()); }
2002-06-21 13:16:28 +02:00
const NamedNodeMapT getNotations() const { return NamedNodeMapT(dtImpl()->getNotations()); }
2002-06-21 13:16:28 +02:00
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<DocumentType_implT*>(*NodeT::impl_); }
2002-06-21 13:16:28 +02:00
friend class DOMImplementation<stringT, string_adaptorT>;
2002-06-21 13:16:28 +02:00
}; // class DocumentType
//////////////////////////////////////////////////////////
template<class stringT, class string_adaptorT>
class DocumentType_impl : virtual public Node_impl<stringT, string_adaptorT>
2002-06-21 13:16:28 +02:00
{
public:
typedef NamedNodeMap_impl<stringT, string_adaptorT> NamedNodeMap_implT;
2002-06-21 13:16:28 +02:00
virtual ~DocumentType_impl() { }
/////////////////////////////////////////////
// DOM::DocumentType methods
virtual const stringT& getName() const = 0;
2002-06-21 13:16:28 +02:00
virtual NamedNodeMap_implT* getEntities() = 0;
2002-06-21 13:16:28 +02:00
virtual NamedNodeMap_implT* getNotations() = 0;
2002-06-21 13:16:28 +02:00
virtual stringT getPublicId() const = 0;
virtual stringT getSystemId() const = 0;
virtual stringT getInternalSubset() const = 0;
}; // class DocumentType_impl
} // namespace DOM
2007-09-05 13:47:13 +02:00
} // namespace Arabica
2002-06-21 13:16:28 +02:00
#endif