diff options
author | Arslan Urtashev <urtashev@gmail.com> | 2022-02-10 16:48:55 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:55 +0300 |
commit | 1136f2ce7cce7bcc84e695272c0d92d4eb900c2b (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/xml/document | |
parent | b97740540e7302cec9efa181e106ae1990a0cc1c (diff) | |
download | ydb-1136f2ce7cce7bcc84e695272c0d92d4eb900c2b.tar.gz |
Restoring authorship annotation for Arslan Urtashev <urtashev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/xml/document')
-rw-r--r-- | library/cpp/xml/document/ut/ya.make | 2 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-options.cpp | 2 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-options.h | 132 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-options_ut.cpp | 42 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-textreader.cpp | 2 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-textreader.h | 2 | ||||
-rw-r--r-- | library/cpp/xml/document/ya.make | 2 |
7 files changed, 92 insertions, 92 deletions
diff --git a/library/cpp/xml/document/ut/ya.make b/library/cpp/xml/document/ut/ya.make index 856b6ad796..e955448c66 100644 --- a/library/cpp/xml/document/ut/ya.make +++ b/library/cpp/xml/document/ut/ya.make @@ -5,7 +5,7 @@ OWNER(finder) SRCS( xml-document_ut.cpp xml-textreader_ut.cpp - xml-options_ut.cpp + xml-options_ut.cpp ) END() diff --git a/library/cpp/xml/document/xml-options.cpp b/library/cpp/xml/document/xml-options.cpp index f84e601b98..74e7545de3 100644 --- a/library/cpp/xml/document/xml-options.cpp +++ b/library/cpp/xml/document/xml-options.cpp @@ -1 +1 @@ -#include "xml-options.h" +#include "xml-options.h" diff --git a/library/cpp/xml/document/xml-options.h b/library/cpp/xml/document/xml-options.h index b81fb8c88d..bb07da0cfb 100644 --- a/library/cpp/xml/document/xml-options.h +++ b/library/cpp/xml/document/xml-options.h @@ -1,67 +1,67 @@ -#pragma once - -#include <contrib/libs/libxml/include/libxml/parser.h> - -namespace NXml { - enum class EOption : int { - // clang-format off - Recover = XML_PARSE_RECOVER, - NoEnt = XML_PARSE_NOENT, - DTDLoad = XML_PARSE_DTDLOAD, - DTDAttr = XML_PARSE_DTDATTR, - DTDValid = XML_PARSE_DTDVALID, - NoError = XML_PARSE_NOERROR, - NoWarning = XML_PARSE_NOWARNING, - Pedantic = XML_PARSE_PEDANTIC, - NoBlanks = XML_PARSE_NOBLANKS, - SAX1 = XML_PARSE_SAX1, - XInclude = XML_PARSE_XINCLUDE, - NoNet = XML_PARSE_NONET, - NoDict = XML_PARSE_NODICT, - NSClean = XML_PARSE_NSCLEAN, - NoCData = XML_PARSE_NOCDATA, - NoXInclude = XML_PARSE_NOXINCNODE, - Compact = XML_PARSE_COMPACT, - Old10 = XML_PARSE_OLD10, - NoBaseFix = XML_PARSE_NOBASEFIX, - Huge = XML_PARSE_HUGE, - OldSAX = XML_PARSE_OLDSAX, - IgnoreEnc = XML_PARSE_IGNORE_ENC, - BigLines = XML_PARSE_BIG_LINES, - // clang-format on - }; - - class TOptions { - public: - TOptions() - : Mask(0) - { - } - - template <typename... TArgs> - TOptions(TArgs... args) - : Mask(0) - { - Set(args...); - } - - TOptions& Set(EOption option) { - Mask |= static_cast<int>(option); - return *this; - } - - template <typename... TArgs> - TOptions& Set(EOption arg, TArgs... args) { - Set(arg); - return Set(args...); - } - - int GetMask() const { - return Mask; - } - - private: - int Mask; - }; - +#pragma once + +#include <contrib/libs/libxml/include/libxml/parser.h> + +namespace NXml { + enum class EOption : int { + // clang-format off + Recover = XML_PARSE_RECOVER, + NoEnt = XML_PARSE_NOENT, + DTDLoad = XML_PARSE_DTDLOAD, + DTDAttr = XML_PARSE_DTDATTR, + DTDValid = XML_PARSE_DTDVALID, + NoError = XML_PARSE_NOERROR, + NoWarning = XML_PARSE_NOWARNING, + Pedantic = XML_PARSE_PEDANTIC, + NoBlanks = XML_PARSE_NOBLANKS, + SAX1 = XML_PARSE_SAX1, + XInclude = XML_PARSE_XINCLUDE, + NoNet = XML_PARSE_NONET, + NoDict = XML_PARSE_NODICT, + NSClean = XML_PARSE_NSCLEAN, + NoCData = XML_PARSE_NOCDATA, + NoXInclude = XML_PARSE_NOXINCNODE, + Compact = XML_PARSE_COMPACT, + Old10 = XML_PARSE_OLD10, + NoBaseFix = XML_PARSE_NOBASEFIX, + Huge = XML_PARSE_HUGE, + OldSAX = XML_PARSE_OLDSAX, + IgnoreEnc = XML_PARSE_IGNORE_ENC, + BigLines = XML_PARSE_BIG_LINES, + // clang-format on + }; + + class TOptions { + public: + TOptions() + : Mask(0) + { + } + + template <typename... TArgs> + TOptions(TArgs... args) + : Mask(0) + { + Set(args...); + } + + TOptions& Set(EOption option) { + Mask |= static_cast<int>(option); + return *this; + } + + template <typename... TArgs> + TOptions& Set(EOption arg, TArgs... args) { + Set(arg); + return Set(args...); + } + + int GetMask() const { + return Mask; + } + + private: + int Mask; + }; + } diff --git a/library/cpp/xml/document/xml-options_ut.cpp b/library/cpp/xml/document/xml-options_ut.cpp index 99a5d877a8..9be16baf3d 100644 --- a/library/cpp/xml/document/xml-options_ut.cpp +++ b/library/cpp/xml/document/xml-options_ut.cpp @@ -1,26 +1,26 @@ -#include "xml-options.h" - +#include "xml-options.h" + #include <library/cpp/testing/unittest/registar.h> - + Y_UNIT_TEST_SUITE(TestXmlOptions) { Y_UNIT_TEST(SetHuge) { - NXml::TOptions opts; - opts.Set(NXml::EOption::Huge); - UNIT_ASSERT_EQUAL(XML_PARSE_HUGE, opts.GetMask()); - } - + NXml::TOptions opts; + opts.Set(NXml::EOption::Huge); + UNIT_ASSERT_EQUAL(XML_PARSE_HUGE, opts.GetMask()); + } + Y_UNIT_TEST(VariadicContructor) { - NXml::TOptions opts(NXml::EOption::Huge, NXml::EOption::Compact, NXml::EOption::SAX1); - UNIT_ASSERT_EQUAL(XML_PARSE_HUGE | XML_PARSE_COMPACT | XML_PARSE_SAX1, opts.GetMask()); - } - + NXml::TOptions opts(NXml::EOption::Huge, NXml::EOption::Compact, NXml::EOption::SAX1); + UNIT_ASSERT_EQUAL(XML_PARSE_HUGE | XML_PARSE_COMPACT | XML_PARSE_SAX1, opts.GetMask()); + } + Y_UNIT_TEST(Chaining) { - NXml::TOptions opts; - - opts - .Set(NXml::EOption::Huge) - .Set(NXml::EOption::Compact); - - UNIT_ASSERT_EQUAL(XML_PARSE_HUGE | XML_PARSE_COMPACT, opts.GetMask()); - } -} + NXml::TOptions opts; + + opts + .Set(NXml::EOption::Huge) + .Set(NXml::EOption::Compact); + + UNIT_ASSERT_EQUAL(XML_PARSE_HUGE | XML_PARSE_COMPACT, opts.GetMask()); + } +} diff --git a/library/cpp/xml/document/xml-textreader.cpp b/library/cpp/xml/document/xml-textreader.cpp index 0dbfe761fa..b946f1fbf2 100644 --- a/library/cpp/xml/document/xml-textreader.cpp +++ b/library/cpp/xml/document/xml-textreader.cpp @@ -11,7 +11,7 @@ namespace NXml { : Stream(stream) , IsError(false) { - Impl.Reset(xmlReaderForIO(ReadFromInputStreamCallback, nullptr, this, nullptr, nullptr, options.GetMask())); + Impl.Reset(xmlReaderForIO(ReadFromInputStreamCallback, nullptr, this, nullptr, nullptr, options.GetMask())); if (!Impl) { ythrow yexception() << "cannot instantiate underlying xmlTextReader structure"; diff --git a/library/cpp/xml/document/xml-textreader.h b/library/cpp/xml/document/xml-textreader.h index c62b958f78..ab4c329d26 100644 --- a/library/cpp/xml/document/xml-textreader.h +++ b/library/cpp/xml/document/xml-textreader.h @@ -1,7 +1,7 @@ #pragma once #include "xml-document.h" -#include "xml-options.h" +#include "xml-options.h" #include <contrib/libs/libxml/include/libxml/xmlreader.h> diff --git a/library/cpp/xml/document/ya.make b/library/cpp/xml/document/ya.make index d5ba699713..86bbd639cf 100644 --- a/library/cpp/xml/document/ya.make +++ b/library/cpp/xml/document/ya.make @@ -5,7 +5,7 @@ OWNER(finder) SRCS( xml-document.cpp xml-textreader.cpp - xml-options.cpp + xml-options.cpp ) PEERDIR( |