arabica/include/DOM/Entity.hpp

67 lines
1.8 KiB
C++
Raw Normal View History

2002-06-21 13:16:28 +02:00
#ifndef JEZUK_DOM_ENTITY_H
#define JEZUK_DOM_ENTITY_H
////////////////////////////
// C++ DOM definition
//
// $Id$
////////////////////////////
2007-09-05 00:55:47 +02:00
#include <DOM/Node.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 Entity_impl;
2002-06-21 13:16:28 +02:00
template<class stringT, class string_adaptorT = Arabica::default_string_adaptor<stringT> >
class Entity : public Node<stringT, string_adaptorT>
2002-06-21 13:16:28 +02:00
{
public:
typedef Node<stringT, string_adaptorT> NodeT;
typedef Entity_impl<stringT, string_adaptorT> Entity_implT;
Entity() : Node<stringT, string_adaptorT>() { }
explicit Entity(Entity_impl<stringT, string_adaptorT>* impl) : Node<stringT>(impl) { }
Entity(const Entity& rhs) : Node<stringT, string_adaptorT>(rhs) { }
explicit Entity(const Node<stringT, string_adaptorT>& rhs) : Node<stringT>(rhs)
2002-06-21 13:16:28 +02:00
{
if(rhs.getNodeType() != Node<stringT, string_adaptorT>::Entity_NODE)
2002-06-21 13:16:28 +02:00
throw std::bad_cast();
}
stringT getPublicId() const { nImpl()->getPublicId(); }
stringT getSystemId() const { nImpl()->getSystemId(); }
stringT getNotationName() const { nImpl()->getNotationName(); }
private:
Entity_implT* nImpl() { return dynamic_cast<Entity_implT*>(NodeT::impl()); }
2002-06-21 13:16:28 +02:00
}; // class Entity
//////////////////////////////////////////////////////////
template<class stringT, class string_adaptorT> class NamedNodeMap_impl;
2002-06-21 13:16:28 +02:00
template<class stringT, class string_adaptorT>
class Entity_impl : virtual public Node_impl<stringT, string_adaptorT>
2002-06-21 13:16:28 +02:00
{
public:
virtual ~Entity_impl () { }
/////////////////////////////////////////////
// DOM::Entity
virtual stringT getPublicId() const = 0;
virtual stringT getSystemId() const = 0;
virtual stringT getNotationName() const = 0;
}; // class Entity_impl
} // namespace DOM
2007-09-05 13:47:13 +02:00
} // namespace Arabica
2002-06-21 13:16:28 +02:00
#endif