include/boost/regex/v5/match_flags.hpp

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