Cafu Engine
cf::FileSys::FileManI Class Referenceabstract

This class provides an interface to a file manager. More...

#include "FileMan.hpp"

Inheritance diagram for cf::FileSys::FileManI:

Public Member Functions

virtual ~FileManI ()
 The destructor. More...
virtual FileSystemTMountFileSystem (FileSystemTypeT Type, const std::string &Descr, const std::string &MountPoint, const std::string &Password="")=0
 "Mounts" (or "registers") a new file system into the scope of the file manager. More...
virtual void Unmount (FileSystemT *FileSystem)=0
 "Unmounts" (or "unregisters") a file system from the file manager. More...
virtual InFileIOpenRead (const std::string &FileName)=0
 Opens the file with the given name for reading. More...
virtual void Close (FileI *File)=0
 Closes the given file. More...

Detailed Description

This class provides an interface to a file manager.

The interface is specified as an ABC in order to be able to share it across exe/dll boundaries.

Constructor & Destructor Documentation

virtual cf::FileSys::FileManI::~FileManI ( )

The destructor.

This ABC does neither have nor need a destructor, because no implementation will ever be deleted via a pointer to a FileManI. (The implementations are singletons after all.) See the Singleton pattern and the C++ FAQ 21.05 (the "precise rule") for more information. g++ however issues a warning with no such destructor, so I provide one anyway and am safe.

Member Function Documentation

virtual void cf::FileSys::FileManI::Close ( FileI File)
pure virtual

Closes the given file.

Implemented in cf::FileSys::FileManImplT.

virtual FileSystemT* cf::FileSys::FileManI::MountFileSystem ( FileSystemTypeT  Type,
const std::string &  Descr,
const std::string &  MountPoint,
const std::string &  Password = "" 
pure virtual

"Mounts" (or "registers") a new file system into the scope of the file manager.

For example, you can register paths on a local hard-disk, compressed archives and HTTP connections as file systems.

TypeThe type of the file system to be mounted.
DescrA description/specification of the file system to be mounted, for example "Games/DeathMatch/", "", etc.
MountPointThe mount point of the file system, i.e. the path where the contents of the file system is attached to.
PasswordThe password string that might be required to access the specified file system (e.g. encrypted zip archives).
a handle to the mounted file system, or NULL on error. Note that the handle is "opaque" for the user code. That is, it can do nothing with it but check it for NULL in order to learn if an error occurred, and pass it to Unregister() later. Also note that a mount failure (getting a NULL result) here is not necessarily reason enough to terminate the entire application - the file manager is robust enough to deal with the situation (i.e. you can pass NULL to Unregister()), but of course opening files that are supposed to be in the file system that failed to mount will not succeed.

Implemented in cf::FileSys::FileManImplT.

virtual InFileI* cf::FileSys::FileManI::OpenRead ( const std::string &  FileName)
pure virtual

Opens the file with the given name for reading.

The registered file systems are probed in opposite order in which they have been registered for opening the file.

FileNameThe name of the file to be opened within one of the previously registered file systems.
The pointer to the file or NULL if the file could not be opened.

Implemented in cf::FileSys::FileManImplT.

virtual void cf::FileSys::FileManI::Unmount ( FileSystemT FileSystem)
pure virtual

"Unmounts" (or "unregisters") a file system from the file manager.

FileSystemThe handle to the file system that was obtained by the call to MountFileSystem.

Implemented in cf::FileSys::FileManImplT.

The documentation for this class was generated from the following file: