arabica/DOM/Simple/ProcessingInstructionImpl.h

78 lines
2.1 KiB
C
Raw Normal View History

2002-06-21 13:16:28 +02:00
#ifndef JEZUK_SimpleDOM_PROCESSINGINSTRUCTIONIMPL_H
#define JEZUK_SimpleDOM_PROCESSINGINSTRUCTIONIMPL_H
#include <DOM/ProcessingInstruction.h>
#include <DOM/Simple/NodeImpl.h>
namespace SimpleDOM
{
template<class stringT, class string_adaptorT>
class ProcessingInstructionImpl : public DOM::ProcessingInstruction_impl<stringT>,
public ChildlessNodeImpl<stringT, string_adaptorT>
{
2004-09-14 22:51:36 +02:00
typedef DOM::ProcessingInstruction_impl<stringT> ProcessingInstructionT;
using ProcessingInstructionT::setNodeValue;
using ProcessingInstructionT::throwIfReadOnly;
using ProcessingInstructionT::ownerDoc_;
2002-06-21 13:16:28 +02:00
public:
ProcessingInstructionImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc,
stringT target,
stringT data) :
DOM::ProcessingInstruction_impl<stringT>(),
ChildlessNodeImpl<stringT, string_adaptorT>(ownerDoc),
target_(target),
data_(data)
{
} // ProcessingInstructionImpl
virtual ~ProcessingInstructionImpl() { }
///////////////////////////////////////////////////////
// DOM::ProcessingInstruction methods
virtual stringT getTarget() const { return getNodeName(); }
virtual stringT getData() const { return getNodeValue(); }
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
virtual stringT getNodeName() const
{
return target_;
} // getNodeName
virtual stringT getNodeValue() const
{
return data_;
} // getNodeValue
virtual void setNodeValue(const stringT& nodeValue)
{
throwIfReadOnly();
data_ = nodeValue;
} // setNodeValue
virtual DOM::Node_impl<stringT>* cloneNode(bool deep) const
{
return ownerDoc_->createProcessingInstruction(target_, data_);
} // cloneNode
private:
stringT target_;
stringT data_;
}; // class ProcessingInstructionImpl
} // namespace SAX2DOM
#endif