diff options
Diffstat (limited to 'libstdc++-v3/include/bits/regex.h')
-rw-r--r-- | libstdc++-v3/include/bits/regex.h | 142 |
1 files changed, 65 insertions, 77 deletions
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index 0bb88cb6afb..32e7159eec9 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -39,12 +39,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 class match_results; _GLIBCXX_END_NAMESPACE_CXX11 -_GLIBCXX_END_NAMESPACE_VERSION namespace __detail { -_GLIBCXX_BEGIN_NAMESPACE_VERSION - enum class _RegexExecutorPolicy : int { _S_auto, _S_alternate }; @@ -53,19 +50,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RegexExecutorPolicy __policy, bool __match_mode> bool - __regex_algo_impl(_BiIter __s, - _BiIter __e, + __regex_algo_impl(_BiIter __s, + _BiIter __e, match_results<_BiIter, _Alloc>& __m, const basic_regex<_CharT, _TraitsT>& __re, regex_constants::match_flag_type __flags); template<typename, typename, typename, bool> class _Executor; - -_GLIBCXX_END_NAMESPACE_VERSION } -_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_CXX11 /** @@ -87,9 +81,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 struct regex_traits { public: - typedef _Ch_type char_type; - typedef std::basic_string<char_type> string_type; - typedef std::locale locale_type; + typedef _Ch_type char_type; + typedef std::basic_string<char_type> string_type; + typedef std::locale locale_type; private: struct _RegexMask { @@ -397,8 +391,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 "regex traits class must have the same char_type"); // types: - typedef _Ch_type value_type; - typedef _Rx_traits traits_type; + typedef _Ch_type value_type; + typedef _Rx_traits traits_type; typedef typename traits_type::string_type string_type; typedef regex_constants::syntax_option_type flag_type; typedef typename traits_type::locale_type locale_type; @@ -771,20 +765,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 template<typename _Bp, typename _Ap, typename _Cp, typename _Rp, __detail::_RegexExecutorPolicy, bool> - friend bool __detail:: -#if _GLIBCXX_INLINE_VERSION - __8:: // Required due to PR c++/59256 -#endif - __regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, - const basic_regex<_Cp, _Rp>&, - regex_constants::match_flag_type); + friend bool + __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, + const basic_regex<_Cp, _Rp>&, + regex_constants::match_flag_type); template<typename, typename, typename, bool> friend class __detail::_Executor; - flag_type _M_flags; - locale_type _M_loc; - _AutomatonPtr _M_automaton; + flag_type _M_flags; + locale_type _M_loc; + _AutomatonPtr _M_automaton; }; #if __cpp_deduction_guides >= 201606 @@ -837,8 +828,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 public: typedef typename __iter_traits::value_type value_type; typedef typename __iter_traits::difference_type difference_type; - typedef _BiIter iterator; - typedef std::basic_string<value_type> string_type; + typedef _BiIter iterator; + typedef std::basic_string<value_type> string_type; bool matched; @@ -923,14 +914,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 /** @brief Standard regex submatch over a C-style null-terminated string. */ - typedef sub_match<const char*> csub_match; + typedef sub_match<const char*> csub_match; /** @brief Standard regex submatch over a standard string. */ typedef sub_match<string::const_iterator> ssub_match; #ifdef _GLIBCXX_USE_WCHAR_T /** @brief Regex submatch over a C-style null-terminated wide string. */ - typedef sub_match<const wchar_t*> wcsub_match; + typedef sub_match<const wchar_t*> wcsub_match; /** @brief Regex submatch over a standard wide string. */ typedef sub_match<wstring::const_iterator> wssub_match; @@ -1548,16 +1539,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * @name 10.? Public Types */ //@{ - typedef sub_match<_Bi_iter> value_type; - typedef const value_type& const_reference; - typedef const_reference reference; - typedef typename _Base_type::const_iterator const_iterator; - typedef const_iterator iterator; + typedef sub_match<_Bi_iter> value_type; + typedef const value_type& const_reference; + typedef const_reference reference; + typedef typename _Base_type::const_iterator const_iterator; + typedef const_iterator iterator; typedef typename __iter_traits::difference_type difference_type; typedef typename allocator_traits<_Alloc>::size_type size_type; - typedef _Alloc allocator_type; + typedef _Alloc allocator_type; typedef typename __iter_traits::value_type char_type; - typedef std::basic_string<char_type> string_type; + typedef std::basic_string<char_type> string_type; //@} public: @@ -1872,13 +1863,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 template<typename _Bp, typename _Ap, typename _Cp, typename _Rp, __detail::_RegexExecutorPolicy, bool> - friend bool __detail:: -#if _GLIBCXX_INLINE_VERSION - __8:: // Required due to PR c++/59256 -#endif - __regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, - const basic_regex<_Cp, _Rp>&, - regex_constants::match_flag_type); + friend bool + __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, + const basic_regex<_Cp, _Rp>&, + regex_constants::match_flag_type); void _M_resize(unsigned int __size) @@ -1911,10 +1899,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _Bi_iter _M_begin; }; - typedef match_results<const char*> cmatch; - typedef match_results<string::const_iterator> smatch; + typedef match_results<const char*> cmatch; + typedef match_results<string::const_iterator> smatch; #ifdef _GLIBCXX_USE_WCHAR_T - typedef match_results<const wchar_t*> wcmatch; + typedef match_results<const wchar_t*> wcmatch; typedef match_results<wstring::const_iterator> wsmatch; #endif @@ -1994,11 +1982,11 @@ _GLIBCXX_END_NAMESPACE_CXX11 template<typename _Bi_iter, typename _Alloc, typename _Ch_type, typename _Rx_traits> inline bool - regex_match(_Bi_iter __s, - _Bi_iter __e, - match_results<_Bi_iter, _Alloc>& __m, + regex_match(_Bi_iter __s, + _Bi_iter __e, + match_results<_Bi_iter, _Alloc>& __m, const basic_regex<_Ch_type, _Rx_traits>& __re, - regex_constants::match_flag_type __flags + regex_constants::match_flag_type __flags = regex_constants::match_default) { return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits, @@ -2452,11 +2440,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { public: typedef basic_regex<_Ch_type, _Rx_traits> regex_type; - typedef match_results<_Bi_iter> value_type; - typedef std::ptrdiff_t difference_type; - typedef const value_type* pointer; - typedef const value_type& reference; - typedef std::forward_iterator_tag iterator_category; + typedef match_results<_Bi_iter> value_type; + typedef std::ptrdiff_t difference_type; + typedef const value_type* pointer; + typedef const value_type& reference; + typedef std::forward_iterator_tag iterator_category; /** * @brief Provides a singular iterator, useful for indicating @@ -2543,18 +2531,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } private: - _Bi_iter _M_begin; - _Bi_iter _M_end; - const regex_type* _M_pregex; - regex_constants::match_flag_type _M_flags; - match_results<_Bi_iter> _M_match; + _Bi_iter _M_begin; + _Bi_iter _M_end; + const regex_type* _M_pregex; + regex_constants::match_flag_type _M_flags; + match_results<_Bi_iter> _M_match; }; - typedef regex_iterator<const char*> cregex_iterator; - typedef regex_iterator<string::const_iterator> sregex_iterator; + typedef regex_iterator<const char*> cregex_iterator; + typedef regex_iterator<string::const_iterator> sregex_iterator; #ifdef _GLIBCXX_USE_WCHAR_T - typedef regex_iterator<const wchar_t*> wcregex_iterator; - typedef regex_iterator<wstring::const_iterator> wsregex_iterator; + typedef regex_iterator<const wchar_t*> wcregex_iterator; + typedef regex_iterator<wstring::const_iterator> wsregex_iterator; #endif // [7.12.2] Class template regex_token_iterator @@ -2571,12 +2559,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 class regex_token_iterator { public: - typedef basic_regex<_Ch_type, _Rx_traits> regex_type; - typedef sub_match<_Bi_iter> value_type; - typedef std::ptrdiff_t difference_type; - typedef const value_type* pointer; - typedef const value_type& reference; - typedef std::forward_iterator_tag iterator_category; + typedef basic_regex<_Ch_type, _Rx_traits> regex_type; + typedef sub_match<_Bi_iter> value_type; + typedef std::ptrdiff_t difference_type; + typedef const value_type* pointer; + typedef const value_type& reference; + typedef std::forward_iterator_tag iterator_category; public: /** @@ -2778,25 +2766,25 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _M_result = nullptr; } - _Position _M_position; - std::vector<int> _M_subs; - value_type _M_suffix; - std::size_t _M_n; - const value_type* _M_result; + _Position _M_position; + std::vector<int> _M_subs; + value_type _M_suffix; + std::size_t _M_n; + const value_type* _M_result; // Show whether _M_subs contains -1 - bool _M_has_m1; + bool _M_has_m1; }; /** @brief Token iterator for C-style NULL-terminated strings. */ - typedef regex_token_iterator<const char*> cregex_token_iterator; + typedef regex_token_iterator<const char*> cregex_token_iterator; /** @brief Token iterator for standard strings. */ - typedef regex_token_iterator<string::const_iterator> sregex_token_iterator; + typedef regex_token_iterator<string::const_iterator> sregex_token_iterator; #ifdef _GLIBCXX_USE_WCHAR_T /** @brief Token iterator for C-style NULL-terminated wide strings. */ - typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator; + typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator; /** @brief Token iterator for standard wide-character strings. */ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; |