Guest User

Untitled

a guest
Sep 4th, 2012
64
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. TAbstractFile = CLASS ABSTRACT
  2.     (***) PROTECTED (***)
  3.       CONST
  4.         MIN_BUF_SIZE  = 64 * 1024;
  5.         MAX_BUF_SIZE  = 1024 * 1024;
  6.    
  7.       VAR
  8.         fMode:          TDeviceMode;
  9.         fHasKnownSize:  BOOLEAN;
  10.         fSizeIsConst:   BOOLEAN;
  11.         fSize:          INTEGER;
  12.         fPos:           INTEGER;
  13.         fEOF:           BOOLEAN;
  14.  
  15.     (***) PUBLIC (***)
  16.       (* Core *)
  17.      
  18.       // Reads 1..Count bytes
  19.       FUNCTION  ReadUpTo
  20.       (
  21.                 Count:      INTEGER;
  22.             {n} Buf:        POINTER;
  23.         OUT     BytesRead:  INTEGER
  24.       ): BOOLEAN; VIRTUAL; ABSTRACT;
  25.      
  26.       // Writes 1..Count bytes
  27.       FUNCTION  WriteUpTo
  28.       (
  29.                 Count:        INTEGER;
  30.             {n} Buf:          POINTER;
  31.         OUT     ByteWritten:  INTEGER
  32.       ): BOOLEAN; VIRTUAL; ABSTRACT;
  33.  
  34.       FUNCTION  Seek (NewPos: INTEGER): BOOLEAN; VIRTUAL; ABSTRACT;
  35.    
  36.       (* Reading *)
  37.       FUNCTION  Read (Count: INTEGER; {n} Buf: POINTER): BOOLEAN;
  38.       FUNCTION  ReadByte (OUT Res: BYTE): BOOLEAN;
  39.       FUNCTION  ReadInt (OUT Res: INTEGER): BOOLEAN;
  40.       FUNCTION  ReadStr (Count: INTEGER; OUT Res: STRING): BOOLEAN;
  41.       FUNCTION  ReadAllToBuf (OUT Buf: POINTER; OUT Size: INTEGER): BOOLEAN;
  42.       FUNCTION  ReadAllToStr (OUT Str: STRING): BOOLEAN;
  43.  
  44.       (* Writing *)
  45.       FUNCTION  Write (Count: INTEGER; {n} Buf: POINTER): BOOLEAN;
  46.       FUNCTION  WriteByte (Data: BYTE): BOOLEAN;
  47.       FUNCTION  WriteWord (Data: WORD): BOOLEAN;
  48.       FUNCTION  WriteInt (Data: INTEGER): BOOLEAN;
  49.       FUNCTION  WriteStr (Data: STRING): BOOLEAN;
  50.       FUNCTION  WriteFrom (Count: INTEGER; Source: TAbstractFile): BOOLEAN;
  51.       FUNCTION  WriteAllFrom (Source: TAbstractFile): BOOLEAN;
  52.  
  53.       PROPERTY  Mode:         TDeviceMode READ fMode;
  54.       PROPERTY  HasKnownSize: BOOLEAN READ fHasKnownSize;
  55.       PROPERTY  SizeIsConst:  BOOLEAN READ fSizeIsConst;
  56.       PROPERTY  Size:         INTEGER READ fSize;
  57.       PROPERTY  Pos:          INTEGER READ fPos;
  58.       PROPERTY  EOF:          BOOLEAN READ fEOF;
  59.   END; // .CLASS TAbstractFile
RAW Paste Data