Procedure
Module
PsEngine
Last Modified
2007-05-17 15:58:28
Comments
Visibility
Private
Owner
TPatternSearcher
Declaration
procedure SearchWithPos(const Path : string); // searches with Pos (intf)
Called-By Hierarchy
TPatternSearcher.SearchWithPos
TPatternSearcher.Search┘
TPSMainForm.GeneralSearch┘
TPSMainForm.CmdSearchClick┘
Called-By
Source
206 procedure TPatternSearcher.SearchWithPos(const Path : string);
207 // case-sensitive search method
208 var
209 I, Posn : integer;
210 S, T, W : string;
211 First : boolean;
212 begin
213 if FListAllSearchedFiles then
214 FLog.Add('Searching '+Path); // write this, even if no match found
215
216 SL.LoadFromFile(Path);
217 First := true;
218
219 for I := 0 to SL.Count-1 do
220 begin
221 S := SL[I];
222 Posn := 1;
223
224 while (Posn <> 0) and (Length(S) > 0) do
225 begin
226 Posn := Pos(FPattern, S);
227
228 if Posn <> 0 then
229 begin
230 if First then
231 begin
232 if not FListAllSearchedFiles then // now OK to write, match found..
233 FLog.Add('Searching '+Path);
234
235 FLog.Add('');
236 inc(FNumFilesMatches);
237 First := false;
238 end;
239
240 inc(FNumMatches);
241 str(I+1:4, W);
242
243 S := copy(S, Posn, Length(S)-Posn+1); // copy to end of line
244 FLog.Add(' Line '+W+': '+S);
245 S := copy(S, FLenPattern+1, Length(S)-(FLenPattern+1)+1);
246
247 if FEvaluation and (FNumMatches = 3) then
248 Exit;
249 end;
250 end;
251 end;
252
253 if not First then
254 FLog.Add('');
255 end;