#ifndef JEZUK_SimpleDOM_TEXTIMPL_H #define JEZUK_SimpleDOM_TEXTIMPL_H #include #include namespace Arabica { namespace SimpleDOM { template class TextImpl : public DOM::Text_impl, public CharacterDataImpl { public: typedef CharacterDataImpl CharacterDataT; typedef DOM::Node_impl DOMNode_implT; typedef DOM::Text_impl DOMText_implT; TextImpl(DocumentImpl* ownerDoc, const stringT& data) : DOMText_implT(), CharacterDataImpl(ownerDoc, data) { } // TextImpl virtual ~TextImpl() { } ////////////////////////////////////////////////////////////////// // DOM::Text methods virtual DOMText_implT* splitText(int offset) { CharacterDataT::throwIfReadOnly(); stringT second = CharacterDataT::substringData(offset, CharacterDataT::getLength() - offset); CharacterDataT::deleteData(offset, CharacterDataT::getLength() - offset); TextImpl* splitNode = new TextImpl(CharacterDataT::getOwnerDoc(), second); DOMNode_implT *parent = CharacterDataT::getParentNode(); if(parent) parent->insertBefore(splitNode, CharacterDataT::getNextSibling()); return splitNode; } // splitText /////////////////////////////////////////////////////// // DOM::Node methods virtual DOM::Node_base::Type getNodeType() const { return DOM::Node_base::TEXT_NODE; } // getNodeType virtual DOMNode_implT* cloneNode(bool /*deep*/) const { return CharacterDataT::ownerDoc_->createTextNode(CharacterDataT::getData()); } // cloneNode virtual const stringT& getNodeName() const { static const stringT text = string_adaptorT::construct_from_utf8("#text"); return text; } // getNodeName }; // class TextImpl } // namespace SAX2DOM } // namespace Arabica #endif