match_flags.hpp 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. *
  3. * Copyright (c) 1998-2002
  4. * John Maddock
  5. *
  6. * Use, modification and distribution are subject to the
  7. * Boost Software License, Version 1.0. (See accompanying file
  8. * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. *
  10. */
  11. /*
  12. * LOCATION: see http://www.boost.org for most recent version.
  13. * FILE match_flags.hpp
  14. * VERSION see <boost/version.hpp>
  15. * DESCRIPTION: Declares match_flags type.
  16. */
  17. #ifndef BOOST_REGEX_V5_MATCH_FLAGS
  18. #define BOOST_REGEX_V5_MATCH_FLAGS
  19. #ifndef BOOST_REGEX_AS_MODULE
  20. #ifdef __cplusplus
  21. # include <cstdint>
  22. #endif
  23. #endif
  24. #ifdef __cplusplus
  25. namespace boost{
  26. namespace regex_constants{
  27. #endif
  28. #ifdef BOOST_REGEX_MSVC
  29. #pragma warning(push)
  30. #if BOOST_REGEX_MSVC >= 1800
  31. #pragma warning(disable : 26812)
  32. #endif
  33. #endif
  34. BOOST_REGEX_MODULE_EXPORT typedef enum _match_flags
  35. {
  36. match_default = 0,
  37. match_not_bol = 1, /* first is not start of line */
  38. match_not_eol = match_not_bol << 1, /* last is not end of line */
  39. match_not_bob = match_not_eol << 1, /* first is not start of buffer */
  40. match_not_eob = match_not_bob << 1, /* last is not end of buffer */
  41. match_not_bow = match_not_eob << 1, /* first is not start of word */
  42. match_not_eow = match_not_bow << 1, /* last is not end of word */
  43. match_not_dot_newline = match_not_eow << 1, /* \n is not matched by '.' */
  44. match_not_dot_null = match_not_dot_newline << 1, /* '\0' is not matched by '.' */
  45. match_prev_avail = match_not_dot_null << 1, /* *--first is a valid expression */
  46. match_init = match_prev_avail << 1, /* internal use */
  47. match_any = match_init << 1, /* don't care what we match */
  48. match_not_null = match_any << 1, /* string can't be null */
  49. match_continuous = match_not_null << 1, /* each grep match must continue from */
  50. /* uninterrupted from the previous one */
  51. match_partial = match_continuous << 1, /* find partial matches */
  52. match_stop = match_partial << 1, /* stop after first match (grep) V3 only */
  53. match_not_initial_null = match_stop, /* don't match initial null, V4 only */
  54. match_all = match_stop << 1, /* must find the whole of input even if match_any is set */
  55. match_perl = match_all << 1, /* Use perl matching rules */
  56. match_posix = match_perl << 1, /* Use POSIX matching rules */
  57. match_nosubs = match_posix << 1, /* don't trap marked subs */
  58. match_extra = match_nosubs << 1, /* include full capture information for repeated captures */
  59. match_single_line = match_extra << 1, /* treat text as single line and ignore any \n's when matching ^ and $. */
  60. match_unused1 = match_single_line << 1, /* unused */
  61. match_unused2 = match_unused1 << 1, /* unused */
  62. match_unused3 = match_unused2 << 1, /* unused */
  63. match_max = match_unused3,
  64. format_perl = 0, /* perl style replacement */
  65. format_default = 0, /* ditto. */
  66. format_sed = match_max << 1, /* sed style replacement. */
  67. format_all = format_sed << 1, /* enable all extensions to syntax. */
  68. format_no_copy = format_all << 1, /* don't copy non-matching segments. */
  69. format_first_only = format_no_copy << 1, /* Only replace first occurrence. */
  70. format_is_if = format_first_only << 1, /* internal use only. */
  71. format_literal = format_is_if << 1, /* treat string as a literal */
  72. match_not_any = match_not_bol | match_not_eol | match_not_bob
  73. | match_not_eob | match_not_bow | match_not_eow | match_not_dot_newline
  74. | match_not_dot_null | match_prev_avail | match_init | match_not_null
  75. | match_continuous | match_partial | match_stop | match_not_initial_null
  76. | match_stop | match_all | match_perl | match_posix | match_nosubs
  77. | match_extra | match_single_line | match_unused1 | match_unused2
  78. | match_unused3 | match_max | format_perl | format_default | format_sed
  79. | format_all | format_no_copy | format_first_only | format_is_if
  80. | format_literal
  81. } match_flags;
  82. BOOST_REGEX_MODULE_EXPORT typedef match_flags match_flag_type;
  83. #ifdef __cplusplus
  84. BOOST_REGEX_MODULE_EXPORT inline match_flags operator&(match_flags m1, match_flags m2)
  85. { return static_cast<match_flags>(static_cast<std::int32_t>(m1) & static_cast<std::int32_t>(m2)); }
  86. BOOST_REGEX_MODULE_EXPORT inline match_flags operator|(match_flags m1, match_flags m2)
  87. { return static_cast<match_flags>(static_cast<std::int32_t>(m1) | static_cast<std::int32_t>(m2)); }
  88. BOOST_REGEX_MODULE_EXPORT inline match_flags operator^(match_flags m1, match_flags m2)
  89. { return static_cast<match_flags>(static_cast<std::int32_t>(m1) ^ static_cast<std::int32_t>(m2)); }
  90. BOOST_REGEX_MODULE_EXPORT inline match_flags operator~(match_flags m1)
  91. { return static_cast<match_flags>(~static_cast<std::int32_t>(m1) & static_cast<std::int32_t>(match_not_any)); }
  92. BOOST_REGEX_MODULE_EXPORT inline match_flags& operator&=(match_flags& m1, match_flags m2)
  93. { m1 = m1&m2; return m1; }
  94. BOOST_REGEX_MODULE_EXPORT inline match_flags& operator|=(match_flags& m1, match_flags m2)
  95. { m1 = m1|m2; return m1; }
  96. BOOST_REGEX_MODULE_EXPORT inline match_flags& operator^=(match_flags& m1, match_flags m2)
  97. { m1 = m1^m2; return m1; }
  98. #endif
  99. #ifdef __cplusplus
  100. } /* namespace regex_constants */
  101. /*
  102. * import names into boost for backwards compatibility:
  103. */
  104. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_flag_type;
  105. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_default;
  106. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_not_bol;
  107. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_not_eol;
  108. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_not_bob;
  109. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_not_eob;
  110. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_not_bow;
  111. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_not_eow;
  112. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_not_dot_newline;
  113. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_not_dot_null;
  114. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_prev_avail;
  115. /* using regex_constants::match_init; */
  116. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_any;
  117. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_not_null;
  118. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_continuous;
  119. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_partial;
  120. /*using regex_constants::match_stop; */
  121. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_all;
  122. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_perl;
  123. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_posix;
  124. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_nosubs;
  125. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_extra;
  126. BOOST_REGEX_MODULE_EXPORT using regex_constants::match_single_line;
  127. /*using regex_constants::match_max; */
  128. BOOST_REGEX_MODULE_EXPORT using regex_constants::format_all;
  129. BOOST_REGEX_MODULE_EXPORT using regex_constants::format_sed;
  130. BOOST_REGEX_MODULE_EXPORT using regex_constants::format_perl;
  131. BOOST_REGEX_MODULE_EXPORT using regex_constants::format_default;
  132. BOOST_REGEX_MODULE_EXPORT using regex_constants::format_no_copy;
  133. BOOST_REGEX_MODULE_EXPORT using regex_constants::format_first_only;
  134. /*using regex_constants::format_is_if;*/
  135. #ifdef BOOST_REGEX_MSVC
  136. #pragma warning(pop)
  137. #endif
  138. } /* namespace boost */
  139. #endif /* __cplusplus */
  140. #endif /* include guard */