xml-options.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #include <contrib/libs/libxml/include/libxml/parser.h>
  3. namespace NXml {
  4. enum class EOption : int {
  5. // clang-format off
  6. Recover = XML_PARSE_RECOVER,
  7. NoEnt = XML_PARSE_NOENT,
  8. DTDLoad = XML_PARSE_DTDLOAD,
  9. DTDAttr = XML_PARSE_DTDATTR,
  10. DTDValid = XML_PARSE_DTDVALID,
  11. NoError = XML_PARSE_NOERROR,
  12. NoWarning = XML_PARSE_NOWARNING,
  13. Pedantic = XML_PARSE_PEDANTIC,
  14. NoBlanks = XML_PARSE_NOBLANKS,
  15. SAX1 = XML_PARSE_SAX1,
  16. XInclude = XML_PARSE_XINCLUDE,
  17. NoNet = XML_PARSE_NONET,
  18. NoDict = XML_PARSE_NODICT,
  19. NSClean = XML_PARSE_NSCLEAN,
  20. NoCData = XML_PARSE_NOCDATA,
  21. NoXInclude = XML_PARSE_NOXINCNODE,
  22. Compact = XML_PARSE_COMPACT,
  23. Old10 = XML_PARSE_OLD10,
  24. NoBaseFix = XML_PARSE_NOBASEFIX,
  25. Huge = XML_PARSE_HUGE,
  26. OldSAX = XML_PARSE_OLDSAX,
  27. IgnoreEnc = XML_PARSE_IGNORE_ENC,
  28. BigLines = XML_PARSE_BIG_LINES,
  29. // clang-format on
  30. };
  31. class TOptions {
  32. public:
  33. TOptions()
  34. : Mask(0)
  35. {
  36. }
  37. template <typename... TArgs>
  38. TOptions(TArgs... args)
  39. : Mask(0)
  40. {
  41. Set(args...);
  42. }
  43. TOptions& Set(EOption option) {
  44. Mask |= static_cast<int>(option);
  45. return *this;
  46. }
  47. template <typename... TArgs>
  48. TOptions& Set(EOption arg, TArgs... args) {
  49. Set(arg);
  50. return Set(args...);
  51. }
  52. int GetMask() const {
  53. return Mask;
  54. }
  55. private:
  56. int Mask;
  57. };
  58. }