home *** CD-ROM | disk | FTP | other *** search
-
- XFile
- -----
-
- This unit give you object-oriented access to files.
-
-
- TFile
- ~~~~~
-
- "TFile" implements a general object for file access. You can
- write your own descendants from this object for configuration-files,
- file-viewers, converters, etc.
-
- Fields:
- -------
-
- FileName : PathStr The name of the file should be accessed
- F : File an untyped file variable
- Buffer : TextBuf a placeholder for "TTextFile" object
- which use F as TEXT-file !
- Status : Integer Here the status of the last operation is stored
-
- Methods
- -------
- constructor Init(AName:PathStr);
- Initalize the object with AName. FileName is set to AName, Status
- is cleared and F is assigned to FileName as untyped file.
-
- destructor Done; virtual;
- Close the file if opend and then shut down this object-instance
-
- function Error(Code:Integer):boolean; virtual;
- Any error occured on operations is reported to this method
-
- function Open:Boolean; virtual;
- Open the file with a record-size of 1
-
- function Create:Boolean; virtual;
- Create a file with a record-size of 1
-
- procedure Close; virtual;
- Close the file. But only if previous opend by an Open or
- Create call !
-
- function Exists:Boolean; virtual;
- Determine if the file exists
-
- procedure Delete; virtual;
- Delete the file. Before deletion an open file might be closed.
-
- procedure Seek ( Pos:Longint ); virtual;
- Move the file-pointer to the specified position
-
- procedure Write( var Buf; Count:Word ); virtual;
- Write a data-block to the file
-
- procedure Read ( var Buf; Count:Word ); virtual;
- Read a data-block from the file
-
- function ReplaceExt(NExt: ExtStr; Force:Boolean):PathStr; virtual;
- Replace an existing Extentsion with another if no one exists
- or Force is on TRUE
-
- procedure Rename(NewName:PathStr); virtual;
- Rename the file to
-
- procedure Cut(At:Longint); virtual;
- Cut the file at the specified position
-
- function IsOpen:boolean; virtual;
- Checks if the file is opend
-
- function IsConsole:Boolean; virtual;
- Checks if the file is a console device
-
- function GetAttr:Word; virtual;
- Return the dos-attribut of the file
-
- procedure SetAttr(NewAttr:Word); virtual;
- Set an attribut to the file
-
- function GetHandle:Word; virtual;
- Return the DOS-File Handle of the file
-
- function GetDate:Longint; virtual;
- Return the file-date-time stamp
-
- function GetLength:Longint; virtual;
- Return the current file-size
-
- function GetDir:DirStr; virtual;
- Return only the directory part of the filepath
-
- function GetName:NameStr; virtual;
- Return only the name part of the filepath
-
- function GetExt:ExtStr; virtual;
- Return only the extentsion of the filepath. '.' included
-
- function GetNameExt:PathStr; virtual;
- Return only the name and extentsion of the filepath, without
- the directory
-
- function GetDirName:PathStr; virtual;
- Return only the directory and name of the filepath, without
- the extentsion
-
- function GetPath:PathStr; virtual;
- Return the full filepath
-
- TTextFile
- ~~~~~~~~~
- "TTextFile" is a decendant from "TFile" but access a Text-file.
- You can do Readln's and Writeln's to it.
-
- Fields:
- -------
-
- FText : ^Text A pointer to a text-file
-
- Methods
- -------
- constructor Init(AName:PathStr);
- Initalize the object with AName. FileName is set to AName, Status
- is cleared and F is assigned to FileName as text file. Also
- FText is set on F so that you can use text-file functions.
- But note that you can't use furthermore functions like
- Write/Read etc.
-
- function Open:boolean
- Overwrite so that it opens a text-file
-
- function Create:boolean
- Overwrite so that it create and open a text-file
-
- procedure Close;
- Overwrite so that it close a text-file
-
- function Eof:Boolean
- Return TRUE if at the End-Of-File position in the
- text file.
-
-
-