CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

iVFS Struct Reference
[Virtual File System (VFS)]

The Virtual Filesystem Class is intended to be the only way for Crystal Space engine to access the files. More...

#include <vfs.h>

Inheritance diagram for iVFS:

iBase List of all members.

Public Methods

virtual bool ChDir (const char *Path)=0
 Set current working directory. More...

virtual const char * GetCwd () const=0
 Get current working directory. More...

virtual void PushDir ()=0
 Push current directory. More...

virtual bool PopDir ()=0
 Pop current directory. More...

virtual csPtr< iDataBufferExpandPath (const char *Path, bool IsDir=false) const=0
 Expand given virtual path, interpret all "." and ".."'s relative to 'currend virtual directory'. More...

virtual bool Exists (const char *Path) const=0
 Check whenever a file exists. More...

virtual csPtr< iStringArrayFindFiles (const char *Path) const=0
 Find all files in a virtual directory and return an array with their names. More...

virtual csPtr< iFileOpen (const char *FileName, int Mode)=0
 Replacement for standard fopen(). More...

virtual csPtr< iDataBufferReadFile (const char *FileName, bool nullterm=true)=0
 Get an entire file at once. More...

virtual bool WriteFile (const char *Name, const char *Data, size_t Size)=0
 Write an entire file in one pass. More...

virtual bool DeleteFile (const char *FileName)=0
 Delete a file on VFS. More...

virtual bool Sync ()=0
 Close all opened archives, free temporary storage etc. More...

virtual bool Mount (const char *VirtualPath, const char *RealPath)=0
 Mount an VFS path on a "real-world-filesystem" path. More...

virtual bool Unmount (const char *VirtualPath, const char *RealPath)=0
 Unmount an VFS path; if RealPath is 0, entire VirtualPath is unmounted. More...

virtual csRef< iStringArrayMountRoot (const char *VirtualPath)=0
 Mount the root directory or directories beneath the given virtual path. More...

virtual bool SaveMounts (const char *FileName)=0
 Save current configuration back into configuration file. More...

virtual bool GetFileTime (const char *FileName, csFileTime &oTime) const=0
 Query file date/time. More...

virtual bool SetFileTime (const char *FileName, const csFileTime &iTime)=0
 Set file date/time. More...

virtual bool GetFileSize (const char *FileName, size_t &oSize)=0
 Query file size (without opening it). More...

virtual csPtr< iDataBufferGetRealPath (const char *FileName)=0
 Query real-world path from given VFS path. More...


Detailed Description

The Virtual Filesystem Class is intended to be the only way for Crystal Space engine to access the files.

This gives unified control over the way how files are found, read and written. VFS gives the following goodies over the standard file i/o functions:

This class has only most basic features of a real filesystem: file reading and writing (no simultaneous read and write mode are allowed because it would be rather complex to implement it for archives). However, most programs don't even need such functionality, and for sure Crystal Space itself doesn't need it. Files open for writing are always truncated. A simple meaning for getting a list of files in a virtual directory is implemented; however the user is presented with only a list of file names; no fancy things like file size, time etc (file size can be determined after opening it for reading).

Definition at line 173 of file vfs.h.


Member Function Documentation

virtual bool iVFS::ChDir const char *    Path [pure virtual]
 

Set current working directory.

virtual bool iVFS::DeleteFile const char *    FileName [pure virtual]
 

Delete a file on VFS.

virtual bool iVFS::Exists const char *    Path const [pure virtual]
 

Check whenever a file exists.

virtual csPtr<iDataBuffer> iVFS::ExpandPath const char *    Path,
bool    IsDir = false
const [pure virtual]
 

Expand given virtual path, interpret all "." and ".."'s relative to 'currend virtual directory'.

Return a new iString object. If IsDir is true, expanded path ends in an '/', otherwise no.

virtual csPtr<iStringArray> iVFS::FindFiles const char *    Path const [pure virtual]
 

Find all files in a virtual directory and return an array with their names.

virtual const char* iVFS::GetCwd   const [pure virtual]
 

Get current working directory.

virtual bool iVFS::GetFileSize const char *    FileName,
size_t &    oSize
[pure virtual]
 

Query file size (without opening it).

virtual bool iVFS::GetFileTime const char *    FileName,
csFileTime   oTime
const [pure virtual]
 

Query file date/time.

virtual csPtr<iDataBuffer> iVFS::GetRealPath const char *    FileName [pure virtual]
 

Query real-world path from given VFS path.

This will work only for files that are stored on real filesystem, not in archive files. You should expect this function to return 0 in this case.

virtual bool iVFS::Mount const char *    VirtualPath,
const char *    RealPath
[pure virtual]
 

Mount an VFS path on a "real-world-filesystem" path.

virtual csRef<iStringArray> iVFS::MountRoot const char *    VirtualPath [pure virtual]
 

Mount the root directory or directories beneath the given virtual path.

Returns a list of absolute virtual pathnames mounted by this operation.

virtual csPtr<iFile> iVFS::Open const char *    FileName,
int    Mode
[pure virtual]
 

Replacement for standard fopen().

Mode: combination of VFS_FILE_XXX.

See also:
VFS_FILE_MODE

virtual bool iVFS::PopDir   [pure virtual]
 

Pop current directory.

virtual void iVFS::PushDir   [pure virtual]
 

Push current directory.

virtual csPtr<iDataBuffer> iVFS::ReadFile const char *    FileName,
bool    nullterm = true
[pure virtual]
 

Get an entire file at once.

This is more effective than opening files and reading the file in blocks. Note that the returned buffer can be null-terminated (so that it can be conveniently used with string functions) but the extra null-terminator is not counted as part of the returned size.

Parameters:
FileName  VFS path of the file to be read.
nullterm  Null-terminate the returned buffer.
Returns:
Interface to the contained data.
Remarks:
Null-termination might have a performance penalty (dependent on where the file is stored.) Use only when needed.

virtual bool iVFS::SaveMounts const char *    FileName [pure virtual]
 

Save current configuration back into configuration file.

virtual bool iVFS::SetFileTime const char *    FileName,
const csFileTime   iTime
[pure virtual]
 

Set file date/time.

virtual bool iVFS::Sync   [pure virtual]
 

Close all opened archives, free temporary storage etc.

virtual bool iVFS::Unmount const char *    VirtualPath,
const char *    RealPath
[pure virtual]
 

Unmount an VFS path; if RealPath is 0, entire VirtualPath is unmounted.

virtual bool iVFS::WriteFile const char *    Name,
const char *    Data,
size_t    Size
[pure virtual]
 

Write an entire file in one pass.


The documentation for this struct was generated from the following file:
Generated for Crystal Space by doxygen 1.2.14