summaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/XML/src/Text.cpp
diff options
context:
space:
mode:
authorDevtools Arcadia <[email protected]>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <[email protected]>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/libs/poco/XML/src/Text.cpp
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/libs/poco/XML/src/Text.cpp')
-rw-r--r--contrib/libs/poco/XML/src/Text.cpp80
1 files changed, 80 insertions, 0 deletions
diff --git a/contrib/libs/poco/XML/src/Text.cpp b/contrib/libs/poco/XML/src/Text.cpp
new file mode 100644
index 00000000000..abdff3a4e90
--- /dev/null
+++ b/contrib/libs/poco/XML/src/Text.cpp
@@ -0,0 +1,80 @@
+//
+// Text.cpp
+//
+// Library: XML
+// Package: DOM
+// Module: DOM
+//
+// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
+// and Contributors.
+//
+// SPDX-License-Identifier: BSL-1.0
+//
+
+
+#include "Poco/DOM/Text.h"
+#include "Poco/DOM/Document.h"
+#include "Poco/DOM/DOMException.h"
+
+
+namespace Poco {
+namespace XML {
+
+
+const XMLString Text::NODE_NAME = toXMLString("#text");
+
+
+Text::Text(Document* pOwnerDocument, const XMLString& data):
+ CharacterData(pOwnerDocument, data)
+{
+}
+
+
+Text::Text(Document* pOwnerDocument, const Text& text):
+ CharacterData(pOwnerDocument, text)
+{
+}
+
+
+Text::~Text()
+{
+}
+
+
+Text* Text::splitText(unsigned long offset)
+{
+ Node* pParent = parentNode();
+ if (!pParent) throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);
+ int n = length() - offset;
+ Text* pNew = ownerDocument()->createTextNode(substringData(offset, n));
+ deleteData(offset, n);
+ pParent->insertBefore(pNew, nextSibling())->release();
+ return pNew;
+}
+
+
+const XMLString& Text::nodeName() const
+{
+ return NODE_NAME;
+}
+
+
+unsigned short Text::nodeType() const
+{
+ return Node::TEXT_NODE;
+}
+
+
+XMLString Text::innerText() const
+{
+ return nodeValue();
+}
+
+
+Node* Text::copyNode(bool /*deep*/, Document* pOwnerDocument) const
+{
+ return new Text(pOwnerDocument, *this);
+}
+
+
+} } // namespace Poco::XML