diff options
| author | Arslan Urtashev <[email protected]> | 2022-02-10 16:48:55 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:48:55 +0300 | 
| commit | 1136f2ce7cce7bcc84e695272c0d92d4eb900c2b (patch) | |
| tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/xml/document | |
| parent | b97740540e7302cec9efa181e106ae1990a0cc1c (diff) | |
Restoring authorship annotation for Arslan Urtashev <[email protected]>. 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 856b6ad796a..e955448c66a 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 f84e601b98f..74e7545de3b 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 b81fb8c88d0..bb07da0cfbb 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 99a5d877a8c..9be16baf3d3 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 0dbfe761fad..b946f1fbf2f 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 c62b958f78d..ab4c329d26d 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 d5ba6997139..86bbd639cf8 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( | 
