Go to the documentation of this file.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
00032 namespace std
00033 {
00034 template<typename _BiIter>
00035 class sub_match;
00036
00037 template<typename _Bi_iter, typename _Allocator>
00038 class match_results;
00039
00040 namespace __regex
00041 {
00042
00043 template<typename _FwdIterT, typename _Alloc>
00044 class _SpecializedResults
00045 : public _Results
00046 {
00047 public:
00048 _SpecializedResults(const _Automaton::_SizeT __size,
00049 const _SpecializedCursor<_FwdIterT>& __cursor,
00050 match_results<_FwdIterT, _Alloc>& __m);
00051
00052 void
00053 _M_set_pos(int __i, int __j, const _PatternCursor& __pc);
00054
00055 void
00056 _M_set_matched(int __i, bool __is_matched)
00057 { _M_results.at(__i).matched = __is_matched; }
00058
00059 private:
00060 match_results<_FwdIterT, _Alloc>& _M_results;
00061 };
00062
00063 template<typename _FwdIterT, typename _Alloc>
00064 _SpecializedResults<_FwdIterT, _Alloc>::
00065 _SpecializedResults(const _Automaton::_SizeT __size,
00066 const _SpecializedCursor<_FwdIterT>& __cursor,
00067 match_results<_FwdIterT, _Alloc>& __m)
00068 : _M_results(__m)
00069 {
00070 typedef typename match_results<_FwdIterT, _Alloc>::size_type size_type;
00071 _M_results.clear();
00072 std::sub_match<_FwdIterT> __sm;
00073 __sm.matched = false;
00074 size_type __result_count = __size + 2;
00075 for (size_type __i = 0; __i < __result_count; ++__i)
00076 _M_results.push_back(__sm);
00077 _M_results.at(__size+0).first = __cursor._M_begin();
00078 _M_results.at(__size+0).second = __cursor._M_begin();
00079 _M_results.at(__size+1).first = __cursor._M_end();
00080 _M_results.at(__size+1).second = __cursor._M_end();
00081 }
00082
00083 template<typename _FwdIterT, typename _Alloc>
00084 void
00085 _SpecializedResults<_FwdIterT, _Alloc>::
00086 _M_set_pos(int __i, int __j, const _PatternCursor& __pc)
00087 {
00088 typedef const _SpecializedCursor<_FwdIterT>& _CursorT;
00089 _CursorT __c = static_cast<_CursorT>(__pc);
00090 if (__j == 0)
00091 _M_results.at(__i).first = __c._M_pos();
00092 else
00093 _M_results.at(__i).second = __c._M_pos()+1;
00094 }
00095
00096
00097 typedef std::stack<_StateIdT, std::vector<_StateIdT> > _StateStack;
00098
00099
00100
00101
00102 class _Grep_matcher
00103 {
00104 public:
00105 _Grep_matcher(_PatternCursor& __p,
00106 _Results& __r,
00107 const _AutomatonPtr& __automaton,
00108 regex_constants::match_flag_type __flags);
00109
00110 private:
00111 _StateSet
00112 _M_e_closure(_StateIdT __i);
00113
00114 _StateSet
00115 _M_e_closure(const _StateSet& __s);
00116
00117 _StateSet
00118 _M_e_closure(_StateStack& __stack, const _StateSet& __s);
00119
00120 private:
00121 const std::shared_ptr<_Nfa> _M_nfa;
00122 _PatternCursor& _M_pattern;
00123 _Results& _M_results;
00124 };
00125
00126 }
00127 }
00128
00129 #include <bits/regex_grep_matcher.tcc>
00130
00131