/packages/fcl-db/src/dbase/dbf_cursor.pas

https://github.com/slibre/freepascal · Pascal · 64 lines · 46 code · 16 blank · 2 comment · 1 complexity · 4ff6329c2568f633ed3164b54778675e MD5 · raw file

  1. unit dbf_cursor;
  2. interface
  3. {$I dbf_common.inc}
  4. uses
  5. SysUtils,
  6. Classes,
  7. dbf_pgfile,
  8. dbf_common;
  9. type
  10. //====================================================================
  11. TVirtualCursor = class(TObject)
  12. private
  13. FFile: TPagedFile;
  14. protected
  15. function GetPhysicalRecNo: Integer; virtual; abstract;
  16. function GetSequentialRecNo: Integer; virtual; abstract;
  17. function GetSequentialRecordCount: Integer; virtual; abstract;
  18. procedure SetPhysicalRecNo(RecNo: Integer); virtual; abstract;
  19. procedure SetSequentialRecNo(RecNo: Integer); virtual; abstract;
  20. public
  21. constructor Create(pFile: TPagedFile);
  22. destructor Destroy; override;
  23. function RecordSize: Integer;
  24. function Next: Boolean; virtual; abstract;
  25. function Prev: Boolean; virtual; abstract;
  26. procedure First; virtual; abstract;
  27. procedure Last; virtual; abstract;
  28. property PagedFile: TPagedFile read FFile;
  29. property PhysicalRecNo: Integer read GetPhysicalRecNo write SetPhysicalRecNo;
  30. property SequentialRecNo: Integer read GetSequentialRecNo write SetSequentialRecNo;
  31. property SequentialRecordCount: Integer read GetSequentialRecordCount;
  32. end;
  33. implementation
  34. constructor TVirtualCursor.Create(pFile: TPagedFile);
  35. begin
  36. FFile := pFile;
  37. end;
  38. destructor TVirtualCursor.Destroy; {override;}
  39. begin
  40. end;
  41. function TVirtualCursor.RecordSize : Integer;
  42. begin
  43. if FFile = nil then
  44. Result := 0
  45. else
  46. Result := FFile.RecordSize;
  47. end;
  48. end.