arabica/include/DOM/ProcessingInstruction.hpp

60 lines
1.7 KiB
C++
Raw Normal View History

2002-06-21 13:16:28 +02:00
#ifndef JEZUK_DOM_PROCESSINGINSTRUCTION_H
#define JEZUK_DOM_PROCESSINGINSTRUCTION_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
namespace DOM
{
template<class stringT> class ProcessingInstruction_impl;
template<class stringT>
class ProcessingInstruction : public Node<stringT>
{
typedef Node<stringT> NodeT;
2002-06-21 13:16:28 +02:00
public:
ProcessingInstruction() : Node<stringT>(0) { }
explicit ProcessingInstruction(ProcessingInstruction_impl<stringT>* impl) : Node<stringT>(dynamic_cast<Node_impl<stringT>*>(impl)) { }
ProcessingInstruction(const ProcessingInstruction& rhs) : Node<stringT>(rhs) { }
explicit ProcessingInstruction(const Node<stringT>& rhs) : Node<stringT>(rhs)
{
if(rhs.getNodeType() != Node<stringT>::PROCESSING_INSTRUCTION_NODE)
throw std::bad_cast();
}
const stringT& getTarget() const { return piImpl()->getTarget(); }
2002-06-21 13:16:28 +02:00
const stringT& getData() const { return piImpl()->getData(); }
2002-06-21 13:16:28 +02:00
void setData(const stringT& data) { piImpl()->setData(data); }
private:
ProcessingInstruction_impl<stringT>* piImpl() const { return dynamic_cast<ProcessingInstruction_impl<stringT>*>(*NodeT::impl_); }
2002-06-21 13:16:28 +02:00
}; // class DocumentFragment
//////////////////////////////////////////////////////////
template<class stringT>
class ProcessingInstruction_impl : virtual public Node_impl<stringT>
{
public:
virtual ~ProcessingInstruction_impl () { }
////////////////////////////////////////////////////////
// DOM::ProcessingInstruction methods
virtual const stringT& getTarget() const = 0;
2002-06-21 13:16:28 +02:00
virtual const stringT& getData() const = 0;
2002-06-21 13:16:28 +02:00
virtual void setData(const stringT& data) = 0;
}; // class ProcessingInstruction_impl
} // namespace DOM
#endif