Procedure

TPatternSearcher.SearchWithUC

Module

PsEngine

Last Modified

2007-05-17 15:58:28

Comments

Not case-sensitive search method

Visibility

Private

Owner

TPatternSearcher

Declaration

procedure SearchWithUC(const Path : string);

Called-By Hierarchy


   TPatternSearcher.SearchWithUC
       TPatternSearcher.Search┘ 
   TPSMainForm.GeneralSearch┘   
TPSMainForm.CmdSearchClick┘     

Called-By

Name Declaration Comments
TPatternSearcher.Search procedure Search; -


Source

257   procedure TPatternSearcher.SearchWithUC(const Path : string);
258   // not case-sensitive search method
259   var
260     I : integer;
261     S, T, W : string;
262     First : boolean;
263     Posn : cardinal;
264   begin
265     if FListAllSearchedFiles then
266       FLog.Add('Searching '+Path); // write this, even if no match found
267   
268     SL.LoadFromFile(Path);
269     First := true;
270   
271     for I := 0 to SL.Count-1 do
272     begin
273       S := SL[I];
274   
275       if Length(S) > 0 then
276       begin
277         while SearchUC(S[1], Length(S), FPattern[1], FLenPattern, Posn) do
278         begin
279           T := S;
280           S := copy(S, Posn+1, Length(S)-Posn+1);
281   
282           if First then
283           begin
284             if not FListAllSearchedFiles then // now OK to write, match found..
285               FLog.Add('Searching '+Path);
286   
287             FLog.Add('');
288             inc(FNumFilesMatches);
289             First := false;
290           end;
291   
292           inc(FNumMatches);
293           str(I+1:4, W);
294   
295           T := copy(T, Posn+1, Length(T)-Posn+1);
296           FLog.Add(' Line '+W+': '+T);
297           S := copy(S, 2, Length(S)-1);
298   
299           if FEvaluation and (FNumMatches = 3) then
300             Exit;
301         end;
302       end;
303     end;
304   
305     if not First then
306       FLog.Add('');
307   end;