Commit 6646d624 by Tim Shen Committed by Tim Shen

regex_constants.h: Change syntax_option_type to enum type.

2013-08-09  Tim Shen  <timshen91@gmail.com>

	* include/bits/regex_constants.h: Change syntax_option_type to enum
	type.

From-SVN: r201621
parent 03b0ee0a
2013-08-09 Tim Shen <timshen91@gmail.com>
* include/bits/regex_constants.h: Change syntax_option_type to enum
type.
2013-08-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* include/bits/regex.h: Replace _A, _B, _C, _R by _Ap, _Bp,
......
......@@ -77,20 +77,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep
* %set.
*/
typedef unsigned int syntax_option_type;
enum syntax_option_type
{
/**
* Specifies that the matching of regular expressions against a character
* sequence shall be performed without regard to case.
*/
constexpr syntax_option_type icase = 1 << _S_icase;
icase = 1 << _S_icase,
/**
* Specifies that when a regular expression is matched against a character
* container sequence, no sub-expression matches are to be stored in the
* supplied match_results structure.
*/
constexpr syntax_option_type nosubs = 1 << _S_nosubs;
nosubs = 1 << _S_nosubs,
/**
* Specifies that the regular expression engine should pay more attention to
......@@ -98,13 +98,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* speed with which regular expression objects are constructed. Otherwise
* it has no detectable effect on the program output.
*/
constexpr syntax_option_type optimize = 1 << _S_optimize;
optimize = 1 << _S_optimize,
/**
* Specifies that character ranges of the form [a-b] should be locale
* sensitive.
*/
constexpr syntax_option_type collate = 1 << _S_collate;
collate = 1 << _S_collate,
/**
* Specifies that the grammar recognized by the regular expression engine is
......@@ -114,7 +114,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* in the PERL scripting language but extended with elements found in the
* POSIX regular expression grammar.
*/
constexpr syntax_option_type ECMAScript = 1 << _S_ECMAScript;
ECMAScript = 1 << _S_ECMAScript,
/**
* Specifies that the grammar recognized by the regular expression engine is
......@@ -123,7 +123,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Headers, Section 9, Regular Expressions [IEEE, Information Technology --
* Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
*/
constexpr syntax_option_type basic = 1 << _S_basic;
basic = 1 << _S_basic,
/**
* Specifies that the grammar recognized by the regular expression engine is
......@@ -131,17 +131,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Portable Operating System Interface (POSIX), Base Definitions and Headers,
* Section 9, Regular Expressions.
*/
constexpr syntax_option_type extended = 1 << _S_extended;
extended = 1 << _S_extended,
/**
* Specifies that the grammar recognized by the regular expression engine is
* that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
* identical to syntax_option_type extended, except that C-style escape
* sequences are supported. These sequences are:
* \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\&apos;, &apos;,
* \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\&apos,, &apos,,
* and \\ddd (where ddd is one, two, or three octal digits).
*/
constexpr syntax_option_type awk = 1 << _S_awk;
awk = 1 << _S_awk,
/**
* Specifies that the grammar recognized by the regular expression engine is
......@@ -149,7 +149,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* identical to syntax_option_type basic, except that newlines are treated
* as whitespace.
*/
constexpr syntax_option_type grep = 1 << _S_grep;
grep = 1 << _S_grep,
/**
* Specifies that the grammar recognized by the regular expression engine is
......@@ -157,7 +157,45 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* IEEE Std 1003.1-2001. This option is identical to syntax_option_type
* extended, except that newlines are treated as whitespace.
*/
constexpr syntax_option_type egrep = 1 << _S_egrep;
egrep = 1 << _S_egrep,
};
constexpr inline syntax_option_type
operator&(syntax_option_type __a, syntax_option_type __b)
{
return (syntax_option_type)(static_cast<unsigned int>(__a)
& static_cast<unsigned int>(__b));
}
constexpr inline syntax_option_type
operator|(syntax_option_type __a, syntax_option_type __b)
{
return (syntax_option_type)(static_cast<unsigned int>(__a)
| static_cast<unsigned int>(__b));
}
constexpr inline syntax_option_type
operator^(syntax_option_type __a, syntax_option_type __b)
{
return (syntax_option_type)(static_cast<unsigned int>(__a)
^ static_cast<unsigned int>(__b));
}
constexpr inline syntax_option_type
operator~(syntax_option_type __a)
{ return (syntax_option_type)(~static_cast<unsigned int>(__a)); }
inline syntax_option_type&
operator&=(syntax_option_type& __a, syntax_option_type __b)
{ return __a = __a & __b; }
inline syntax_option_type&
operator|=(syntax_option_type& __a, syntax_option_type __b)
{ return __a = __a | __b; }
inline syntax_option_type&
operator^=(syntax_option_type& __a, syntax_option_type __b)
{ return __a = __a ^ __b; }
//@}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment