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