[Javanetsim-cvs] IceScan/icesockets iceregex.h,1.7,1.8
Status: Beta
Brought to you by:
darkkey
From: QweR <qw...@us...> - 2006-12-13 22:40:34
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20905/icesockets Modified Files: iceregex.h Log Message: Index: iceregex.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/iceregex.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iceregex.h 13 Dec 2006 13:13:30 -0000 1.7 --- iceregex.h 13 Dec 2006 22:40:30 -0000 1.8 *************** *** 15,29 **** #include "sock_types.h" class IceRegex { public: IceRegex (const icestring pattern){ ! this->pattern = pattern; init_regex(); } IceRegex (const char pattern[]){ ! icestring is(pattern); ! this->pattern = is; init_regex(); } --- 15,29 ---- #include "sock_types.h" + #include "../icedebug.h" class IceRegex { public: IceRegex (const icestring pattern){ ! this->pattern.assign(pattern); init_regex(); } IceRegex (const char pattern[]){ ! this->pattern.assign(pattern); init_regex(); } *************** *** 64,68 **** subject.assign(s); int res = find(s, v, 0); ! if(res) findPoint = ovector_[0]+1; else findPoint = 0; return res; --- 64,68 ---- subject.assign(s); int res = find(s, v, 0); ! if(res) findPoint = findPoint = ovector_[(pcre_result_-1)*2+1]; else findPoint = 0; return res; *************** *** 83,86 **** --- 83,94 ---- if(findPoint >= subject.length()) return false; int res = find(subject, v, findPoint); + if(res) findPoint = ovector_[(pcre_result_-1)*2+1]; + return res; + } + + bool findNextMin(){ + std::vector<icestring> v; + if(findPoint >= subject.length()) return false; + int res = find(subject, v, findPoint); if(res) findPoint = ovector_[0]+1; return res; *************** *** 123,129 **** bool group(int i, icestring &str){ ! char* cstr = new char[subject.length()+1]; ! int res = group(i, cstr, subject.length()); ! if(res) str.assign(cstr, subject.length()); return res; } --- 131,138 ---- bool group(int i, icestring &str){ ! char* cstr = new char[subject.length()+5]; ! int res = group(i, cstr, subject.length()+4); ! if(res) str.assign(cstr); ! delete[] cstr; return res; } *************** *** 131,134 **** --- 140,146 ---- private: bool find(icestring const& s, std::vector<icestring> &v, int start){ + + // std::cout << s << std::endl; + int rc = pcre_exec ( pcre_, /* the compiled pattern */ *************** *** 139,143 **** 0, /* default options */ ovector_, /* output vector for substring information */ ! 3*(capture_count_+1)); /* number of elements in the output vector */ pcre_result_ = rc; --- 151,159 ---- 0, /* default options */ ovector_, /* output vector for substring information */ ! 3*(capture_count_+1) /* number of elements in the output vector */ ! ); ! ! // std::cout << s << std::endl; ! // std::cout << rc << std::endl; pcre_result_ = rc; |