diff options
| author | fippo <[email protected]> | 2022-02-10 16:50:08 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:50:08 +0300 |
| commit | 3e57c324d47a3a202cb3c5a9648d2f92103d5213 (patch) | |
| tree | 6913479b0d0b22ec99bbba7c96f2f930d9095600 /library/cpp/xml/document/node-attr.h | |
| parent | bebbbda5c5ff4ec70d301ac897eb8d6c8da7a9a4 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/xml/document/node-attr.h')
| -rw-r--r-- | library/cpp/xml/document/node-attr.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/library/cpp/xml/document/node-attr.h b/library/cpp/xml/document/node-attr.h index 6e74403943c..baf2812d959 100644 --- a/library/cpp/xml/document/node-attr.h +++ b/library/cpp/xml/document/node-attr.h @@ -182,28 +182,28 @@ namespace NXml { return TNode(DocPointer, child); } - template <class T> + template <class T> typename std::enable_if<!std::is_convertible_v<T, TStringBuf>, TNode>::type TNode::AddText(const T& value) { - TStringStream ss; - ss << value; - return AddText(ss.Str()); - } - + TStringStream ss; + ss << value; + return AddText(ss.Str()); + } + inline TNode TNode::AddText(TStringBuf value) { if (IsNull()) { THROW(XmlException, "addChild [value=" << value << "]: can't add child to null node"); - } - - xmlNode* child = xmlNewTextLen((xmlChar*)value.data(), value.size()); - child = xmlAddChild(NodePointer, child); - + } + + xmlNode* child = xmlNewTextLen((xmlChar*)value.data(), value.size()); + child = xmlAddChild(NodePointer, child); + if (!child) { THROW(XmlException, "addChild [value=" << value << "]: xmlNewTextChild returned NULL"); - } - - return TNode(DocPointer, child); - } + } + + return TNode(DocPointer, child); + } } |
