aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/xml/document/xml-options.h
blob: bb07da0cfbbb850e2e5b2b01357c3d9424c5e14e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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;
    };

}