31 namespace std _GLIBCXX_VISIBILITY(default)
33 _GLIBCXX_BEGIN_NAMESPACE_VERSION
52 template<
typename _Ch_type>
56 typedef _Ch_type char_type;
59 typedef std::ctype_base::mask char_class_type;
80 {
return string_type::traits_type::length(__p); }
107 return use_facet<ctype<char_type> >(_M_locale).
tolower(__c);
130 template<
typename _Fwd_iter>
156 template<
typename _Fwd_iter>
174 template<
typename _Fwd_iter>
217 template<
typename _Fwd_iter>
220 bool __icase =
false)
const
236 isctype(_Ch_type __c, char_class_type __f)
const;
249 value(_Ch_type __ch,
int __radix)
const;
265 std::swap(_M_locale, __loc);
275 {
return _M_locale; }
278 locale_type _M_locale;
281 template<
typename _Ch_type>
284 isctype(_Ch_type __c, char_class_type __f)
const
291 if (__ctype.
is(__f, __c))
295 if (__c == __ctype.
widen(
'_'))
297 const char __wb[] =
"w";
298 char_class_type __wt = this->lookup_classname(__wb,
299 __wb +
sizeof(__wb));
305 if (__ctype.
is(std::ctype_base::space, __c))
307 const char __bb[] =
"blank";
308 char_class_type __bt = this->lookup_classname(__bb,
309 __bb +
sizeof(__bb));
317 template<
typename _Ch_type>
320 value(_Ch_type __ch,
int __radix)
const
326 else if (__radix == 16)
329 return __is.
fail() ? -1 : __v;
340 template<
typename _Ch_type,
typename _Rx_traits = regex_traits<_Ch_type> >
345 typedef _Ch_type value_type;
346 typedef _Rx_traits traits_type;
347 typedef typename traits_type::string_type string_type;
349 typedef typename traits_type::locale_type locale_type;
384 : _M_flags(regex_constants::ECMAScript),
385 _M_automaton(__regex::__compile<const _Ch_type*, _Rx_traits>(0, 0,
386 _M_traits, _M_flags))
404 _M_automaton(__regex::__compile(__p, __p + _Rx_traits::length(__p),
405 _M_traits, _M_flags))
419 basic_regex(
const _Ch_type* __p, std::size_t __len, flag_type __f)
421 _M_automaton(__regex::__compile(__p, __p + __len, _M_traits, _M_flags))
430 : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits),
431 _M_automaton(__rhs._M_automaton)
440 : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits),
441 _M_automaton(std::move(__rhs._M_automaton))
453 template<
typename _Ch_traits,
typename _Ch_alloc>
459 _M_automaton(__regex::__compile(__s.
begin(), __s.
end(),
460 _M_traits, _M_flags))
476 template<
typename _InputIterator>
480 _M_automaton(__regex::__compile(__first, __last, _M_traits, _M_flags))
494 _M_automaton(__regex::__compile(__l.
begin(), __l.
end(),
495 _M_traits, _M_flags))
509 {
return this->
assign(__rhs); }
516 {
return this->
assign(std::move(__rhs)); }
535 template<
typename _Ch_typeraits,
typename _Allocator>
583 {
return this->
assign(string_type(__p), __flags); }
599 assign(
const _Ch_type* __p, std::size_t __len, flag_type __flags)
600 {
return this->
assign(string_type(__p, __len), __flags); }
613 template<
typename _Ch_typeraits,
typename _Allocator>
636 template<
typename _InputIterator>
638 assign(_InputIterator __first, _InputIterator __last,
640 {
return this->
assign(string_type(__first, __last), __flags); }
655 {
return this->
assign(__l.begin(), __l.end(), __f); }
664 {
return _M_automaton->_M_sub_count() - 1; }
682 {
return _M_traits.imbue(__loc); }
690 {
return _M_traits.getloc(); }
701 std::swap(_M_flags, __rhs._M_flags);
702 std::swap(_M_traits, __rhs._M_traits);
703 std::swap(_M_automaton, __rhs._M_automaton);
706 #ifdef _GLIBCXX_DEBUG
709 { _M_automaton->_M_dot(__ostr); }
712 const __regex::_AutomatonPtr&
713 _M_get_automaton()
const
714 {
return _M_automaton; }
718 _Rx_traits _M_traits;
719 __regex::_AutomatonPtr _M_automaton;
724 #ifdef _GLIBCXX_USE_WCHAR_T
736 template<
typename _Ch_type,
typename _Rx_traits>
740 { __lhs.
swap(__rhs); }
756 template<
typename _BiIter>
760 typedef typename iterator_traits<_BiIter>::value_type value_type;
761 typedef typename iterator_traits<_BiIter>::difference_type
763 typedef _BiIter iterator;
853 #ifdef _GLIBCXX_USE_WCHAR_T
868 template<
typename _BiIter>
872 {
return __lhs.
compare(__rhs) == 0; }
880 template<
typename _BiIter>
884 {
return __lhs.
compare(__rhs) != 0; }
892 template<
typename _BiIter>
894 operator<(const sub_match<_BiIter>& __lhs,
896 {
return __lhs.
compare(__rhs) < 0; }
904 template<
typename _BiIter>
906 operator<=(const sub_match<_BiIter>& __lhs,
908 {
return __lhs.
compare(__rhs) <= 0; }
916 template<
typename _BiIter>
920 {
return __lhs.
compare(__rhs) >= 0; }
928 template<
typename _BiIter>
932 {
return __lhs.
compare(__rhs) > 0; }
941 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
944 typename iterator_traits<_Bi_iter>::value_type,
945 _Ch_traits, _Ch_alloc>& __lhs,
947 {
return __rhs.
compare(__lhs.c_str()) == 0; }
956 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
959 typename iterator_traits<_Bi_iter>::value_type,
961 {
return !(__lhs == __rhs); }
969 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
972 typename iterator_traits<_Bi_iter>::value_type,
974 {
return __rhs.
compare(__lhs.c_str()) > 0; }
982 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
985 typename iterator_traits<_Bi_iter>::value_type,
987 {
return __rhs < __lhs; }
995 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
998 typename iterator_traits<_Bi_iter>::value_type,
1000 {
return !(__lhs < __rhs); }
1008 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1011 typename iterator_traits<_Bi_iter>::value_type,
1013 {
return !(__rhs < __lhs); }
1022 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1026 typename iterator_traits<_Bi_iter>::value_type,
1027 _Ch_traits, _Ch_alloc>& __rhs)
1028 {
return __lhs.
compare(__rhs.c_str()) == 0; }
1037 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1041 typename iterator_traits<_Bi_iter>::value_type,
1042 _Ch_traits, _Ch_alloc>& __rhs)
1043 {
return !(__lhs == __rhs); }
1051 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1053 operator<(const sub_match<_Bi_iter>& __lhs,
1055 typename iterator_traits<_Bi_iter>::value_type,
1056 _Ch_traits, _Ch_alloc>& __rhs)
1057 {
return __lhs.
compare(__rhs.c_str()) < 0; }
1065 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1069 typename iterator_traits<_Bi_iter>::value_type,
1070 _Ch_traits, _Ch_alloc>& __rhs)
1071 {
return __rhs < __lhs; }
1079 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1083 typename iterator_traits<_Bi_iter>::value_type,
1084 _Ch_traits, _Ch_alloc>& __rhs)
1085 {
return !(__lhs < __rhs); }
1093 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1095 operator<=(const sub_match<_Bi_iter>& __lhs,
1097 typename iterator_traits<_Bi_iter>::value_type,
1098 _Ch_traits, _Ch_alloc>& __rhs)
1099 {
return !(__rhs < __lhs); }
1108 template<
typename _Bi_iter>
1110 operator==(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1112 {
return __rhs.
compare(__lhs) == 0; }
1121 template<
typename _Bi_iter>
1123 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1125 {
return !(__lhs == __rhs); }
1133 template<
typename _Bi_iter>
1135 operator<(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1137 {
return __rhs.
compare(__lhs) > 0; }
1145 template<
typename _Bi_iter>
1147 operator>(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1149 {
return __rhs < __lhs; }
1157 template<
typename _Bi_iter>
1159 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1161 {
return !(__lhs < __rhs); }
1169 template<
typename _Bi_iter>
1171 operator<=(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1173 {
return !(__rhs < __lhs); }
1182 template<
typename _Bi_iter>
1185 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1186 {
return __lhs.
compare(__rhs) == 0; }
1195 template<
typename _Bi_iter>
1198 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1199 {
return !(__lhs == __rhs); }
1207 template<
typename _Bi_iter>
1209 operator<(const sub_match<_Bi_iter>& __lhs,
1210 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1211 {
return __lhs.compare(__rhs) < 0; }
1219 template<
typename _Bi_iter>
1222 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1223 {
return __rhs < __lhs; }
1231 template<
typename _Bi_iter>
1234 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1235 {
return !(__lhs < __rhs); }
1243 template<
typename _Bi_iter>
1245 operator<=(const sub_match<_Bi_iter>& __lhs,
1246 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1247 {
return !(__rhs < __lhs); }
1256 template<
typename _Bi_iter>
1258 operator==(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1272 template<
typename _Bi_iter>
1274 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1276 {
return !(__lhs == __rhs); }
1284 template<
typename _Bi_iter>
1286 operator<(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1299 template<
typename _Bi_iter>
1301 operator>(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1303 {
return __rhs < __lhs; }
1311 template<
typename _Bi_iter>
1313 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1315 {
return !(__lhs < __rhs); }
1323 template<
typename _Bi_iter>
1325 operator<=(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1327 {
return !(__rhs < __lhs); }
1336 template<
typename _Bi_iter>
1339 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1352 template<
typename _Bi_iter>
1355 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1356 {
return !(__lhs == __rhs); }
1364 template<
typename _Bi_iter>
1366 operator<(const sub_match<_Bi_iter>& __lhs,
1367 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1379 template<
typename _Bi_iter>
1382 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1383 {
return __rhs < __lhs; }
1391 template<
typename _Bi_iter>
1394 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1395 {
return !(__lhs < __rhs); }
1403 template<
typename _Bi_iter>
1405 operator<=(const sub_match<_Bi_iter>& __lhs,
1406 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1407 {
return !(__rhs < __lhs); }
1417 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1419 basic_ostream<_Ch_type, _Ch_traits>&
1420 operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
1422 {
return __os << __m.
str(); }
1429 template<
typename _Bi_iter>
1430 inline const sub_match<_Bi_iter>&
1433 static const sub_match<_Bi_iter> __unmatched = sub_match<_Bi_iter>();
1459 template<
typename _Bi_iter,
1460 typename _Allocator = allocator<sub_match<_Bi_iter> > >
1462 :
private std::vector<sub_match<_Bi_iter>, _Allocator>
1486 typedef typename _Base_type::const_iterator const_iterator;
1487 typedef const_iterator iterator;
1488 typedef typename std::iterator_traits<_Bi_iter>::difference_type
1491 typedef typename _Allocator::size_type size_type;
1492 typedef _Allocator allocator_type;
1493 typedef typename std::iterator_traits<_Bi_iter>::value_type
1581 return (__size && _Base_type::operator[](0).matched) ? __size - 2 : 0;
1595 {
return size() == 0; }
1614 {
return (*
this)[__sub].length(); }
1633 (*
this)[__sub].first) : -1;
1645 str(size_type __sub = 0)
const
1646 {
return (*
this)[__sub].str(); }
1662 _GLIBCXX_DEBUG_ASSERT(
ready() );
1663 return __sub <
size()
1665 : __unmatched_sub<_Bi_iter>();
1679 _GLIBCXX_DEBUG_ASSERT(
ready() );
1682 : __unmatched_sub<_Bi_iter>();
1696 _GLIBCXX_DEBUG_ASSERT(
ready() );
1699 : __unmatched_sub<_Bi_iter>();
1746 template<
typename _Out_iter>
1748 format(_Out_iter __out,
const char_type* __fmt_first,
1749 const char_type* __fmt_last,
1757 template<
typename _Out_iter,
typename _St,
typename _Sa>
1770 template<
typename _Out_iter,
typename _St,
typename _Sa>
1808 {
return _Base_type::get_allocator(); }
1826 friend class __regex::_SpecializedResults<_Bi_iter, _Allocator>;
1829 typedef match_results<const char*> cmatch;
1830 typedef match_results<string::const_iterator> smatch;
1831 #ifdef _GLIBCXX_USE_WCHAR_T
1832 typedef match_results<const wchar_t*> wcmatch;
1833 typedef match_results<wstring::const_iterator> wsmatch;
1842 template<
typename _Bi_iter,
typename _Allocator>
1866 template<
typename _Bi_iter,
class _Allocator>
1870 {
return !(__m1 == __m2); }
1880 template<
typename _Bi_iter,
typename _Allocator>
1884 { __lhs.
swap(__rhs); }
1909 template<
typename _Bi_iter,
typename _Allocator,
1910 typename _Ch_type,
typename _Rx_traits>
1920 __regex::_Automaton::_SizeT __sz = __a->_M_sub_count();
1921 __regex::_SpecializedCursor<_Bi_iter> __cs(__s, __e);
1922 __regex::_SpecializedResults<_Bi_iter, _Allocator> __r(__sz, __cs, __m);
1923 __regex::_Grep_matcher __matcher(__cs, __r, __a, __flags);
1924 return __m[0].matched;
1941 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
1949 return regex_match(__first, __last, __what, __re, __flags);
1966 template<
typename _Ch_type,
typename _Allocator,
typename _Rx_traits>
1973 {
return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
1989 template<
typename _Ch_traits,
typename _Ch_alloc,
1990 typename _Allocator,
typename _Ch_type,
typename _Rx_traits>
1994 _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
2013 template<
typename _Ch_type,
class _Rx_traits>
2019 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2034 template<
typename _Ch_traits,
typename _Str_allocator,
2035 typename _Ch_type,
typename _Rx_traits>
2059 template<
typename _Bi_iter,
typename _Allocator,
2060 typename _Ch_type,
typename _Rx_traits>
2081 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2089 return regex_search(__first, __last, __what, __re, __flags);
2105 template<
typename _Ch_type,
class _Allocator,
class _Rx_traits>
2112 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2125 template<
typename _Ch_type,
typename _Rx_traits>
2131 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2144 template<
typename _Ch_traits,
typename _String_allocator,
2145 typename _Ch_type,
typename _Rx_traits>
2148 _String_allocator>& __s,
2152 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2166 template<
typename _Ch_traits,
typename _Ch_alloc,
2167 typename _Allocator,
typename _Ch_type,
2168 typename _Rx_traits>
2172 _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
2193 template<
typename _Out_iter,
typename _Bi_iter,
2194 typename _Rx_traits,
typename _Ch_type>
2214 template<
typename _Rx_traits,
typename _Ch_type>
2215 inline basic_string<_Ch_type>
2224 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2235 template<
typename _Bi_iter,
2236 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2237 typename _Rx_traits = regex_traits<_Ch_type> >
2243 typedef std::ptrdiff_t difference_type;
2337 #ifdef _GLIBCXX_USE_WCHAR_T
2350 template<
typename _Bi_iter,
2351 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2358 typedef std::ptrdiff_t difference_type;
2429 template<std::
size_t _Nm>
2432 const int (&__submatches)[_Nm],
2448 regex_token_iterator&
2449 operator=(
const regex_token_iterator& __rhs);
2456 operator==(
const regex_token_iterator& __rhs);
2463 operator!=(
const regex_token_iterator& __rhs);
2483 regex_token_iterator&
2490 regex_token_iterator
2496 position_iterator __position;
2507 #ifdef _GLIBCXX_USE_WCHAR_T
2515 _GLIBCXX_END_NAMESPACE_VERSION