/packages/fcl-db/src/dbase/dbf_cursor.pas
Pascal | 64 lines | 46 code | 16 blank | 2 comment | 1 complexity | 4ff6329c2568f633ed3164b54778675e MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
1unit dbf_cursor; 2 3interface 4 5{$I dbf_common.inc} 6 7uses 8 SysUtils, 9 Classes, 10 dbf_pgfile, 11 dbf_common; 12 13type 14 15//==================================================================== 16 TVirtualCursor = class(TObject) 17 private 18 FFile: TPagedFile; 19 20 protected 21 function GetPhysicalRecNo: Integer; virtual; abstract; 22 function GetSequentialRecNo: Integer; virtual; abstract; 23 function GetSequentialRecordCount: Integer; virtual; abstract; 24 procedure SetPhysicalRecNo(RecNo: Integer); virtual; abstract; 25 procedure SetSequentialRecNo(RecNo: Integer); virtual; abstract; 26 27 public 28 constructor Create(pFile: TPagedFile); 29 destructor Destroy; override; 30 31 function RecordSize: Integer; 32 33 function Next: Boolean; virtual; abstract; 34 function Prev: Boolean; virtual; abstract; 35 procedure First; virtual; abstract; 36 procedure Last; virtual; abstract; 37 38 property PagedFile: TPagedFile read FFile; 39 property PhysicalRecNo: Integer read GetPhysicalRecNo write SetPhysicalRecNo; 40 property SequentialRecNo: Integer read GetSequentialRecNo write SetSequentialRecNo; 41 property SequentialRecordCount: Integer read GetSequentialRecordCount; 42 end; 43 44implementation 45 46constructor TVirtualCursor.Create(pFile: TPagedFile); 47begin 48 FFile := pFile; 49end; 50 51destructor TVirtualCursor.Destroy; {override;} 52begin 53end; 54 55function TVirtualCursor.RecordSize : Integer; 56begin 57 if FFile = nil then 58 Result := 0 59 else 60 Result := FFile.RecordSize; 61end; 62 63end. 64