diff options
| author | i-sokolov <[email protected]> | 2022-02-10 16:46:30 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:30 +0300 | 
| commit | 12c01f0701d50bc3f68eb36add9bff803ca94f35 (patch) | |
| tree | 4b775523c0da7b1613a0407a30e4998a436911cd /library/cpp/xml/document | |
| parent | 4b839d0704ee9be1dabb0310a1f03af24963637b (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/xml/document')
| -rw-r--r-- | library/cpp/xml/document/node-attr.h | 8 | ||||
| -rw-r--r-- | library/cpp/xml/document/xml-document-decl.h | 4 | ||||
| -rw-r--r-- | library/cpp/xml/document/xml-document.cpp | 18 | ||||
| -rw-r--r-- | library/cpp/xml/document/xml-document_ut.cpp | 24 | 
4 files changed, 27 insertions, 27 deletions
diff --git a/library/cpp/xml/document/node-attr.h b/library/cpp/xml/document/node-attr.h index 6e74403943c..3b757796bdd 100644 --- a/library/cpp/xml/document/node-attr.h +++ b/library/cpp/xml/document/node-attr.h @@ -136,14 +136,14 @@ namespace NXml {      inline void TNode::SetAttr(TZtStringBuf name) {          xmlAttr* attr = xmlSetProp(NodePointer, XMLCHAR(name.c_str()), nullptr); - +           if (!attr) {              THROW(XmlException, "Can't set node empty attribute <"                                      << name                                      << ">"); -        } -    } - +        }  +    }  +       inline void TNode::DelAttr(TZtStringBuf name) {          if (xmlUnsetProp(NodePointer, XMLCHAR(name.c_str())) < 0)              THROW(XmlException, "Can't delete node attribute <" diff --git a/library/cpp/xml/document/xml-document-decl.h b/library/cpp/xml/document/xml-document-decl.h index bfda1fb7e6e..3ff972208ce 100644 --- a/library/cpp/xml/document/xml-document-decl.h +++ b/library/cpp/xml/document/xml-document-decl.h @@ -388,7 +388,7 @@ namespace NXml {          SetAttr(TZtStringBuf name, const T& value);          void SetAttr(TZtStringBuf name, TZtStringBuf value); - +           void SetAttr(TZtStringBuf name);          /** @@ -469,7 +469,7 @@ namespace NXml {          void AttrInternal(TCharPtr& value, T& res, TStringBuf errContext) const;          void SaveInternal(IOutputStream& stream, TZtStringBuf enc, int options) const; - +           xmlNode* NodePointer;          xmlDoc* DocPointer;      }; diff --git a/library/cpp/xml/document/xml-document.cpp b/library/cpp/xml/document/xml-document.cpp index 18a554d7321..562269473df 100644 --- a/library/cpp/xml/document/xml-document.cpp +++ b/library/cpp/xml/document/xml-document.cpp @@ -316,21 +316,21 @@ namespace NXml {      void TNode::SaveInternal(IOutputStream& stream, TZtStringBuf enc, int options) const {          const char* encoding = enc.size() ? enc.data() : "utf-8";          TSaveCtxtPtr ctx(xmlSaveToIO(XmlWriteToOstream, /* close */ nullptr, &stream, -                                     encoding, options)); +                                     encoding, options));           if (xmlSaveTree(ctx.Get(), (xmlNode*)GetPtr()) < 0)              THROW(XmlException, "Failed saving node to stream");      }      void TNode::Save(IOutputStream& stream, TZtStringBuf enc, bool shouldFormat) const { -        SaveInternal(stream, enc, shouldFormat ? XML_SAVE_FORMAT : 0); -    } - +        SaveInternal(stream, enc, shouldFormat ? XML_SAVE_FORMAT : 0);  +    }  +       void TNode::SaveAsHtml(IOutputStream& stream, TZtStringBuf enc, bool shouldFormat) const { -        int options = XML_SAVE_AS_HTML; -        options |= shouldFormat ? XML_SAVE_FORMAT : 0; -        SaveInternal(stream, enc, options); -    } - +        int options = XML_SAVE_AS_HTML;  +        options |= shouldFormat ? XML_SAVE_FORMAT : 0;  +        SaveInternal(stream, enc, options);  +    }  +       TConstNodes::TConstNodes(const TConstNodes& nodes)          : SizeValue(nodes.Size())          , Doc(nodes.Doc) diff --git a/library/cpp/xml/document/xml-document_ut.cpp b/library/cpp/xml/document/xml-document_ut.cpp index 9f537b75c4c..1dc6adf4e95 100644 --- a/library/cpp/xml/document/xml-document_ut.cpp +++ b/library/cpp/xml/document/xml-document_ut.cpp @@ -278,19 +278,19 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) {          UNIT_ASSERT_EQUAL(ys.Size(), 1);          UNIT_ASSERT_EQUAL(ys[0].Value<int>(), 20);      } - +       Y_UNIT_TEST(Html) { -        using namespace NXml; - -        TDocument htmlChunk("video", TDocument::RootName); -        TNode videoNode = htmlChunk.Root(); - -        videoNode.SetAttr("controls"); - -        TStringStream ss; -        videoNode.SaveAsHtml(ss); -        UNIT_ASSERT_EQUAL(ss.Str(), "<video controls></video>"); -    } +        using namespace NXml;  +  +        TDocument htmlChunk("video", TDocument::RootName);  +        TNode videoNode = htmlChunk.Root();  +  +        videoNode.SetAttr("controls");  +  +        TStringStream ss;  +        videoNode.SaveAsHtml(ss);  +        UNIT_ASSERT_EQUAL(ss.Str(), "<video controls></video>");  +    }       Y_UNIT_TEST(Move) {          using namespace NXml;  | 
