arabica/include/DOM/Simple/ProcessingInstructionImpl.hpp

80 lines
2.2 KiB
C++
Raw Normal View History

2002-06-21 13:16:28 +02:00
#ifndef JEZUK_SimpleDOM_PROCESSINGINSTRUCTIONIMPL_H
#define JEZUK_SimpleDOM_PROCESSINGINSTRUCTIONIMPL_H
2007-09-05 00:55:47 +02:00
#include <DOM/ProcessingInstruction.hpp>
#include <DOM/Simple/NodeImpl.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 SimpleDOM
{
template<class stringT, class string_adaptorT>
class ProcessingInstructionImpl : public DOM::ProcessingInstruction_impl<stringT, string_adaptorT>,
2002-06-21 13:16:28 +02:00
public ChildlessNodeImpl<stringT, string_adaptorT>
{
public:
typedef ChildlessNodeImpl<stringT, string_adaptorT> NodeT;
typedef DOM::ProcessingInstruction_impl<stringT, string_adaptorT> DOMProcessingInstruction_implT;
typedef DOM::Node_impl<stringT, string_adaptorT> DOMNode_implT;
2002-06-21 13:16:28 +02:00
ProcessingInstructionImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc,
stringT target,
stringT data) :
DOMProcessingInstruction_implT(),
NodeT(ownerDoc),
2002-06-21 13:16:28 +02:00
target_(target),
data_(data)
{
} // ProcessingInstructionImpl
virtual ~ProcessingInstructionImpl() { }
///////////////////////////////////////////////////////
// DOM::ProcessingInstruction methods
virtual const stringT& getTarget() const { return getNodeName(); }
2002-06-21 13:16:28 +02:00
virtual const stringT& getData() const { return getNodeValue(); }
2002-06-21 13:16:28 +02:00
virtual void setData(const stringT& data) { setNodeValue(data); }
///////////////////////////////////////////////////////
// DOM::Node methods
virtual DOM::Node_base::Type getNodeType() const
{
return DOM::Node_base::PROCESSING_INSTRUCTION_NODE;
} // getNodeType
2005-12-09 15:09:32 +01:00
virtual const stringT& getNodeName() const
2002-06-21 13:16:28 +02:00
{
return target_;
} // getNodeName
virtual const stringT& getNodeValue() const
2002-06-21 13:16:28 +02:00
{
return data_;
} // getNodeValue
virtual void setNodeValue(const stringT& nodeValue)
{
NodeT::throwIfReadOnly();
2002-06-21 13:16:28 +02:00
data_ = nodeValue;
} // setNodeValue
virtual DOMNode_implT* cloneNode(bool /*deep*/) const
2002-06-21 13:16:28 +02:00
{
return NodeT::ownerDoc_->createProcessingInstruction(target_, data_);
2002-06-21 13:16:28 +02:00
} // cloneNode
private:
stringT target_;
stringT data_;
}; // class ProcessingInstructionImpl
} // namespace SAX2DOM
2007-09-05 13:47:13 +02:00
} // namespace Arabica
2002-06-21 13:16:28 +02:00
#endif