blob: d352d0f426b378d7139ea05dd09142a9cf4e6c76 [file] [log] [blame]
Jeff Thompson86b6d642013-10-17 15:01:56 -07001/*
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 <ndnboost/version.hpp>
16 * DESCRIPTION: Declares match_flags type.
17 */
18
19#ifndef NDNBOOST_REGEX_V4_MATCH_FLAGS
20#define NDNBOOST_REGEX_V4_MATCH_FLAGS
21
22#ifdef __cplusplus
23# include <ndnboost/cstdint.hpp>
24#endif
25
26#ifdef __cplusplus
27namespace ndnboost{
28 namespace regex_constants{
29#endif
30
31typedef enum _match_flags
32{
33 match_default = 0,
34 match_not_bol = 1, /* first is not start of line */
35 match_not_eol = match_not_bol << 1, /* last is not end of line */
36 match_not_bob = match_not_eol << 1, /* first is not start of buffer */
37 match_not_eob = match_not_bob << 1, /* last is not end of buffer */
38 match_not_bow = match_not_eob << 1, /* first is not start of word */
39 match_not_eow = match_not_bow << 1, /* last is not end of word */
40 match_not_dot_newline = match_not_eow << 1, /* \n is not matched by '.' */
41 match_not_dot_null = match_not_dot_newline << 1, /* '\0' is not matched by '.' */
42 match_prev_avail = match_not_dot_null << 1, /* *--first is a valid expression */
43 match_init = match_prev_avail << 1, /* internal use */
44 match_any = match_init << 1, /* don't care what we match */
45 match_not_null = match_any << 1, /* string can't be null */
46 match_continuous = match_not_null << 1, /* each grep match must continue from */
47 /* uninterupted from the previous one */
48 match_partial = match_continuous << 1, /* find partial matches */
49
50 match_stop = match_partial << 1, /* stop after first match (grep) V3 only */
51 match_not_initial_null = match_stop, /* don't match initial null, V4 only */
52 match_all = match_stop << 1, /* must find the whole of input even if match_any is set */
53 match_perl = match_all << 1, /* Use perl matching rules */
54 match_posix = match_perl << 1, /* Use POSIX matching rules */
55 match_nosubs = match_posix << 1, /* don't trap marked subs */
56 match_extra = match_nosubs << 1, /* include full capture information for repeated captures */
57 match_single_line = match_extra << 1, /* treat text as single line and ignor any \n's when matching ^ and $. */
58 match_unused1 = match_single_line << 1, /* unused */
59 match_unused2 = match_unused1 << 1, /* unused */
60 match_unused3 = match_unused2 << 1, /* unused */
61 match_max = match_unused3,
62
63 format_perl = 0, /* perl style replacement */
64 format_default = 0, /* ditto. */
65 format_sed = match_max << 1, /* sed style replacement. */
66 format_all = format_sed << 1, /* enable all extentions to sytax. */
67 format_no_copy = format_all << 1, /* don't copy non-matching segments. */
68 format_first_only = format_no_copy << 1, /* Only replace first occurance. */
69 format_is_if = format_first_only << 1, /* internal use only. */
70 format_literal = format_is_if << 1 /* treat string as a literal */
71
72} match_flags;
73
74#if (defined(_MSC_VER) && (_MSC_VER < 1300)) || defined(__BORLANDC__)
75typedef unsigned long match_flag_type;
76#else
77typedef match_flags match_flag_type;
78
79
80#ifdef __cplusplus
81inline match_flags operator&(match_flags m1, match_flags m2)
82{ return static_cast<match_flags>(static_cast<ndnboost::int32_t>(m1) & static_cast<ndnboost::int32_t>(m2)); }
83inline match_flags operator|(match_flags m1, match_flags m2)
84{ return static_cast<match_flags>(static_cast<ndnboost::int32_t>(m1) | static_cast<ndnboost::int32_t>(m2)); }
85inline match_flags operator^(match_flags m1, match_flags m2)
86{ return static_cast<match_flags>(static_cast<ndnboost::int32_t>(m1) ^ static_cast<ndnboost::int32_t>(m2)); }
87inline match_flags operator~(match_flags m1)
88{ return static_cast<match_flags>(~static_cast<ndnboost::int32_t>(m1)); }
89inline match_flags& operator&=(match_flags& m1, match_flags m2)
90{ m1 = m1&m2; return m1; }
91inline match_flags& operator|=(match_flags& m1, match_flags m2)
92{ m1 = m1|m2; return m1; }
93inline match_flags& operator^=(match_flags& m1, match_flags m2)
94{ m1 = m1^m2; return m1; }
95#endif
96#endif
97
98#ifdef __cplusplus
99} /* namespace regex_constants */
100/*
101 * import names into boost for backwards compatiblity:
102 */
103using regex_constants::match_flag_type;
104using regex_constants::match_default;
105using regex_constants::match_not_bol;
106using regex_constants::match_not_eol;
107using regex_constants::match_not_bob;
108using regex_constants::match_not_eob;
109using regex_constants::match_not_bow;
110using regex_constants::match_not_eow;
111using regex_constants::match_not_dot_newline;
112using regex_constants::match_not_dot_null;
113using regex_constants::match_prev_avail;
114/* using regex_constants::match_init; */
115using regex_constants::match_any;
116using regex_constants::match_not_null;
117using regex_constants::match_continuous;
118using regex_constants::match_partial;
119/*using regex_constants::match_stop; */
120using regex_constants::match_all;
121using regex_constants::match_perl;
122using regex_constants::match_posix;
123using regex_constants::match_nosubs;
124using regex_constants::match_extra;
125using regex_constants::match_single_line;
126/*using regex_constants::match_max; */
127using regex_constants::format_all;
128using regex_constants::format_sed;
129using regex_constants::format_perl;
130using regex_constants::format_default;
131using regex_constants::format_no_copy;
132using regex_constants::format_first_only;
133/*using regex_constants::format_is_if;*/
134
135} /* namespace ndnboost */
136#endif /* __cplusplus */
137#endif /* include guard */
138