00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 namespace std
00032 {
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 template<typename _Ch_type>
00052 struct regex_traits
00053 {
00054 public:
00055 typedef _Ch_type char_type;
00056 typedef std::basic_string<char_type> string_type;
00057 typedef std::locale locale_type;
00058 typedef std::ctype_base::mask char_class_type;
00059
00060 public:
00061
00062
00063
00064 regex_traits()
00065 { }
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 static std::size_t
00078 length(const char_type* __p)
00079 { return string_type::traits_type::length(__p); }
00080
00081
00082
00083
00084
00085
00086
00087
00088 char_type
00089 translate(char_type __c) const
00090 { return __c; }
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 char_type
00102 translate_nocase(char_type __c) const
00103 {
00104 using std::ctype;
00105 using std::use_facet;
00106 return use_facet<ctype<char_type> >(_M_locale).tolower(__c);
00107 }
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 template<typename _Fwd_iter>
00130 string_type
00131 transform(_Fwd_iter __first, _Fwd_iter __last) const
00132 {
00133 using std::collate;
00134 using std::use_facet;
00135 const collate<_Ch_type>& __c(use_facet<
00136 collate<_Ch_type> >(_M_locale));
00137 string_type __s(__first, __last);
00138 return __c.transform(__s.data(), __s.data() + __s.size());
00139 }
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 template<typename _Fwd_iter>
00156 string_type
00157 transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
00158 { return string_type(); }
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173 template<typename _Fwd_iter>
00174 string_type
00175 lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const
00176 { return string_type(); }
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216 template<typename _Fwd_iter>
00217 char_class_type
00218 lookup_classname(_Fwd_iter __first, _Fwd_iter __last,
00219 bool __icase = false) const
00220 { return 0; }
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234 bool
00235 isctype(_Ch_type __c, char_class_type __f) const;
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247 int
00248 value(_Ch_type __ch, int __radix) const;
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261 locale_type
00262 imbue(locale_type __loc)
00263 {
00264 std::swap(_M_locale, __loc);
00265 return __loc;
00266 }
00267
00268
00269
00270
00271
00272 locale_type
00273 getloc() const
00274 { return _M_locale; }
00275
00276 protected:
00277 locale_type _M_locale;
00278 };
00279
00280 template<typename _Ch_type>
00281 bool
00282 regex_traits<_Ch_type>::
00283 isctype(_Ch_type __c, char_class_type __f) const
00284 {
00285 using std::ctype;
00286 using std::use_facet;
00287 const ctype<_Ch_type>& __ctype(use_facet<
00288 ctype<_Ch_type> >(_M_locale));
00289
00290 if (__ctype.is(__c, __f))
00291 return true;
00292
00293
00294 if (__c == __ctype.widen('_'))
00295 {
00296 const char __wb[] = "w";
00297 char_class_type __wt = this->lookup_classname(__wb,
00298 __wb + sizeof(__wb));
00299 if (__f | __wt)
00300 return true;
00301 }
00302
00303
00304 if (__ctype.is(std::ctype_base::space, __c))
00305 {
00306 const char __bb[] = "blank";
00307 char_class_type __bt = this->lookup_classname(__bb,
00308 __bb + sizeof(__bb));
00309 if (__f | __bt)
00310 return true;
00311 }
00312
00313 return false;
00314 }
00315
00316 template<typename _Ch_type>
00317 int
00318 regex_traits<_Ch_type>::
00319 value(_Ch_type __ch, int __radix) const
00320 {
00321 std::basic_istringstream<_Ch_type> __is(string_type(1, __ch));
00322 int __v;
00323 if (__radix == 8)
00324 __is >> std::oct;
00325 else if (__radix == 16)
00326 __is >> std::hex;
00327 __is >> __v;
00328 return __is.fail() ? -1 : __v;
00329 }
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339 template<typename _Ch_type, typename _Rx_traits = regex_traits<_Ch_type> >
00340 class basic_regex
00341 {
00342 public:
00343
00344 typedef _Ch_type value_type;
00345 typedef regex_constants::syntax_option_type flag_type;
00346 typedef typename _Rx_traits::locale_type locale_type;
00347 typedef typename _Rx_traits::string_type string_type;
00348
00349
00350
00351
00352
00353
00354
00355 static const regex_constants::syntax_option_type icase
00356 = regex_constants::icase;
00357 static const regex_constants::syntax_option_type nosubs
00358 = regex_constants::nosubs;
00359 static const regex_constants::syntax_option_type optimize
00360 = regex_constants::optimize;
00361 static const regex_constants::syntax_option_type collate
00362 = regex_constants::collate;
00363 static const regex_constants::syntax_option_type ECMAScript
00364 = regex_constants::ECMAScript;
00365 static const regex_constants::syntax_option_type basic
00366 = regex_constants::basic;
00367 static const regex_constants::syntax_option_type extended
00368 = regex_constants::extended;
00369 static const regex_constants::syntax_option_type awk
00370 = regex_constants::awk;
00371 static const regex_constants::syntax_option_type grep
00372 = regex_constants::grep;
00373 static const regex_constants::syntax_option_type egrep
00374 = regex_constants::egrep;
00375
00376
00377
00378
00379
00380
00381
00382 basic_regex()
00383 : _M_flags(regex_constants::ECMAScript),
00384 _M_automaton(__regex::__compile<const _Ch_type*, _Rx_traits>(0, 0,
00385 _M_traits, _M_flags))
00386 { }
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399 explicit
00400 basic_regex(const _Ch_type* __p,
00401 flag_type __f = regex_constants::ECMAScript)
00402 : _M_flags(__f),
00403 _M_automaton(__regex::__compile(__p, __p + _Rx_traits::length(__p),
00404 _M_traits, _M_flags))
00405 { }
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418 basic_regex(const _Ch_type* __p, std::size_t __len, flag_type __f)
00419 : _M_flags(__f),
00420 _M_automaton(__regex::__compile(__p, __p + __len, _M_traits, _M_flags))
00421 { }
00422
00423
00424
00425
00426
00427
00428 basic_regex(const basic_regex& __rhs)
00429 : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits),
00430 _M_automaton(__rhs._M_automaton)
00431 { }
00432
00433
00434
00435
00436
00437
00438 basic_regex(const basic_regex&& __rhs)
00439 : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits),
00440 _M_automaton(std::move(__rhs._M_automaton))
00441 { }
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452 template<typename _Ch_traits, typename _Ch_alloc>
00453 explicit
00454 basic_regex(const std::basic_string<_Ch_type, _Ch_traits,
00455 _Ch_alloc>& __s,
00456 flag_type __f = regex_constants::ECMAScript)
00457 : _M_flags(__f),
00458 _M_automaton(__regex::__compile(__s.begin(), __s.end(),
00459 _M_traits, _M_flags))
00460 { }
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475 template<typename _InputIterator>
00476 basic_regex(_InputIterator __first, _InputIterator __last,
00477 flag_type __f = regex_constants::ECMAScript)
00478 : _M_flags(__f),
00479 _M_automaton(__regex::__compile(__first, __last, _M_traits, _M_flags))
00480 { }
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490 basic_regex(initializer_list<_Ch_type> __l,
00491 flag_type __f = regex_constants::ECMAScript)
00492 : _M_flags(__f),
00493 _M_automaton(__regex::__compile(__l.begin(), __l.end(),
00494 _M_traits, _M_flags))
00495 { }
00496
00497
00498
00499
00500 ~basic_regex()
00501 { }
00502
00503
00504
00505
00506 basic_regex&
00507 operator=(const basic_regex& __rhs)
00508 { return this->assign(__rhs); }
00509
00510
00511
00512
00513 basic_regex&
00514 operator=(basic_regex&& __rhs)
00515 { return this->assign(std::move(__rhs)); }
00516
00517
00518
00519
00520
00521
00522
00523
00524 basic_regex&
00525 operator=(const _Ch_type* __p)
00526 { return this->assign(__p, flags()); }
00527
00528
00529
00530
00531
00532
00533
00534 template<typename _Ch_typeraits, typename _Allocator>
00535 basic_regex&
00536 operator=(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s)
00537 { return this->assign(__s, flags()); }
00538
00539
00540
00541
00542
00543
00544
00545 basic_regex&
00546 assign(const basic_regex& __rhs)
00547 {
00548 basic_regex __tmp(__rhs);
00549 this->swap(__tmp);
00550 return *this;
00551 }
00552
00553
00554
00555
00556
00557
00558 basic_regex&
00559 assign(basic_regex&& __rhs)
00560 {
00561 basic_regex __tmp(std::move(__rhs));
00562 this->swap(__tmp);
00563 return *this;
00564 }
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579 basic_regex&
00580 assign(const _Ch_type* __p,
00581 flag_type __flags = regex_constants::ECMAScript)
00582 { return this->assign(string_type(__p), __flags); }
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597 basic_regex&
00598 assign(const _Ch_type* __p, std::size_t __len, flag_type __flags)
00599 { return this->assign(string_type(__p, __len), __flags); }
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612 template<typename _Ch_typeraits, typename _Allocator>
00613 basic_regex&
00614 assign(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s,
00615 flag_type __f = regex_constants::ECMAScript)
00616 {
00617 basic_regex __tmp(__s, __f);
00618 this->swap(__tmp);
00619 return *this;
00620 }
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635 template<typename _InputIterator>
00636 basic_regex&
00637 assign(_InputIterator __first, _InputIterator __last,
00638 flag_type __flags = regex_constants::ECMAScript)
00639 { return this->assign(string_type(__first, __last), __flags); }
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651 basic_regex&
00652 assign(initializer_list<_Ch_type> __l,
00653 flag_type __f = regex_constants::ECMAScript)
00654 { return this->assign(__l.begin(), __l.end(), __f); }
00655
00656
00657
00658
00659
00660
00661 unsigned int
00662 mark_count() const
00663 { return _M_automaton->_M_sub_count() - 1; }
00664
00665
00666
00667
00668
00669 flag_type
00670 flags() const
00671 { return _M_flags; }
00672
00673
00674
00675
00676
00677
00678
00679 locale_type
00680 imbue(locale_type __loc)
00681 { return _M_traits.imbue(__loc); }
00682
00683
00684
00685
00686
00687 locale_type
00688 getloc() const
00689 { return _M_traits.getloc(); }
00690
00691
00692
00693
00694
00695
00696
00697 void
00698 swap(basic_regex& __rhs)
00699 {
00700 std::swap(_M_flags, __rhs._M_flags);
00701 std::swap(_M_traits, __rhs._M_traits);
00702 std::swap(_M_automaton, __rhs._M_automaton);
00703 }
00704
00705 #ifdef _GLIBCXX_DEBUG
00706 void
00707 _M_dot(std::ostream& __ostr)
00708 { _M_automaton->_M_dot(__ostr); }
00709 #endif
00710
00711 const __regex::_AutomatonPtr&
00712 _M_get_automaton() const
00713 { return _M_automaton; }
00714
00715 protected:
00716 flag_type _M_flags;
00717 _Rx_traits _M_traits;
00718 __regex::_AutomatonPtr _M_automaton;
00719 };
00720
00721
00722 typedef basic_regex<char> regex;
00723 #ifdef _GLIBCXX_USE_WCHAR_T
00724
00725 typedef basic_regex<wchar_t> wregex;
00726 #endif
00727
00728
00729
00730
00731
00732
00733
00734
00735 template<typename _Ch_type, typename _Rx_traits>
00736 inline void
00737 swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
00738 basic_regex<_Ch_type, _Rx_traits>& __rhs)
00739 { __lhs.swap(__rhs); }
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755 template<typename _BiIter>
00756 class sub_match : public std::pair<_BiIter, _BiIter>
00757 {
00758 public:
00759 typedef typename iterator_traits<_BiIter>::value_type value_type;
00760 typedef typename iterator_traits<_BiIter>::difference_type
00761 difference_type;
00762 typedef _BiIter iterator;
00763 typedef std::basic_string<value_type> string_type;
00764
00765 public:
00766 bool matched;
00767
00768
00769
00770
00771 difference_type
00772 length() const
00773 { return this->matched ? std::distance(this->first, this->second) : 0; }
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785 operator string_type() const
00786 {
00787 return this->matched
00788 ? string_type(this->first, this->second)
00789 : string_type();
00790 }
00791
00792
00793
00794
00795
00796
00797 string_type
00798 str() const
00799 {
00800 return this->matched
00801 ? string_type(this->first, this->second)
00802 : string_type();
00803 }
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814 int
00815 compare(const sub_match& __s) const
00816 { return this->str().compare(__s.str()); }
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827 int
00828 compare(const string_type& __s) const
00829 { return this->str().compare(__s); }
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840 int
00841 compare(const value_type* __s) const
00842 { return this->str().compare(__s); }
00843 };
00844
00845
00846
00847 typedef sub_match<const char*> csub_match;
00848
00849 typedef sub_match<string::const_iterator> ssub_match;
00850 #ifdef _GLIBCXX_USE_WCHAR_T
00851
00852 typedef sub_match<const wchar_t*> wcsub_match;
00853
00854 typedef sub_match<wstring::const_iterator> wssub_match;
00855 #endif
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865 template<typename _BiIter>
00866 inline bool
00867 operator==(const sub_match<_BiIter>& __lhs,
00868 const sub_match<_BiIter>& __rhs)
00869 { return __lhs.compare(__rhs) == 0; }
00870
00871
00872
00873
00874
00875
00876
00877 template<typename _BiIter>
00878 inline bool
00879 operator!=(const sub_match<_BiIter>& __lhs,
00880 const sub_match<_BiIter>& __rhs)
00881 { return __lhs.compare(__rhs) != 0; }
00882
00883
00884
00885
00886
00887
00888
00889 template<typename _BiIter>
00890 inline bool
00891 operator<(const sub_match<_BiIter>& __lhs,
00892 const sub_match<_BiIter>& __rhs)
00893 { return __lhs.compare(__rhs) < 0; }
00894
00895
00896
00897
00898
00899
00900
00901 template<typename _BiIter>
00902 inline bool
00903 operator<=(const sub_match<_BiIter>& __lhs,
00904 const sub_match<_BiIter>& __rhs)
00905 { return __lhs.compare(__rhs) <= 0; }
00906
00907
00908
00909
00910
00911
00912
00913 template<typename _BiIter>
00914 inline bool
00915 operator>=(const sub_match<_BiIter>& __lhs,
00916 const sub_match<_BiIter>& __rhs)
00917 { return __lhs.compare(__rhs) >= 0; }
00918
00919
00920
00921
00922
00923
00924
00925 template<typename _BiIter>
00926 inline bool
00927 operator>(const sub_match<_BiIter>& __lhs,
00928 const sub_match<_BiIter>& __rhs)
00929 { return __lhs.compare(__rhs) > 0; }
00930
00931
00932
00933
00934
00935
00936
00937
00938 template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
00939 inline bool
00940 operator==(const basic_string<
00941 typename iterator_traits<_Bi_iter>::value_type,
00942 _Ch_traits, _Ch_alloc>& __lhs,
00943 const sub_match<_Bi_iter>& __rhs)
00944 { return __lhs == __rhs.str(); }
00945
00946
00947
00948
00949
00950
00951
00952
00953 template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
00954 inline bool
00955 operator!=(const basic_string<
00956 typename iterator_traits<_Bi_iter>::value_type,
00957 _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
00958 { return __lhs != __rhs.str(); }
00959
00960
00961
00962
00963
00964
00965
00966 template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
00967 inline bool
00968 operator<(const basic_string<
00969 typename iterator_traits<_Bi_iter>::value_type,
00970 _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
00971 { return __lhs < __rhs.str(); }
00972
00973
00974
00975
00976
00977
00978
00979 template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
00980 inline bool
00981 operator>(const basic_string<
00982 typename iterator_traits<_Bi_iter>::value_type,
00983 _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
00984 { return __lhs > __rhs.str(); }
00985
00986
00987
00988
00989
00990
00991
00992 template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
00993 inline bool
00994 operator>=(const basic_string<
00995 typename iterator_traits<_Bi_iter>::value_type,
00996 _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
00997 { return __lhs >= __rhs.str(); }
00998
00999
01000
01001
01002
01003
01004
01005 template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
01006 inline bool
01007 operator<=(const basic_string<
01008 typename iterator_traits<_Bi_iter>::value_type,
01009 _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
01010 { return __lhs <= __rhs.str(); }
01011
01012
01013
01014
01015
01016
01017
01018
01019 template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
01020 inline bool
01021 operator==(const sub_match<_Bi_iter>& __lhs,
01022 const basic_string<
01023 typename iterator_traits<_Bi_iter>::value_type,
01024 _Ch_traits, _Ch_alloc>& __rhs)
01025 { return __lhs.str() == __rhs; }
01026
01027
01028
01029
01030
01031
01032
01033
01034 template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
01035 inline bool
01036 operator!=(const sub_match<_Bi_iter>& __lhs,
01037 const basic_string<
01038 typename iterator_traits<_Bi_iter>::value_type,
01039 _Ch_traits, _Ch_alloc>& __rhs)
01040 { return __lhs.str() != __rhs; }
01041
01042
01043
01044
01045
01046
01047
01048 template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
01049 inline bool
01050 operator<(const sub_match<_Bi_iter>& __lhs,
01051 const basic_string<
01052 typename iterator_traits<_Bi_iter>::value_type,
01053 _Ch_traits, _Ch_alloc>& __rhs)
01054 { return __lhs.str() < __rhs; }
01055
01056
01057
01058
01059
01060
01061
01062 template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
01063 inline bool
01064 operator>(const sub_match<_Bi_iter>& __lhs,
01065 const basic_string<
01066 typename iterator_traits<_Bi_iter>::value_type,
01067 _Ch_traits, _Ch_alloc>& __rhs)
01068 { return __lhs.str() > __rhs; }
01069
01070
01071
01072
01073
01074
01075
01076 template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
01077 inline bool
01078 operator>=(const sub_match<_Bi_iter>& __lhs,
01079 const basic_string<
01080 typename iterator_traits<_Bi_iter>::value_type,
01081 _Ch_traits, _Ch_alloc>& __rhs)
01082 { return __lhs.str() >= __rhs; }
01083
01084
01085
01086
01087
01088
01089
01090 template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
01091 inline bool
01092 operator<=(const sub_match<_Bi_iter>& __lhs,
01093 const basic_string<
01094 typename iterator_traits<_Bi_iter>::value_type,
01095 _Ch_traits, _Ch_alloc>& __rhs)
01096 { return __lhs.str() <= __rhs; }
01097
01098
01099
01100
01101
01102
01103
01104
01105 template<typename _Bi_iter>
01106 inline bool
01107 operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01108 const sub_match<_Bi_iter>& __rhs)
01109 { return __lhs == __rhs.str(); }
01110
01111
01112
01113
01114
01115
01116
01117
01118 template<typename _Bi_iter>
01119 inline bool
01120 operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01121 const sub_match<_Bi_iter>& __rhs)
01122 { return __lhs != __rhs.str(); }
01123
01124
01125
01126
01127
01128
01129
01130 template<typename _Bi_iter>
01131 inline bool
01132 operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01133 const sub_match<_Bi_iter>& __rhs)
01134 { return __lhs < __rhs.str(); }
01135
01136
01137
01138
01139
01140
01141
01142 template<typename _Bi_iter>
01143 inline bool
01144 operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01145 const sub_match<_Bi_iter>& __rhs)
01146 { return __lhs > __rhs.str(); }
01147
01148
01149
01150
01151
01152
01153
01154 template<typename _Bi_iter>
01155 inline bool
01156 operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01157 const sub_match<_Bi_iter>& __rhs)
01158 { return __lhs >= __rhs.str(); }
01159
01160
01161
01162
01163
01164
01165
01166 template<typename _Bi_iter>
01167 inline bool
01168 operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01169 const sub_match<_Bi_iter>& __rhs)
01170 { return __lhs <= __rhs.str(); }
01171
01172
01173
01174
01175
01176
01177
01178
01179 template<typename _Bi_iter>
01180 inline bool
01181 operator==(const sub_match<_Bi_iter>& __lhs,
01182 typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01183 { return __lhs.str() == __rhs; }
01184
01185
01186
01187
01188
01189
01190
01191
01192 template<typename _Bi_iter>
01193 inline bool
01194 operator!=(const sub_match<_Bi_iter>& __lhs,
01195 typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01196 { return __lhs.str() != __rhs; }
01197
01198
01199
01200
01201
01202
01203
01204 template<typename _Bi_iter>
01205 inline bool
01206 operator<(const sub_match<_Bi_iter>& __lhs,
01207 typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01208 { return __lhs.str() < __rhs; }
01209
01210
01211
01212
01213
01214
01215
01216 template<typename _Bi_iter>
01217 inline bool
01218 operator>(const sub_match<_Bi_iter>& __lhs,
01219 typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01220 { return __lhs.str() > __rhs; }
01221
01222
01223
01224
01225
01226
01227
01228 template<typename _Bi_iter>
01229 inline bool
01230 operator>=(const sub_match<_Bi_iter>& __lhs,
01231 typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01232 { return __lhs.str() >= __rhs; }
01233
01234
01235
01236
01237
01238
01239
01240 template<typename _Bi_iter>
01241 inline bool
01242 operator<=(const sub_match<_Bi_iter>& __lhs,
01243 typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01244 { return __lhs.str() <= __rhs; }
01245
01246
01247
01248
01249
01250
01251
01252
01253 template<typename _Bi_iter>
01254 inline bool
01255 operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01256 const sub_match<_Bi_iter>& __rhs)
01257 { return __lhs == __rhs.str(); }
01258
01259
01260
01261
01262
01263
01264
01265
01266 template<typename _Bi_iter>
01267 inline bool
01268 operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01269 const sub_match<_Bi_iter>& __rhs)
01270 { return __lhs != __rhs.str(); }
01271
01272
01273
01274
01275
01276
01277
01278 template<typename _Bi_iter>
01279 inline bool
01280 operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01281 const sub_match<_Bi_iter>& __rhs)
01282 { return __lhs < __rhs.str(); }
01283
01284
01285
01286
01287
01288
01289
01290 template<typename _Bi_iter>
01291 inline bool
01292 operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01293 const sub_match<_Bi_iter>& __rhs)
01294 { return __lhs > __rhs.str(); }
01295
01296
01297
01298
01299
01300
01301
01302 template<typename _Bi_iter>
01303 inline bool
01304 operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01305 const sub_match<_Bi_iter>& __rhs)
01306 { return __lhs >= __rhs.str(); }
01307
01308
01309
01310
01311
01312
01313
01314 template<typename _Bi_iter>
01315 inline bool
01316 operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01317 const sub_match<_Bi_iter>& __rhs)
01318 { return __lhs <= __rhs.str(); }
01319
01320
01321
01322
01323
01324
01325
01326
01327 template<typename _Bi_iter>
01328 inline bool
01329 operator==(const sub_match<_Bi_iter>& __lhs,
01330 typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01331 { return __lhs.str() == __rhs; }
01332
01333
01334
01335
01336
01337
01338
01339
01340 template<typename _Bi_iter>
01341 inline bool
01342 operator!=(const sub_match<_Bi_iter>& __lhs,
01343 typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01344 { return __lhs.str() != __rhs; }
01345
01346
01347
01348
01349
01350
01351
01352 template<typename _Bi_iter>
01353 inline bool
01354 operator<(const sub_match<_Bi_iter>& __lhs,
01355 typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01356 { return __lhs.str() < __rhs; }
01357
01358
01359
01360
01361
01362
01363
01364 template<typename _Bi_iter>
01365 inline bool
01366 operator>(const sub_match<_Bi_iter>& __lhs,
01367 typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01368 { return __lhs.str() > __rhs; }
01369
01370
01371
01372
01373
01374
01375
01376 template<typename _Bi_iter>
01377 inline bool
01378 operator>=(const sub_match<_Bi_iter>& __lhs,
01379 typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01380 { return __lhs.str() >= __rhs; }
01381
01382
01383
01384
01385
01386
01387
01388 template<typename _Bi_iter>
01389 inline bool
01390 operator<=(const sub_match<_Bi_iter>& __lhs,
01391 typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01392 { return __lhs.str() <= __rhs; }
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402 template<typename _Ch_type, typename _Ch_traits, typename _Bi_iter>
01403 inline
01404 basic_ostream<_Ch_type, _Ch_traits>&
01405 operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
01406 const sub_match<_Bi_iter>& __m)
01407 { return __os << __m.str(); }
01408
01409
01410
01411
01412
01413
01414 template<typename _Bi_iter>
01415 inline const sub_match<_Bi_iter>&
01416 __unmatched_sub()
01417 {
01418 static const sub_match<_Bi_iter> __unmatched = sub_match<_Bi_iter>();
01419 return __unmatched;
01420 }
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444 template<typename _Bi_iter,
01445 typename _Allocator = allocator<sub_match<_Bi_iter> > >
01446 class match_results
01447 : private std::vector<std::sub_match<_Bi_iter>, _Allocator>
01448 {
01449 private:
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461 typedef std::vector<std::sub_match<_Bi_iter>, _Allocator>
01462 _Base_type;
01463
01464 public:
01465
01466
01467
01468
01469 typedef sub_match<_Bi_iter> value_type;
01470 typedef const value_type& const_reference;
01471 typedef const_reference reference;
01472 typedef typename _Base_type::const_iterator const_iterator;
01473 typedef const_iterator iterator;
01474 typedef typename std::iterator_traits<_Bi_iter>::difference_type
01475 difference_type;
01476
01477 typedef typename _Allocator::size_type size_type;
01478 typedef _Allocator allocator_type;
01479 typedef typename std::iterator_traits<_Bi_iter>::value_type
01480 char_type;
01481 typedef std::basic_string<char_type> string_type;
01482
01483
01484 public:
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494 explicit
01495 match_results(const _Allocator& __a = _Allocator())
01496 : _Base_type(__a)
01497 { }
01498
01499
01500
01501
01502 match_results(const match_results& __rhs)
01503 : _Base_type(__rhs)
01504 { }
01505
01506
01507
01508
01509 match_results&
01510 operator=(const match_results __rhs)
01511 {
01512 match_results(__rhs).swap(*this);
01513 return *this;
01514 }
01515
01516
01517
01518
01519 ~match_results()
01520 { }
01521
01522
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538 size_type
01539 size() const
01540 {
01541 size_type __size = _Base_type::size();
01542 return (__size && _Base_type::operator[](0).matched) ? __size - 2 : 0;
01543 }
01544
01545 size_type
01546 max_size() const
01547 { return _Base_type::max_size(); }
01548
01549
01550
01551
01552
01553
01554 bool
01555 empty() const
01556 { return _Base_type::empty(); }
01557
01558
01559
01560
01561
01562
01563
01564
01565
01566
01567
01568
01569
01570
01571
01572 difference_type
01573 length(size_type __sub = 0) const
01574 { return this[__sub].length(); }
01575
01576
01577
01578
01579
01580
01581
01582
01583
01584
01585
01586
01587
01588 difference_type
01589 position(size_type __sub = 0) const
01590 {
01591 return __sub < size() ? std::distance(this->prefix().first,
01592 (*this)[__sub].first) : -1;
01593 }
01594
01595
01596
01597
01598
01599
01600
01601
01602 string_type
01603 str(size_type __sub = 0) const
01604 { return (*this)[__sub].str(); }
01605
01606
01607
01608
01609
01610
01611
01612
01613
01614
01615
01616 const_reference
01617 operator[](size_type __sub) const
01618 {
01619 return __sub < size()
01620 ? _Base_type::operator[](__sub)
01621 : __unmatched_sub<_Bi_iter>();
01622 }
01623
01624
01625
01626
01627
01628
01629
01630
01631 const_reference
01632 prefix() const
01633 {
01634 return !empty()
01635 ? _Base_type::operator[](_Base_type::size() - 2)
01636 : __unmatched_sub<_Bi_iter>();
01637 }
01638
01639
01640
01641
01642
01643
01644
01645
01646 const_reference
01647 suffix() const
01648 {
01649 return !empty()
01650 ? _Base_type::operator[](_Base_type::size() - 1)
01651 : __unmatched_sub<_Bi_iter>();
01652 }
01653
01654
01655
01656
01657 const_iterator
01658 begin() const
01659 { return _Base_type::begin(); }
01660
01661
01662
01663
01664 const_iterator
01665 cbegin() const
01666 { return _Base_type::cbegin(); }
01667
01668
01669
01670
01671 const_iterator
01672 end() const
01673 {
01674 return !empty()
01675 ? _Base_type::end() - 2
01676 : _Base_type::end();
01677 }
01678
01679
01680
01681
01682 const_iterator
01683 cend() const
01684 {
01685 return !empty()
01686 ? _Base_type::cend() - 2
01687 : _Base_type::cend();
01688 }
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698
01699
01700
01701
01702
01703
01704
01705 template<typename _Out_iter>
01706 _Out_iter
01707 format(_Out_iter __out, const string_type& __fmt,
01708 regex_constants::match_flag_type __flags
01709 = regex_constants::format_default) const
01710 { return __out; }
01711
01712
01713
01714
01715 string_type
01716 format(const string_type& __fmt,
01717 regex_constants::match_flag_type __flags
01718 = regex_constants::format_default) const;
01719
01720
01721
01722
01723
01724
01725
01726
01727
01728
01729
01730 allocator_type
01731 get_allocator() const
01732 { return _Base_type::get_allocator(); }
01733
01734
01735
01736
01737
01738
01739
01740
01741
01742
01743
01744 void
01745 swap(match_results& __that)
01746 { _Base_type::swap(__that); }
01747
01748
01749 private:
01750 friend class __regex::_SpecializedResults<_Bi_iter, _Allocator>;
01751 };
01752
01753 typedef match_results<const char*> cmatch;
01754 typedef match_results<string::const_iterator> smatch;
01755 #ifdef _GLIBCXX_USE_WCHAR_T
01756 typedef match_results<const wchar_t*> wcmatch;
01757 typedef match_results<wstring::const_iterator> wsmatch;
01758 #endif
01759
01760
01761
01762
01763
01764
01765
01766
01767 template<typename _Bi_iter, typename _Allocator>
01768 inline bool
01769 operator==(const match_results<_Bi_iter, _Allocator>& __m1,
01770 const match_results<_Bi_iter, _Allocator>& __m2);
01771
01772
01773
01774
01775
01776
01777 template<typename _Bi_iter, class _Allocator>
01778 inline bool
01779 operator!=(const match_results<_Bi_iter, _Allocator>& __m1,
01780 const match_results<_Bi_iter, _Allocator>& __m2)
01781 { return !(__m1 == __m2); }
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791 template<typename _Bi_iter, typename _Allocator>
01792 inline void
01793 swap(match_results<_Bi_iter, _Allocator>& __lhs,
01794 match_results<_Bi_iter, _Allocator>& __rhs)
01795 { __lhs.swap(__rhs); }
01796
01797
01798
01799
01800
01801
01802
01803
01804
01805
01806
01807
01808
01809
01810
01811
01812
01813
01814
01815
01816
01817
01818
01819
01820 template<typename _Bi_iter, typename _Allocator,
01821 typename _Ch_type, typename _Rx_traits>
01822 bool
01823 regex_match(_Bi_iter __s,
01824 _Bi_iter __e,
01825 match_results<_Bi_iter, _Allocator>& __m,
01826 const basic_regex<_Ch_type, _Rx_traits>& __re,
01827 regex_constants::match_flag_type __flags
01828 = regex_constants::match_default)
01829 {
01830 __regex::_AutomatonPtr __a = __re._M_get_automaton();
01831 __regex::_Automaton::_SizeT __sz = __a->_M_sub_count();
01832 __regex::_SpecializedCursor<_Bi_iter> __cs(__s, __e);
01833 __regex::_SpecializedResults<_Bi_iter, _Allocator> __r(__sz, __cs, __m);
01834 __regex::_Grep_matcher __matcher(__cs, __r, __a, __flags);
01835 return __m[0].matched;
01836 }
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852 template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
01853 bool
01854 regex_match(_Bi_iter __first, _Bi_iter __last,
01855 const basic_regex<_Ch_type, _Rx_traits>& __re,
01856 regex_constants::match_flag_type __flags
01857 = regex_constants::match_default)
01858 {
01859 match_results<_Bi_iter> __what;
01860 return regex_match(__first, __last, __what, __re, __flags);
01861 }
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877 template<typename _Ch_type, typename _Allocator, typename _Rx_traits>
01878 inline bool
01879 regex_match(const _Ch_type* __s,
01880 match_results<const _Ch_type*, _Allocator>& __m,
01881 const basic_regex<_Ch_type, _Rx_traits>& __re,
01882 regex_constants::match_flag_type __f
01883 = regex_constants::match_default)
01884 { return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
01885
01886
01887
01888
01889
01890
01891
01892
01893
01894
01895
01896
01897
01898
01899
01900 template<typename _Ch_traits, typename _Ch_alloc,
01901 typename _Allocator, typename _Ch_type, typename _Rx_traits>
01902 inline bool
01903 regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
01904 match_results<typename basic_string<_Ch_type,
01905 _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
01906 const basic_regex<_Ch_type, _Rx_traits>& __re,
01907 regex_constants::match_flag_type __flags
01908 = regex_constants::match_default)
01909 { return regex_match(__s.begin(), __s.end(), __m, __re, __flags); }
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924 template<typename _Ch_type, class _Rx_traits>
01925 inline bool
01926 regex_match(const _Ch_type* __s,
01927 const basic_regex<_Ch_type, _Rx_traits>& __re,
01928 regex_constants::match_flag_type __f
01929 = regex_constants::match_default)
01930 { return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
01931
01932
01933
01934
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944
01945 template<typename _Ch_traits, typename _Str_allocator,
01946 typename _Ch_type, typename _Rx_traits>
01947 inline bool
01948 regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s,
01949 const basic_regex<_Ch_type, _Rx_traits>& __re,
01950 regex_constants::match_flag_type __flags
01951 = regex_constants::match_default)
01952 { return regex_match(__s.begin(), __s.end(), __re, __flags); }
01953
01954
01955
01956
01957
01958
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970 template<typename _Bi_iter, typename _Allocator,
01971 typename _Ch_type, typename _Rx_traits>
01972 inline bool
01973 regex_search(_Bi_iter __first, _Bi_iter __last,
01974 match_results<_Bi_iter, _Allocator>& __m,
01975 const basic_regex<_Ch_type, _Rx_traits>& __re,
01976 regex_constants::match_flag_type __flags
01977 = regex_constants::match_default)
01978 { return false; }
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992 template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
01993 inline bool
01994 regex_search(_Bi_iter __first, _Bi_iter __last,
01995 const basic_regex<_Ch_type, _Rx_traits>& __re,
01996 regex_constants::match_flag_type __flags
01997 = regex_constants::match_default)
01998 {
01999 match_results<_Bi_iter> __what;
02000 return regex_search(__first, __last, __what, __re, __flags);
02001 }
02002
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016 template<typename _Ch_type, class _Allocator, class _Rx_traits>
02017 inline bool
02018 regex_search(const _Ch_type* __s,
02019 match_results<const _Ch_type*, _Allocator>& __m,
02020 const basic_regex<_Ch_type, _Rx_traits>& __e,
02021 regex_constants::match_flag_type __f
02022 = regex_constants::match_default)
02023 { return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036 template<typename _Ch_type, typename _Rx_traits>
02037 inline bool
02038 regex_search(const _Ch_type* __s,
02039 const basic_regex<_Ch_type, _Rx_traits>& __e,
02040 regex_constants::match_flag_type __f
02041 = regex_constants::match_default)
02042 { return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
02043
02044
02045
02046
02047
02048
02049
02050
02051
02052
02053
02054
02055 template<typename _Ch_traits, typename _String_allocator,
02056 typename _Ch_type, typename _Rx_traits>
02057 inline bool
02058 regex_search(const basic_string<_Ch_type, _Ch_traits,
02059 _String_allocator>& __s,
02060 const basic_regex<_Ch_type, _Rx_traits>& __e,
02061 regex_constants::match_flag_type __flags
02062 = regex_constants::match_default)
02063 { return regex_search(__s.begin(), __s.end(), __e, __flags); }
02064
02065
02066
02067
02068
02069
02070
02071
02072
02073
02074
02075
02076
02077 template<typename _Ch_traits, typename _Ch_alloc,
02078 typename _Allocator, typename _Ch_type,
02079 typename _Rx_traits>
02080 inline bool
02081 regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
02082 match_results<typename basic_string<_Ch_type,
02083 _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
02084 const basic_regex<_Ch_type, _Rx_traits>& __e,
02085 regex_constants::match_flag_type __f
02086 = regex_constants::match_default)
02087 { return regex_search(__s.begin(), __s.end(), __m, __e, __f); }
02088
02089
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100
02101
02102
02103
02104 template<typename _Out_iter, typename _Bi_iter,
02105 typename _Rx_traits, typename _Ch_type>
02106 inline _Out_iter
02107 regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
02108 const basic_regex<_Ch_type, _Rx_traits>& __e,
02109 const basic_string<_Ch_type>& __fmt,
02110 regex_constants::match_flag_type __flags
02111 = regex_constants::match_default)
02112 { return __out; }
02113
02114
02115
02116
02117
02118
02119
02120
02121
02122
02123
02124
02125 template<typename _Rx_traits, typename _Ch_type>
02126 inline basic_string<_Ch_type>
02127 regex_replace(const basic_string<_Ch_type>& __s,
02128 const basic_regex<_Ch_type, _Rx_traits>& __e,
02129 const basic_string<_Ch_type>& __fmt,
02130 regex_constants::match_flag_type __flags
02131 = regex_constants::match_default)
02132 {
02133 std::string __result;
02134 regex_replace(std::back_inserter(__result),
02135 __s.begin(), __s.end(), __e, __fmt, __flags);
02136 return __result;
02137 }
02138
02139
02140
02141
02142
02143
02144
02145
02146 template<typename _Bi_iter,
02147 typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
02148 typename _Rx_traits = regex_traits<_Ch_type> >
02149 class regex_iterator
02150 {
02151 public:
02152 typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
02153 typedef match_results<_Bi_iter> value_type;
02154 typedef std::ptrdiff_t difference_type;
02155 typedef const value_type* pointer;
02156 typedef const value_type& reference;
02157 typedef std::forward_iterator_tag iterator_category;
02158
02159 public:
02160
02161
02162
02163
02164
02165
02166 regex_iterator();
02167
02168
02169
02170
02171
02172
02173
02174
02175
02176
02177 regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
02178 regex_constants::match_flag_type __m
02179 = regex_constants::match_default);
02180
02181
02182
02183
02184
02185
02186 regex_iterator(const regex_iterator& __rhs);
02187
02188
02189
02190
02191
02192 regex_iterator&
02193 operator=(const regex_iterator& __rhs);
02194
02195
02196
02197
02198
02199 bool
02200 operator==(const regex_iterator& __rhs);
02201
02202
02203
02204
02205
02206 bool
02207 operator!=(const regex_iterator& __rhs);
02208
02209
02210
02211
02212
02213 const value_type&
02214 operator*();
02215
02216
02217
02218
02219
02220 const value_type*
02221 operator->();
02222
02223
02224
02225
02226
02227 regex_iterator&
02228 operator++();
02229
02230
02231
02232
02233
02234 regex_iterator
02235 operator++(int);
02236
02237 private:
02238
02239 _Bi_iter begin;
02240 _Bi_iter end;
02241 const regex_type* pregex;
02242 regex_constants::match_flag_type flags;
02243 match_results<_Bi_iter> match;
02244 };
02245
02246 typedef regex_iterator<const char*> cregex_iterator;
02247 typedef regex_iterator<string::const_iterator> sregex_iterator;
02248 #ifdef _GLIBCXX_USE_WCHAR_T
02249 typedef regex_iterator<const wchar_t*> wcregex_iterator;
02250 typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
02251 #endif
02252
02253
02254
02255
02256
02257
02258
02259
02260
02261 template<typename _Bi_iter,
02262 typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
02263 typename _Rx_traits = regex_traits<_Ch_type> >
02264 class regex_token_iterator
02265 {
02266 public:
02267 typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
02268 typedef sub_match<_Bi_iter> value_type;
02269 typedef std::ptrdiff_t difference_type;
02270 typedef const value_type* pointer;
02271 typedef const value_type& reference;
02272 typedef std::forward_iterator_tag iterator_category;
02273
02274 public:
02275
02276
02277
02278
02279
02280
02281
02282
02283 regex_token_iterator();
02284
02285
02286
02287
02288
02289
02290
02291
02292
02293
02294
02295
02296
02297
02298
02299
02300
02301
02302
02303
02304
02305 regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
02306 int __submatch = 0,
02307 regex_constants::match_flag_type __m
02308 = regex_constants::match_default);
02309
02310
02311
02312
02313
02314
02315
02316
02317
02318
02319
02320
02321
02322 regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
02323 const regex_type& __re,
02324 const std::vector<int>& __submatches,
02325 regex_constants::match_flag_type __m
02326 = regex_constants::match_default);
02327
02328
02329
02330
02331
02332
02333
02334
02335
02336
02337
02338
02339
02340 template<std::size_t _Nm>
02341 regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
02342 const regex_type& __re,
02343 const int (&__submatches)[_Nm],
02344 regex_constants::match_flag_type __m
02345 = regex_constants::match_default);
02346
02347
02348
02349
02350
02351
02352 regex_token_iterator(const regex_token_iterator& __rhs);
02353
02354
02355
02356
02357
02358
02359 regex_token_iterator&
02360 operator=(const regex_token_iterator& __rhs);
02361
02362
02363
02364
02365
02366 bool
02367 operator==(const regex_token_iterator& __rhs);
02368
02369
02370
02371
02372
02373 bool
02374 operator!=(const regex_token_iterator& __rhs);
02375
02376
02377
02378
02379
02380 const value_type&
02381 operator*();
02382
02383
02384
02385
02386
02387 const value_type*
02388 operator->();
02389
02390
02391
02392
02393
02394 regex_token_iterator&
02395 operator++();
02396
02397
02398
02399
02400
02401 regex_token_iterator
02402 operator++(int);
02403
02404 private:
02405 typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> position_iterator;
02406
02407 position_iterator __position;
02408 const value_type* __result;
02409 value_type __suffix;
02410 std::size_t __n;
02411 std::vector<int> __subs;
02412 };
02413
02414
02415 typedef regex_token_iterator<const char*> cregex_token_iterator;
02416
02417 typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
02418 #ifdef _GLIBCXX_USE_WCHAR_T
02419
02420 typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
02421
02422 typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
02423 #endif
02424
02425
02426
02427 }
02428