Ignore:
Timestamp:
Nov 28, 2012, 7:50:19 AM (12 years ago)
Author:
chronos
Message:
  • Modified: TListFile enhancements.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Generics/NativeGenerics/Units/GenericList.pas

    r425 r458  
    9595    function Get(Index: TIndex): TItem; override;
    9696    function GetInternal(Index: TIndex): TItem; override;
     97    function GetCount: TIndex; override;
    9798    function GetCapacity: TIndex;
    98     function GetCount: TIndex; override;
     99    procedure SetCount(const AValue: TIndex); override;
    99100    procedure SetCapacity(const AValue: TIndex);
    100101    procedure SetCapacityOptimized(const NewCapacity: TIndex);
    101     procedure SetCount(const AValue: TIndex); override;
    102102    procedure Put(Index: TIndex; const AValue: TItem); override;
    103103    procedure PutInternal(Index: TIndex; const AValue: TItem); override;
     
    141141  TGFileList<TItem> = class(TGList<TItem>)
    142142  private
     143    FFileName: string;
    143144    FHandle: THandle;
     145    FMode: Word;
     146    function GetOpenned: Boolean;
     147    procedure SetFileName(AValue: string);
     148    procedure SetMode(AValue: Word);
    144149  protected
    145150    function GetCount: TIndex; override;
     
    150155    procedure Put(Index: TIndex; const AValue: TItem); override;
    151156  public
    152     procedure Open(FileName: string; Mode: Integer);
     157    procedure Open;
    153158    procedure Close;
    154159    constructor Create;
    155160    destructor Destroy; override;
     161    property FileName: string read FFileName write SetFileName;
     162    property Mode: Word read FMode write SetMode;
     163    property Openned: Boolean read GetOpenned;
    156164  end;
    157165
     
    865873{ TGFileList<TItem> }
    866874
     875procedure TGFileList<TItem>.SetFileName(AValue: string);
     876begin
     877  if FFileName = AValue then Exit;
     878  FFileName := AValue;
     879  if Openned then begin
     880    Close;
     881    Open;
     882  end;
     883end;
     884
     885function TGFileList<TItem>.GetOpenned: Boolean;
     886begin
     887  Result := FHandle <> feInvalidHandle;
     888end;
     889
     890procedure TGFileList<TItem>.SetMode(AValue: Word);
     891begin
     892  if FMode = AValue then Exit;
     893  FMode := AValue;
     894  if Openned then begin
     895    Close;
     896    Open;
     897  end;
     898end;
     899
    867900function TGFileList<TItem>.GetCount: TIndex;
    868901var
     
    901934end;
    902935
    903 procedure TGFileList<TItem>.Open(FileName: string; Mode: Integer);
     936procedure TGFileList<TItem>.Open;
    904937begin
    905938  Close;
Note: See TracChangeset for help on using the changeset viewer.