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
|
|
|
|
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 ProcessingInstruction_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 ProcessingInstruction : public Node<stringT, string_adaptorT>
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
2007-09-08 00:03:27 +02:00
|
|
|
typedef Node<stringT, string_adaptorT> NodeT;
|
2002-06-21 13:16:28 +02:00
|
|
|
public:
|
2007-09-08 00:03:27 +02:00
|
|
|
ProcessingInstruction() : Node<stringT, string_adaptorT>(0) { }
|
|
|
|
explicit ProcessingInstruction(ProcessingInstruction_impl<stringT, string_adaptorT>* impl) : Node<stringT, string_adaptorT>(dynamic_cast<Node_impl<stringT, string_adaptorT>*>(impl)) { }
|
|
|
|
ProcessingInstruction(const ProcessingInstruction& rhs) : Node<stringT, string_adaptorT>(rhs) { }
|
|
|
|
explicit ProcessingInstruction(const Node<stringT, string_adaptorT>& rhs) : Node<stringT, string_adaptorT>(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() != Node<stringT, string_adaptorT>::PROCESSING_INSTRUCTION_NODE)
|
2010-12-10 10:24:34 +01:00
|
|
|
throw DOMBadCast("ProcessingInstruction");
|
2002-06-21 13:16:28 +02:00
|
|
|
}
|
|
|
|
|
2005-12-09 16:55:29 +01:00
|
|
|
const stringT& getTarget() const { return piImpl()->getTarget(); }
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2005-12-09 16:57:21 +01: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:
|
2007-09-08 00:03:27 +02:00
|
|
|
ProcessingInstruction_impl<stringT, string_adaptorT>* piImpl() const { return dynamic_cast<ProcessingInstruction_impl<stringT, string_adaptorT>*>(*NodeT::impl_); }
|
2002-06-21 13:16:28 +02:00
|
|
|
}; // class DocumentFragment
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////
|
2007-09-08 00:03:27 +02:00
|
|
|
template<class stringT, class string_adaptorT>
|
|
|
|
class ProcessingInstruction_impl : virtual public Node_impl<stringT, string_adaptorT>
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~ProcessingInstruction_impl () { }
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
// DOM::ProcessingInstruction methods
|
2005-12-09 16:55:29 +01:00
|
|
|
virtual const stringT& getTarget() const = 0;
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2005-12-09 16:57:21 +01: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
|
2007-09-05 13:47:13 +02:00
|
|
|
} // namespace Arabica
|
2002-06-21 13:16:28 +02:00
|
|
|
#endif
|
|
|
|
|