VirtualFileSystem Class Reference

The Virtual File System. More...

#include <ifilesystem.h>

Public Member Functions

 INTEGER_CONSTANT (Version, 1)
 STRING_CONSTANT (Name,"VFS")
virtual ~VirtualFileSystem ()
virtual void initDirectory (const std::string &path)=0
 Adds a root search path. Called before initialise.
virtual void initialise ()=0
 Initialises the filesystem. Called after all root search paths have been added.
virtual void shutdown ()=0
 Shuts down the filesystem.
virtual ArchiveFileopenFile (const std::string &filename)=0
 Returns the file identified by filename opened in binary mode, or 0 if not found. The caller must release() the file returned if it is not 0.
virtual ArchiveTextFileopenTextFile (const std::string &filename)=0
 Returns the file identified by filename opened in text mode, or 0 if not found. The caller must release() the file returned if it is not 0.
virtual std::size_t loadFile (const std::string &filename, void **buffer)=0
 Opens the file identified by filename and reads it into buffer, or sets *buffer to 0 if not found. Returns the size of the buffer allocated, or undefined value if *buffer is 0; The caller must free the allocated buffer by calling freeFile.
virtual void freeFile (void *p)=0
 Frees the buffer returned by loadFile.
virtual void forEachDirectory (const char *basedir, const FileNameCallback &callback, std::size_t depth=1)=0
 Calls callback for each directory under basedir.
virtual void forEachFile (const char *basedir, const char *extension, const FileNameCallback &callback, std::size_t depth=1)=0
 Calls callback for each file under basedir matching extension. Use "*" as extension to match all file extensions.
virtual std::string findFile (const std::string &name)=0
 Returns the absolute filename for a relative name, or "" if not found.
virtual std::string findRoot (const std::string &name)=0
 Returns the filesystem root for an absolute name, or "" if not found. This can be used to convert an absolute name to a relative name.
virtual std::string getRelative (const std::string &name)=0
 Returns the relative path of a file.
virtual void attach (ModuleObserver &observer)=0
 Attach an observer whose realise() and unrealise() methods will be called when the filesystem is initialised or shut down.
virtual void detach (ModuleObserver &observer)=0
 Detach an observer previously-attached by calling attach.
virtual ArchivegetArchive (const char *archiveName)=0
virtual void forEachArchive (const ArchiveNameCallback &callback)=0

Detailed Description

The Virtual File System.

Definition at line 42 of file ifilesystem.h.


Constructor & Destructor Documentation

virtual VirtualFileSystem::~VirtualFileSystem (  )  [inline, virtual]

Definition at line 48 of file ifilesystem.h.


Member Function Documentation

virtual void VirtualFileSystem::attach ( ModuleObserver &  observer  )  [pure virtual]

Attach an observer whose realise() and unrealise() methods will be called when the filesystem is initialised or shut down.

virtual void VirtualFileSystem::detach ( ModuleObserver &  observer  )  [pure virtual]

Detach an observer previously-attached by calling attach.

virtual std::string VirtualFileSystem::findFile ( const std::string name  )  [pure virtual]

Returns the absolute filename for a relative name, or "" if not found.

virtual std::string VirtualFileSystem::findRoot ( const std::string name  )  [pure virtual]

Returns the filesystem root for an absolute name, or "" if not found. This can be used to convert an absolute name to a relative name.

virtual void VirtualFileSystem::forEachArchive ( const ArchiveNameCallback callback  )  [pure virtual]
virtual void VirtualFileSystem::forEachDirectory ( const char *  basedir,
const FileNameCallback callback,
std::size_t  depth = 1 
) [pure virtual]

Calls callback for each directory under basedir.

virtual void VirtualFileSystem::forEachFile ( const char *  basedir,
const char *  extension,
const FileNameCallback callback,
std::size_t  depth = 1 
) [pure virtual]

Calls callback for each file under basedir matching extension. Use "*" as extension to match all file extensions.

virtual void VirtualFileSystem::freeFile ( void *  p  )  [pure virtual]

Frees the buffer returned by loadFile.

Deprecated:
Deprecated.

Referenced by vfsFreeFile().

virtual Archive* VirtualFileSystem::getArchive ( const char *  archiveName  )  [pure virtual]
virtual std::string VirtualFileSystem::getRelative ( const std::string name  )  [pure virtual]

Returns the relative path of a file.

virtual void VirtualFileSystem::initDirectory ( const std::string path  )  [pure virtual]

Adds a root search path. Called before initialise.

virtual void VirtualFileSystem::initialise (  )  [pure virtual]

Initialises the filesystem. Called after all root search paths have been added.

VirtualFileSystem::INTEGER_CONSTANT ( Version  ,
 
)
virtual std::size_t VirtualFileSystem::loadFile ( const std::string filename,
void **  buffer 
) [pure virtual]

Opens the file identified by filename and reads it into buffer, or sets *buffer to 0 if not found. Returns the size of the buffer allocated, or undefined value if *buffer is 0; The caller must free the allocated buffer by calling freeFile.

Deprecated:
Deprecated - use openFile.

Referenced by vfsLoadFile().

virtual ArchiveFile* VirtualFileSystem::openFile ( const std::string filename  )  [pure virtual]

Returns the file identified by filename opened in binary mode, or 0 if not found. The caller must release() the file returned if it is not 0.

virtual ArchiveTextFile* VirtualFileSystem::openTextFile ( const std::string filename  )  [pure virtual]

Returns the file identified by filename opened in text mode, or 0 if not found. The caller must release() the file returned if it is not 0.

virtual void VirtualFileSystem::shutdown (  )  [pure virtual]

Shuts down the filesystem.

VirtualFileSystem::STRING_CONSTANT ( Name  ,
"VFS"   
)

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

Generated by  doxygen 1.6.2