home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / Chip_2000-02_cd.bin / zkuste / Delphi / navody / tt / objvm.exe / UNITS / DirIter.pas < prev    next >
Pascal/Delphi Source File  |  1998-01-30  |  1KB  |  43 lines

  1. unit DirIter;
  2.  
  3. interface
  4. uses Iter,
  5.      SysUtils;
  6. type TDirIter=class(TIter)
  7.      protected
  8.        f:TSearchRec;
  9.        fState:integer;
  10.        function rdFileName:string;
  11.      public
  12.        constructor Create(const S:string;Attr:integer);
  13.        procedure Next;override;
  14.        function  IsEnd:Boolean;override;
  15.        destructor Destroy;override;
  16.        property   FileName:string read rdFileName;
  17.        property   SearchRec:TSearchRec read f; 
  18.      end;
  19. implementation
  20. constructor TDirIter.Create;
  21.             begin
  22.               Inherited Create;
  23.               fState:=FindFirst(S,Attr,F);
  24.             end;
  25. procedure   TDirIter.Next;
  26.             begin
  27.               fState:=FindNext(F);
  28.             end;
  29. function    TDirIter.IsEnd;
  30.             begin
  31.               Result:=fState<>0;
  32.             end;
  33. destructor  TDirIter.Destroy;
  34.             begin
  35.               FindClose(F);
  36.               Inherited Destroy;
  37.             end;
  38. function    TDirIter.rdFileName;
  39.             begin
  40.               Result:=f.Name;
  41.             end;
  42. end.
  43.