home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 April / Chip_1997-04_cd.bin / prezent / cb / data.z / FILEINTF.PAS < prev    next >
Pascal/Delphi Source File  |  1997-01-16  |  4KB  |  83 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {       Delphi Visual Component Library                 }
  4. {                                                       }
  5. {       Copyright (c) 1996 Borland International        }
  6. {                                                       }
  7. {*******************************************************}
  8.  
  9. unit FileIntf;
  10.  
  11. interface
  12.  
  13. uses SysUtils, VirtIntf;
  14.  
  15. {
  16.   This is the definition of the IDE's virtual file system.  An expert,
  17.   VCS manager, property editor, or component editor can register a new
  18.   file system interface with the IDE.  This allows for re-vectoring of
  19.   file operations to the editor and form/data model designer.
  20.   NOTE: Currently the only way to specify an alternate file system for
  21.         a file, is to open it through the Tools API (See ToolIntf.pas).
  22.         This is also only for saving/loading of files.  The default file
  23.         open/save dialogs and file system will always be used by the IDE
  24.         except in the case mentioned above.
  25.  
  26.   All references to the term "file" depend on how it is defined by the
  27.   file system.  The "file" could be a Memo Blob field, SQL text, etc...
  28.  
  29.   A file system instance must provide the following;
  30.  
  31.   GetFileStream     -  This is the core of the file system.  The file system
  32.                        must return an instance of a TIStream for reading/
  33.                        writing according to the Mode (see Classes.pas for
  34.                        mode values).
  35.   FileAge           -  This should return long value corresponding to the DOS
  36.                        file date format.
  37.   RenameFile        -  Returns True if the file system was able to rename the
  38.                        file.
  39.   IsReadonly        -  Return True if the given file is read only.
  40.   IsFileBased       -  Return True if the file system closely matches the OS
  41.                        file system.  If this is False, certain operations
  42.                        are not performed.
  43.   DeleteFile        -  Return True is the file was successfully deleted.
  44.   FileExists        -  Return True if the specifiedl file exists in this
  45.                        file system.
  46.   GetTempFileName   -  Returns a Temporary file name based on the name given.
  47.   GetBackupFileName -  Returns a backup file name based on the name given.
  48.                        By convention, the extension is shifted one character
  49.                        to the right and a tilde '~' character is inserted.
  50.                        (eg unit1.pas -> unit1.~pa).
  51.   GetIDString       -  Returns a unique ID string used to identify the file
  52.                        system. By conventions this string should be in the
  53.                        form <Vendor or Product>.<FileSystemName>.
  54.                        (eg. Borland.SQLFileSystem ).
  55. }
  56.  
  57. type
  58.   TIVirtualFileSystem = class(TInterface)
  59.   public
  60.     function GetFileStream(const FileName: TFileName; Mode: Integer): TIStream;
  61.       virtual; stdcall; abstract;
  62.     function FileAge(const FileName: TFileName): Longint;
  63.       virtual; stdcall; abstract;
  64.     function RenameFile(const OldName, NewName: TFileName): Boolean;
  65.       virtual; stdcall; abstract;
  66.     function IsReadonly(const FileName: TFileName): Boolean;
  67.       virtual; stdcall; abstract;
  68.     function IsFileBased: Boolean; virtual; stdcall; abstract;
  69.     function DeleteFile(const FileName: TFileName): Boolean;
  70.       virtual; stdcall; abstract;
  71.     function FileExists(const FileName: TFileName): Boolean;
  72.       virtual; stdcall; abstract;
  73.     function GetTempFileName(const FileName: TFileName): TFileName;
  74.       virtual; stdcall; abstract;
  75.     function GetBackupFileName(const FileName: TFileName): TFileName;
  76.       virtual; stdcall; abstract;
  77.     function GetIDString: string; virtual; stdcall; abstract;
  78.   end;
  79.  
  80. implementation
  81.  
  82. end.
  83.