aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/XML/src/CharacterData.cpp
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/libs/poco/XML/src/CharacterData.cpp
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/libs/poco/XML/src/CharacterData.cpp')
-rw-r--r--contrib/libs/poco/XML/src/CharacterData.cpp152
1 files changed, 152 insertions, 0 deletions
diff --git a/contrib/libs/poco/XML/src/CharacterData.cpp b/contrib/libs/poco/XML/src/CharacterData.cpp
new file mode 100644
index 0000000000..f8a3ec324d
--- /dev/null
+++ b/contrib/libs/poco/XML/src/CharacterData.cpp
@@ -0,0 +1,152 @@
+//
+// CharacterData.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/CharacterData.h"
+#include "Poco/DOM/DOMException.h"
+#include "Poco/String.h"
+
+
+namespace Poco {
+namespace XML {
+
+
+CharacterData::CharacterData(Document* pOwnerDocument, const XMLString& data):
+ AbstractNode(pOwnerDocument),
+ _data(data)
+{
+}
+
+
+CharacterData::CharacterData(Document* pOwnerDocument, const CharacterData& data):
+ AbstractNode(pOwnerDocument, data),
+ _data(data._data)
+{
+}
+
+
+CharacterData::~CharacterData()
+{
+}
+
+
+void CharacterData::setData(const XMLString& data)
+{
+ if (events())
+ {
+ XMLString oldData = _data;
+ _data = data;
+ dispatchCharacterDataModified(oldData, _data);
+ }
+ else
+ {
+ _data = data;
+ }
+}
+
+
+XMLString CharacterData::substringData(unsigned long offset, unsigned long count) const
+{
+ if (offset >= _data.length())
+ throw DOMException(DOMException::INDEX_SIZE_ERR);
+
+ return _data.substr(offset, count);
+}
+
+
+void CharacterData::appendData(const XMLString& arg)
+{
+ if (events())
+ {
+ XMLString oldData = _data;
+ _data.append(arg);
+ dispatchCharacterDataModified(oldData, _data);
+ }
+ else
+ {
+ _data.append(arg);
+ }
+}
+
+
+void CharacterData::insertData(unsigned long offset, const XMLString& arg)
+{
+ if (offset > _data.length())
+ throw DOMException(DOMException::INDEX_SIZE_ERR);
+
+ if (events())
+ {
+ XMLString oldData = _data;
+ _data.insert(offset, arg);
+ dispatchCharacterDataModified(oldData, _data);
+ }
+ else
+ {
+ _data.insert(offset, arg);
+ }
+}
+
+
+void CharacterData::deleteData(unsigned long offset, unsigned long count)
+{
+ if (offset >= _data.length())
+ throw DOMException(DOMException::INDEX_SIZE_ERR);
+
+ if (events())
+ {
+ XMLString oldData = _data;
+ _data.replace(offset, count, EMPTY_STRING);
+ dispatchCharacterDataModified(oldData, _data);
+ }
+ else
+ _data.replace(offset, count, EMPTY_STRING);
+}
+
+
+void CharacterData::replaceData(unsigned long offset, unsigned long count, const XMLString& arg)
+{
+ if (offset >= _data.length())
+ throw DOMException(DOMException::INDEX_SIZE_ERR);
+
+ if (events())
+ {
+ XMLString oldData = _data;
+ _data.replace(offset, count, arg);
+ dispatchCharacterDataModified(oldData, _data);
+ }
+ else
+ {
+ _data.replace(offset, count, arg);
+ }
+}
+
+
+const XMLString& CharacterData::getNodeValue() const
+{
+ return _data;
+}
+
+
+void CharacterData::setNodeValue(const XMLString& value)
+{
+ setData(value);
+}
+
+
+XMLString CharacterData::trimmedData() const
+{
+ return Poco::trim(_data);
+}
+
+
+} } // namespace Poco::XML