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