arabica/include/DOM/Notation.hpp

67 lines
1.7 KiB
C++
Raw Normal View History

2002-06-21 13:16:28 +02:00
#ifndef JEZUK_DOM_NOTATION_H
#define JEZUK_DOM_NOTATION_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
#include <typeinfo>
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 Notation_impl;
2002-06-21 13:16:28 +02:00
template<class stringT, class string_adaptorT = Arabica::default_string_adaptor<stringT> >
class Notation : public Node<stringT, string_adaptorT>
2002-06-21 13:16:28 +02:00
{
public:
typedef Node<stringT, string_adaptorT> NodeT;
typedef Notation_impl<stringT, string_adaptorT> Notation_implT;
Notation() : NodeT() { }
explicit Notation(Notation_implT* impl) : NodeT(nImpl()) { }
Notation(const Notation& rhs) : NodeT(rhs) { }
explicit Notation(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() != Node_base::NOTATION_NODE)
2002-06-21 13:16:28 +02:00
throw std::bad_cast();
}
stringT getPublicId() const { return nImpl()->getPublicId(); }
2002-06-21 13:16:28 +02:00
stringT getSystemId() const { return nImpl()->getSystemId(); }
2002-06-21 13:16:28 +02:00
private:
Notation_implT* nImpl() const { return dynamic_cast<Notation_implT*>(*NodeT::impl_); }
2002-06-21 13:16:28 +02:00
}; // class Notation
//////////////////////////////////////////////////////////
template<class stringT, class string_adaptorT> class NamedNodeMap_impl;
2002-06-21 13:16:28 +02:00
template<class stringT, class string_adaptorT>
class Notation_impl : virtual public Node_impl<stringT, string_adaptorT>
2002-06-21 13:16:28 +02:00
{
public:
virtual ~Notation_impl () { }
/////////////////////////////////////////////
// DOM::Notation
virtual stringT getPublicId() const = 0;
virtual stringT getSystemId() const = 0;
}; // class Notation_impl
} // namespace DOM
2007-09-05 13:47:13 +02:00
} // namespace Arabica
2002-06-21 13:16:28 +02:00
#endif