35 _GLIBCXX_BEGIN_NAMESPACE_TR1
46 namespace regex_constants
431 template<
typename _Ch_type>
435 typedef _Ch_type char_type;
438 typedef std::ctype_base::mask char_class_type;
459 {
return string_type::traits_type::length(__p); }
486 return use_facet<ctype<char_type> >(_M_locale).
tolower(__c);
509 template<
typename _Fwd_iter>
535 template<
typename _Fwd_iter>
552 template<
typename _Fwd_iter>
589 template<
typename _Fwd_iter>
606 isctype(_Ch_type __c, char_class_type __f)
const;
619 value(_Ch_type __ch,
int __radix)
const;
635 std::swap(_M_locale, __loc);
645 {
return _M_locale; }
648 locale_type _M_locale;
651 template<
typename _Ch_type>
653 isctype(_Ch_type __c, char_class_type __f)
const
660 if (__ctype.
is(__c, __f))
664 if (__c == __ctype.
widen(
'_'))
666 const char*
const __wb[] =
"w";
667 char_class_type __wt = this->lookup_classname(__wb,
668 __wb +
sizeof(__wb));
674 if (__c == __ctype.isspace(__c))
676 const char*
const __bb[] =
"blank";
677 char_class_type __bt = this->lookup_classname(__bb,
678 __bb +
sizeof(__bb));
686 template<
typename _Ch_type>
688 value(_Ch_type __ch,
int __radix)
const
694 else if (__radix == 16)
708 template<
typename _Ch_type,
typename _Rx_traits = regex_traits<_Ch_type> >
713 typedef _Ch_type value_type;
715 typedef typename _Rx_traits::locale_type locale_type;
716 typedef typename _Rx_traits::string_type string_type;
751 : _M_flags(regex_constants::ECMAScript), _M_pattern(), _M_mark_count(0)
768 : _M_flags(__f), _M_pattern(__p), _M_mark_count(0)
782 basic_regex(
const _Ch_type* __p, std::size_t __len, flag_type __f)
783 : _M_flags(__f) , _M_pattern(__p, __len), _M_mark_count(0)
792 : _M_flags(__rhs._M_flags), _M_pattern(__rhs._M_pattern),
793 _M_mark_count(__rhs._M_mark_count)
805 template<
typename _Ch_traits,
typename _Ch_alloc>
809 : _M_flags(__f), _M_pattern(__s.begin(), __s.end()), _M_mark_count(0)
825 template<
typename _InputIterator>
828 : _M_flags(__f), _M_pattern(__first, __last), _M_mark_count(0)
831 #ifdef _GLIBCXX_INCLUDE_AS_CXX0X
842 : _M_flags(__f), _M_pattern(__l.begin(), __l.end()), _M_mark_count(0)
857 {
return this->
assign(__rhs); }
876 template<
typename _Ch_typeraits,
typename _Allocator>
911 {
return this->
assign(string_type(__p), __flags); }
927 assign(
const _Ch_type* __p, std::size_t __len, flag_type __flags)
928 {
return this->
assign(string_type(__p, __len), __flags); }
941 template<
typename _Ch_typeraits,
typename _Allocator>
964 template<
typename _InputIterator>
966 assign(_InputIterator __first, _InputIterator __last,
968 {
return this->
assign(string_type(__first, __last), __flags); }
970 #ifdef _GLIBCXX_INCLUDE_AS_CXX0X
984 {
return this->
assign(__l.begin(), __l.end(), __f); }
994 {
return _M_mark_count; }
1002 {
return _M_flags; }
1012 {
return _M_traits.imbue(__loc); }
1020 {
return _M_traits.getloc(); }
1031 std::swap(_M_flags, __rhs._M_flags);
1032 std::swap(_M_pattern, __rhs._M_pattern);
1033 std::swap(_M_mark_count, __rhs._M_mark_count);
1034 std::swap(_M_traits, __rhs._M_traits);
1046 string_type _M_pattern;
1047 unsigned int _M_mark_count;
1048 _Rx_traits _M_traits;
1053 #ifdef _GLIBCXX_USE_WCHAR_T
1065 template<
typename _Ch_type,
typename _Rx_traits>
1069 { __lhs.
swap(__rhs); }
1085 template<
typename _BiIter>
1089 typedef typename iterator_traits<_BiIter>::value_type value_type;
1090 typedef typename iterator_traits<_BiIter>::difference_type
1092 typedef _BiIter iterator;
1116 return this->matched
1129 return this->matched
1145 {
return this->
str().compare(__s.
str()); }
1158 {
return this->
str().compare(__s); }
1171 {
return this->
str().compare(__s); }
1179 #ifdef _GLIBCXX_USE_WCHAR_T
1194 template<
typename _BiIter>
1198 {
return __lhs.
compare(__rhs) == 0; }
1206 template<
typename _BiIter>
1210 {
return __lhs.
compare(__rhs) != 0; }
1218 template<
typename _BiIter>
1220 operator<(const sub_match<_BiIter>& __lhs,
1222 {
return __lhs.
compare(__rhs) < 0; }
1230 template<
typename _BiIter>
1232 operator<=(const sub_match<_BiIter>& __lhs,
1234 {
return __lhs.
compare(__rhs) <= 0; }
1242 template<
typename _BiIter>
1246 {
return __lhs.
compare(__rhs) >= 0; }
1254 template<
typename _BiIter>
1258 {
return __lhs.
compare(__rhs) > 0; }
1267 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1270 typename iterator_traits<_Bi_iter>::value_type,
1271 _Ch_traits, _Ch_alloc>& __lhs,
1273 {
return __lhs == __rhs.
str(); }
1282 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1285 typename iterator_traits<_Bi_iter>::value_type,
1287 {
return __lhs != __rhs.
str(); }
1295 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1298 typename iterator_traits<_Bi_iter>::value_type,
1300 {
return __lhs < __rhs.
str(); }
1308 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1311 typename iterator_traits<_Bi_iter>::value_type,
1313 {
return __lhs > __rhs.
str(); }
1321 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1324 typename iterator_traits<_Bi_iter>::value_type,
1326 {
return __lhs >= __rhs.
str(); }
1334 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1337 typename iterator_traits<_Bi_iter>::value_type,
1339 {
return __lhs <= __rhs.
str(); }
1348 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1352 typename iterator_traits<_Bi_iter>::value_type,
1353 _Ch_traits, _Ch_alloc>& __rhs)
1354 {
return __lhs.
str() == __rhs; }
1363 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1367 typename iterator_traits<_Bi_iter>::value_type,
1368 _Ch_traits, _Ch_alloc>& __rhs)
1369 {
return __lhs.
str() != __rhs; }
1377 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1379 operator<(const sub_match<_Bi_iter>& __lhs,
1381 typename iterator_traits<_Bi_iter>::value_type,
1382 _Ch_traits, _Ch_alloc>& __rhs)
1383 {
return __lhs.str() < __rhs; }
1391 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1395 typename iterator_traits<_Bi_iter>::value_type,
1396 _Ch_traits, _Ch_alloc>& __rhs)
1397 {
return __lhs.
str() > __rhs; }
1405 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1409 typename iterator_traits<_Bi_iter>::value_type,
1410 _Ch_traits, _Ch_alloc>& __rhs)
1411 {
return __lhs.
str() >= __rhs; }
1419 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1421 operator<=(const sub_match<_Bi_iter>& __lhs,
1423 typename iterator_traits<_Bi_iter>::value_type,
1424 _Ch_traits, _Ch_alloc>& __rhs)
1425 {
return __lhs.str() <= __rhs; }
1434 template<
typename _Bi_iter>
1436 operator==(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1438 {
return __lhs == __rhs.
str(); }
1447 template<
typename _Bi_iter>
1449 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1451 {
return __lhs != __rhs.
str(); }
1459 template<
typename _Bi_iter>
1461 operator<(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1463 {
return __lhs < __rhs.
str(); }
1471 template<
typename _Bi_iter>
1473 operator>(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1475 {
return __lhs > __rhs.
str(); }
1483 template<
typename _Bi_iter>
1485 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1487 {
return __lhs >= __rhs.
str(); }
1495 template<
typename _Bi_iter>
1497 operator<=(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1499 {
return __lhs <= __rhs.
str(); }
1508 template<
typename _Bi_iter>
1511 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1512 {
return __lhs.
str() == __rhs; }
1521 template<
typename _Bi_iter>
1524 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1525 {
return __lhs.
str() != __rhs; }
1533 template<
typename _Bi_iter>
1535 operator<(const sub_match<_Bi_iter>& __lhs,
1536 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1537 {
return __lhs.str() < __rhs; }
1545 template<
typename _Bi_iter>
1548 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1549 {
return __lhs.
str() > __rhs; }
1557 template<
typename _Bi_iter>
1560 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1561 {
return __lhs.
str() >= __rhs; }
1569 template<
typename _Bi_iter>
1571 operator<=(const sub_match<_Bi_iter>& __lhs,
1572 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1573 {
return __lhs.str() <= __rhs; }
1582 template<
typename _Bi_iter>
1584 operator==(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1586 {
return __lhs == __rhs.
str(); }
1595 template<
typename _Bi_iter>
1597 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1599 {
return __lhs != __rhs.
str(); }
1607 template<
typename _Bi_iter>
1609 operator<(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1611 {
return __lhs < __rhs.
str(); }
1619 template<
typename _Bi_iter>
1621 operator>(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1623 {
return __lhs > __rhs.
str(); }
1631 template<
typename _Bi_iter>
1633 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1635 {
return __lhs >= __rhs.
str(); }
1643 template<
typename _Bi_iter>
1645 operator<=(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1647 {
return __lhs <= __rhs.
str(); }
1656 template<
typename _Bi_iter>
1659 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1660 {
return __lhs.
str() == __rhs; }
1669 template<
typename _Bi_iter>
1672 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1673 {
return __lhs.
str() != __rhs; }
1681 template<
typename _Bi_iter>
1683 operator<(const sub_match<_Bi_iter>& __lhs,
1684 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1685 {
return __lhs.str() < __rhs; }
1693 template<
typename _Bi_iter>
1696 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1697 {
return __lhs.
str() > __rhs; }
1705 template<
typename _Bi_iter>
1708 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1709 {
return __lhs.
str() >= __rhs; }
1717 template<
typename _Bi_iter>
1719 operator<=(const sub_match<_Bi_iter>& __lhs,
1720 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1721 {
return __lhs.str() <= __rhs; }
1731 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1733 basic_ostream<_Ch_type, _Ch_traits>&
1734 operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
1736 {
return __os << __m.
str(); }
1761 template<
typename _Bi_iter,
1762 typename _Allocator = allocator<sub_match<_Bi_iter> > >
1764 :
private std::vector<std::_GLIBCXX_TR1 sub_match<_Bi_iter>, _Allocator>
1776 typedef typename _Allocator::const_reference const_reference;
1777 typedef const_reference reference;
1778 typedef typename _Base_type::const_iterator const_iterator;
1779 typedef const_iterator iterator;
1780 typedef typename iterator_traits<_Bi_iter>::difference_type
1782 typedef typename _Allocator::size_type size_type;
1783 typedef _Allocator allocator_type;
1784 typedef typename iterator_traits<_Bi_iter>::value_type char_type;
1807 :
_Base_type(__rhs), _M_matched(__rhs._M_matched),
1808 _M_prefix(__rhs._M_prefix), _M_suffix(__rhs._M_suffix)
1859 {
return size() == 0; }
1877 {
return _M_matched ? this->
str(__sub).
length() : 0; }
1893 (*
this)[__sub].first) : 0;
1904 str(size_type __sub = 0)
const
1905 {
return _M_matched ? (*this)[__sub].str() :
string_type(); }
1930 {
return _M_prefix; }
1941 {
return _M_suffix; }
1950 #ifdef _GLIBCXX_INCLUDE_AS_CXX0X
1966 #ifdef _GLIBCXX_INCLUDE_AS_CXX0X
1990 template<
typename _Out_iter>
1992 format(_Out_iter __out,
const string_type& __fmt,
2000 format(
const string_type& __fmt,
2016 using _Base_type::get_allocator;
2032 std::swap(_M_matched, __that._M_matched);
2033 std::swap(_M_prefix, __that._M_prefix);
2034 std::swap(_M_suffix, __that._M_suffix);
2040 value_type _M_prefix;
2041 value_type _M_suffix;
2044 typedef match_results<const char*> cmatch;
2045 typedef match_results<string::const_iterator> smatch;
2046 #ifdef _GLIBCXX_USE_WCHAR_T
2047 typedef match_results<const wchar_t*> wcmatch;
2048 typedef match_results<wstring::const_iterator> wsmatch;
2058 template<
typename _Bi_iter,
typename _Allocator>
2060 operator==(
const match_results<_Bi_iter, _Allocator>& __m1,
2061 const match_results<_Bi_iter, _Allocator>& __m2);
2068 template<
typename _Bi_iter,
class _Allocator>
2072 {
return !(__m1 == __m2); }
2082 template<
typename _Bi_iter,
typename _Allocator>
2086 { __lhs.
swap(__rhs); }
2111 template<
typename _Bi_iter,
typename _Allocator,
2112 typename _Ch_type,
typename _Rx_traits>
2115 match_results<_Bi_iter, _Allocator>& __m,
2116 const basic_regex<_Ch_type, _Rx_traits>& __re,
2134 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2142 return regex_match(__first, __last, __what, __re, __flags);
2159 template<
typename _Ch_type,
typename _Allocator,
typename _Rx_traits>
2166 {
return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
2182 template<
typename _Ch_traits,
typename _Ch_alloc,
2183 typename _Allocator,
typename _Ch_type,
typename _Rx_traits>
2187 _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
2206 template<
typename _Ch_type,
class _Rx_traits>
2212 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2227 template<
typename _Ch_traits,
typename _Str_allocator,
2228 typename _Ch_type,
typename _Rx_traits>
2252 template<
typename _Bi_iter,
typename _Allocator,
2253 typename _Ch_type,
typename _Rx_traits>
2256 match_results<_Bi_iter, _Allocator>& __m,
2257 const basic_regex<_Ch_type, _Rx_traits>& __re,
2273 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2281 return regex_search(__first, __last, __what, __re, __flags);
2297 template<
typename _Ch_type,
class _Allocator,
class _Rx_traits>
2304 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2317 template<
typename _Ch_type,
typename _Rx_traits>
2323 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2336 template<
typename _Ch_traits,
typename _String_allocator,
2337 typename _Ch_type,
typename _Rx_traits>
2340 _String_allocator>& __s,
2344 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2358 template<
typename _Ch_traits,
typename _Ch_alloc,
2359 typename _Allocator,
typename _Ch_type,
2360 typename _Rx_traits>
2364 _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
2385 template<
typename _Out_iter,
typename _Bi_iter,
2386 typename _Rx_traits,
typename _Ch_type>
2388 regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
2389 const basic_regex<_Ch_type, _Rx_traits>& __e,
2390 const basic_string<_Ch_type>& __fmt,
2405 template<
typename _Rx_traits,
typename _Ch_type>
2406 inline basic_string<_Ch_type>
2415 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2426 template<
typename _Bi_iter,
2427 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2428 typename _Rx_traits = regex_traits<_Ch_type> >
2434 typedef std::ptrdiff_t difference_type;
2528 #ifdef _GLIBCXX_USE_WCHAR_T
2541 template<
typename _Bi_iter,
2542 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2549 typedef std::ptrdiff_t difference_type;
2620 template<std::
size_t _Nm>
2623 const int (&__submatches)[_Nm],
2639 regex_token_iterator&
2640 operator=(
const regex_token_iterator& __rhs);
2647 operator==(
const regex_token_iterator& __rhs);
2654 operator!=(
const regex_token_iterator& __rhs);
2674 regex_token_iterator&
2681 regex_token_iterator
2687 position_iterator __position;
2698 #ifdef _GLIBCXX_USE_WCHAR_T
2707 _GLIBCXX_END_NAMESPACE_TR1