2002-06-21 13:16:28 +02:00
|
|
|
#ifndef JEZUK_SIMPLEDOM_CDATASECTIONIMPL_H
|
|
|
|
#define JEZUK_SIMPLEDOM_CDATASECTIONIMPL_H
|
|
|
|
|
2007-09-05 00:55:47 +02:00
|
|
|
#include <DOM/CDATASection.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>
|
2007-09-08 00:03:27 +02:00
|
|
|
class CDATASectionImpl : public DOM::CDATASection_impl<stringT, string_adaptorT>,
|
2002-06-21 13:16:28 +02:00
|
|
|
public CharacterDataImpl<stringT, string_adaptorT>
|
|
|
|
{
|
|
|
|
public:
|
2007-09-08 00:03:27 +02:00
|
|
|
typedef CharacterDataImpl<stringT, string_adaptorT> CharacterDataImplT;
|
|
|
|
typedef DOM::Text_impl<stringT, string_adaptorT> DOMText_implT;
|
|
|
|
typedef DOM::Node_impl<stringT, string_adaptorT> DOMNode_implT;
|
|
|
|
|
2002-06-21 13:16:28 +02:00
|
|
|
CDATASectionImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc, const stringT& data) :
|
2007-09-08 00:03:27 +02:00
|
|
|
CharacterDataImplT(ownerDoc, data)
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
|
|
|
} // CDATASectionImpl
|
|
|
|
|
|
|
|
virtual ~CDATASectionImpl() { }
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
// DOM::CDATASection methods
|
|
|
|
// on a compiler which implemented covariant return types this would return DOM::CDATASection
|
2007-09-08 00:03:27 +02:00
|
|
|
virtual DOMText_implT* splitText(int offset)
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
2007-09-08 00:03:27 +02:00
|
|
|
CharacterDataImplT::throwIfReadOnly();
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
stringT second = CharacterDataImplT::substringData(offset, CharacterDataImplT::getLength() - offset);
|
|
|
|
CharacterDataImplT::deleteData(offset, CharacterDataImplT::getLength() - offset);
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
CDATASectionImpl* splitNode = new CDATASectionImpl(CharacterDataImplT::getOwnerDoc(), second);
|
|
|
|
CharacterDataImplT::getParentNode()->insertBefore(splitNode, CharacterDataImplT::getNextSibling());
|
2002-06-21 13:16:28 +02:00
|
|
|
return splitNode;
|
|
|
|
} // splitText
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
// DOM::Node methods
|
|
|
|
virtual DOM::Node_base::Type getNodeType() const
|
|
|
|
{
|
|
|
|
return DOM::Node_base::CDATA_SECTION_NODE;
|
|
|
|
} // getNodeType
|
|
|
|
|
2009-11-28 02:12:28 +01:00
|
|
|
virtual DOMNode_implT* cloneNode(bool /*deep*/) const
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
2007-09-08 00:03:27 +02:00
|
|
|
return CharacterDataImplT::ownerDoc_->createCDATASection(CharacterDataImplT::getData());
|
2002-06-21 13:16:28 +02:00
|
|
|
} // cloneNode
|
|
|
|
|
2005-12-09 15:09:32 +01:00
|
|
|
virtual const stringT& getNodeName() const
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
2005-12-09 15:09:32 +01:00
|
|
|
static const stringT cdata_section = string_adaptorT::construct_from_utf8("#cdata-section");
|
|
|
|
return cdata_section;
|
2002-06-21 13:16:28 +02:00
|
|
|
} // getNodeName
|
|
|
|
}; // class CDATAImpl
|
|
|
|
|
|
|
|
} // namespace SAX2DOM
|
2007-09-05 13:47:13 +02:00
|
|
|
} // namespace Arabica
|
2002-06-21 13:16:28 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|