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
|
|
|
|
{
|
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
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
|
|
|
|
2007-09-09 00:31:24 +02:00
|
|
|
template<class stringT, class string_adaptorT = Arabica::default_string_adaptor<stringT> >
|
2007-09-08 00:03:27 +02:00
|
|
|
class DocumentType : public Node<stringT, string_adaptorT>
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
2007-09-08 00:03:27 +02:00
|
|
|
typedef DocumentType_impl<stringT, string_adaptorT> DocumentType_implT;
|
2002-06-21 13:16:28 +02:00
|
|
|
public:
|
2007-09-08 00:03:27 +02:00
|
|
|
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
|
|
|
{
|
2010-12-09 12:35:54 +01:00
|
|
|
if(NodeT::impl_ == 0) // null nodes can always be cast
|
|
|
|
return;
|
2007-09-08 00:03:27 +02:00
|
|
|
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
|
|
|
|
|
2005-12-09 16:53:05 +01:00
|
|
|
const stringT& getName() const { return dtImpl()->getName(); }
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
const NamedNodeMapT getEntities() const { return NamedNodeMapT(dtImpl()->getEntities()); }
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +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:
|
2007-09-08 00:03:27 +02:00
|
|
|
DocumentType_implT* dtImpl() const { return dynamic_cast<DocumentType_implT*>(*NodeT::impl_); }
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
friend class DOMImplementation<stringT, string_adaptorT>;
|
2002-06-21 13:16:28 +02:00
|
|
|
}; // class DocumentType
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////
|
2007-09-08 00:03:27 +02:00
|
|
|
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:
|
2007-09-08 00:03:27 +02:00
|
|
|
typedef NamedNodeMap_impl<stringT, string_adaptorT> NamedNodeMap_implT;
|
|
|
|
|
2002-06-21 13:16:28 +02:00
|
|
|
virtual ~DocumentType_impl() { }
|
|
|
|
|
|
|
|
/////////////////////////////////////////////
|
|
|
|
// DOM::DocumentType methods
|
2005-12-09 16:53:05 +01:00
|
|
|
virtual const stringT& getName() const = 0;
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
virtual NamedNodeMap_implT* getEntities() = 0;
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +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
|
|
|
|
|