• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/arm-none-eabi/include/c++/4.6.1/bits/
1// class template regex -*- C++ -*-
2
3// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
4//
5// This file is part of the GNU ISO C++ Library.  This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14// GNU General Public License for more details.
15
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
19
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23// <http://www.gnu.org/licenses/>.
24
25/**
26 *  @file bits/regex_constants.h
27 *  @brief Constant definitions for the std regex library.
28 *
29 *  This is an internal header file, included by other library headers.
30 *  Do not attempt to use it directly. @headername{regex}
31 */
32
33namespace std _GLIBCXX_VISIBILITY(default)
34{
35/**
36 * @namespace std::regex_constants
37 * @brief ISO C++-0x entities sub namespace for regex.
38 */
39namespace regex_constants
40{
41_GLIBCXX_BEGIN_NAMESPACE_VERSION
42
43  /**
44   * @name 5.1 Regular Expression Syntax Options
45   */
46  //@{
47  enum __syntax_option
48    {
49      _S_icase,
50      _S_nosubs,
51      _S_optimize,
52      _S_collate,
53      _S_ECMAScript,
54      _S_basic,
55      _S_extended,
56      _S_awk,
57      _S_grep,
58      _S_egrep,
59      _S_syntax_last
60    };
61
62  /**
63   * @brief This is a bitmask type indicating how to interpret the regex.
64   *
65   * The @c syntax_option_type is implementation defined but it is valid to
66   * perform bitwise operations on these values and expect the right thing to
67   * happen.
68   *
69   * A valid value of type syntax_option_type shall have exactly one of the
70   * elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep
71   * %set.
72   */
73  typedef unsigned int syntax_option_type;
74
75  /**
76   * Specifies that the matching of regular expressions against a character
77   * sequence shall be performed without regard to case.
78   */
79  static constexpr syntax_option_type icase      = 1 << _S_icase;
80
81  /**
82   * Specifies that when a regular expression is matched against a character
83   * container sequence, no sub-expression matches are to be stored in the
84   * supplied match_results structure.
85   */
86  static constexpr syntax_option_type nosubs     = 1 << _S_nosubs;
87
88  /**
89   * Specifies that the regular expression engine should pay more attention to
90   * the speed with which regular expressions are matched, and less to the
91   * speed with which regular expression objects are constructed. Otherwise
92   * it has no detectable effect on the program output.
93   */
94  static constexpr syntax_option_type optimize   = 1 << _S_optimize;
95
96  /**
97   * Specifies that character ranges of the form [a-b] should be locale
98   * sensitive.
99   */
100  static constexpr syntax_option_type collate    = 1 << _S_collate;
101
102  /**
103   * Specifies that the grammar recognized by the regular expression engine is
104   * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
105   * Language Specification, Standard Ecma-262, third edition, 1999], as
106   * modified in section [28.13].  This grammar is similar to that defined
107   * in the PERL scripting language but extended with elements found in the
108   * POSIX regular expression grammar.
109   */
110  static constexpr syntax_option_type ECMAScript = 1 << _S_ECMAScript;
111
112  /**
113   * Specifies that the grammar recognized by the regular expression engine is
114   * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
115   * Portable Operating System Interface (POSIX), Base Definitions and
116   * Headers, Section 9, Regular Expressions [IEEE, Information Technology --
117   * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
118   */
119  static constexpr syntax_option_type basic      = 1 << _S_basic;
120
121  /**
122   * Specifies that the grammar recognized by the regular expression engine is
123   * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
124   * Portable Operating System Interface (POSIX), Base Definitions and Headers,
125   * Section 9, Regular Expressions.
126   */
127  static constexpr syntax_option_type extended   = 1 << _S_extended;
128
129  /**
130   * Specifies that the grammar recognized by the regular expression engine is
131   * that used by POSIX utility awk in IEEE Std 1003.1-2001.  This option is
132   * identical to syntax_option_type extended, except that C-style escape
133   * sequences are supported.  These sequences are:
134   * \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\&apos;, &apos;,
135   * and \\ddd (where ddd is one, two, or three octal digits).
136   */
137  static constexpr syntax_option_type awk        = 1 << _S_awk;
138
139  /**
140   * Specifies that the grammar recognized by the regular expression engine is
141   * that used by POSIX utility grep in IEEE Std 1003.1-2001.  This option is
142   * identical to syntax_option_type basic, except that newlines are treated
143   * as whitespace.
144   */
145  static constexpr syntax_option_type grep       = 1 << _S_grep;
146
147  /**
148   * Specifies that the grammar recognized by the regular expression engine is
149   * that used by POSIX utility grep when given the -E option in
150   * IEEE Std 1003.1-2001.  This option is identical to syntax_option_type
151   * extended, except that newlines are treated as whitespace.
152   */
153  static constexpr syntax_option_type egrep      = 1 << _S_egrep;
154
155  //@}
156
157  /**
158   * @name 5.2 Matching Rules
159   *
160   * Matching a regular expression against a sequence of characters [first,
161   * last) proceeds according to the rules of the grammar specified for the
162   * regular expression object, modified according to the effects listed
163   * below for any bitmask elements set.
164   *
165   */
166  //@{
167
168  enum __match_flag
169    {
170      _S_not_bol,
171      _S_not_eol,
172      _S_not_bow,
173      _S_not_eow,
174      _S_any,
175      _S_not_null,
176      _S_continuous,
177      _S_prev_avail,
178      _S_sed,
179      _S_no_copy,
180      _S_first_only,
181      _S_match_flag_last
182    };
183
184  /**
185   * @brief This is a bitmask type indicating regex matching rules.
186   *
187   * The @c match_flag_type is implementation defined but it is valid to
188   * perform bitwise operations on these values and expect the right thing to
189   * happen.
190   */
191  typedef std::bitset<_S_match_flag_last> match_flag_type;
192
193  /**
194   * The default matching rules.
195   */
196  static constexpr match_flag_type match_default     = 0;
197
198  /**
199   * The first character in the sequence [first, last) is treated as though it
200   * is not at the beginning of a line, so the character (^) in the regular
201   * expression shall not match [first, first).
202   */
203  static constexpr match_flag_type match_not_bol     = 1 << _S_not_bol;
204
205  /**
206   * The last character in the sequence [first, last) is treated as though it
207   * is not at the end of a line, so the character ($) in the regular
208   * expression shall not match [last, last).
209   */
210  static constexpr match_flag_type match_not_eol     = 1 << _S_not_eol;
211
212  /**
213   * The expression \\b is not matched against the sub-sequence
214   * [first,first).
215   */
216  static constexpr match_flag_type match_not_bow     = 1 << _S_not_bow;
217
218  /**
219   * The expression \\b should not be matched against the sub-sequence
220   * [last,last).
221   */
222  static constexpr match_flag_type match_not_eow     = 1 << _S_not_eow;
223
224  /**
225   * If more than one match is possible then any match is an acceptable
226   * result.
227   */
228  static constexpr match_flag_type match_any         = 1 << _S_any;
229
230  /**
231   * The expression does not match an empty sequence.
232   */
233  static constexpr match_flag_type match_not_null    = 1 << _S_not_null;
234
235  /**
236   * The expression only matches a sub-sequence that begins at first .
237   */
238  static constexpr match_flag_type match_continuous  = 1 << _S_continuous;
239
240  /**
241   * --first is a valid iterator position.  When this flag is set then the
242   * flags match_not_bol and match_not_bow are ignored by the regular
243   * expression algorithms 28.11 and iterators 28.12.
244   */
245  static constexpr match_flag_type match_prev_avail  = 1 << _S_prev_avail;
246
247  /**
248   * When a regular expression match is to be replaced by a new string, the
249   * new string is constructed using the rules used by the ECMAScript replace
250   * function in ECMA- 262 [Ecma International, ECMAScript Language
251   * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
252   * String.prototype.replace. In addition, during search and replace
253   * operations all non-overlapping occurrences of the regular expression
254   * are located and replaced, and sections of the input that did not match
255   * the expression are copied unchanged to the output string.
256   *
257   * Format strings (from ECMA-262 [15.5.4.11]):
258   * @li $$  The dollar-sign itself ($)
259   * @li $&  The matched substring.
260   * @li $`  The portion of @a string that precedes the matched substring.
261   *         This would be match_results::prefix().
262   * @li $'  The portion of @a string that follows the matched substring.
263   *         This would be match_results::suffix().
264   * @li $n  The nth capture, where n is in [1,9] and $n is not followed by a
265   *         decimal digit.  If n <= match_results::size() and the nth capture
266   *         is undefined, use the empty string instead.  If n >
267   *         match_results::size(), the result is implementation-defined.
268   * @li $nn The nnth capture, where nn is a two-digit decimal number on
269   *         [01, 99].  If nn <= match_results::size() and the nth capture is
270   *         undefined, use the empty string instead. If
271   *         nn > match_results::size(), the result is implementation-defined.
272   */
273  static constexpr match_flag_type format_default    = 0;
274
275  /**
276   * When a regular expression match is to be replaced by a new string, the
277   * new string is constructed using the rules used by the POSIX sed utility
278   * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
279   * Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
280   */
281  static constexpr match_flag_type format_sed        = 1 << _S_sed;
282
283  /**
284   * During a search and replace operation, sections of the character
285   * container sequence being searched that do not match the regular
286   * expression shall not be copied to the output string.
287   */
288  static constexpr match_flag_type format_no_copy    = 1 << _S_no_copy;
289
290  /**
291   * When specified during a search and replace operation, only the first
292   * occurrence of the regular expression shall be replaced.
293   */
294  static constexpr match_flag_type format_first_only = 1 << _S_first_only;
295
296  //@}
297
298_GLIBCXX_END_NAMESPACE_VERSION
299} // namespace regex_constants
300} // namespace
301
302