Drag[en]gine Game Engine  1.0
deVirtualFileSystem Class Reference

Virtual file system. More...

#include <deVirtualFileSystem.h>

Inheritance diagram for deVirtualFileSystem:
deObject

Public Member Functions

Management
bool ExistsFile (decPath &path) const
 File exists. More...
 
bool CanReadFile (decPath &path) const
 File can be read from. More...
 
bool CanWriteFile (decPath &path) const
 File can be written to. More...
 
bool CanDeleteFile (decPath &path) const
 File can be deleted. More...
 
decBaseFileReaderOpenFileForReading (decPath &path) const
 Open file for reading. More...
 
decBaseFileWriterOpenFileForWriting (decPath &path) const
 Open file for writing. More...
 
void DeleteFile (decPath &path) const
 Delete specified file. More...
 
void TouchFile (decPath &path) const
 Touch file setting the modification time to the current time. More...
 
void SearchFilesMatching (dePathList &list, decPath &pattern) const
 Search files and directories. More...
 
deVFSContainer::eFileTypes GetFileType (decPath &path) const
 Type of file. More...
 
int GetFileSize (decPath &path) const
 Size of file. More...
 
TIME_SYSTEM GetFileModificationTime (decPath &path) const
 Modification time of file. More...
 
Containers
int GetContainerCount () const
 Number of containers. More...
 
deVFSContainerGetContainerAt (int index) const
 Container at position. More...
 
int IndexOfContainer (deVFSContainer *container) const
 Index of container or -1 if absent. More...
 
bool HasContainer (deVFSContainer *container) const
 Container is present. More...
 
void AddContainer (deVFSContainer *container)
 Add container. More...
 
void RemoveContainer (deVFSContainer *container)
 Remove container. More...
 
void RemoveAllContainers ()
 Remove all containers. More...
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count. More...
 
void AddReference ()
 Add reference increasing reference count by 1. More...
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...
 
 deObject ()
 Create object with reference count of 1. More...
 

Constructors and Destructors

 deVirtualFileSystem ()
 Create virtual file system. More...
 
virtual ~deVirtualFileSystem ()
 Clean up virtual file system. More...
 

Additional Inherited Members

- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object. More...
 

Detailed Description

Virtual file system.

Manages a virtual file system. The file system is by default empty and filled with content using container objects. Each container object populates a given directory with content. This process is not the same as file system mounting therefore the content of a container object does not replace the content in the directory but adds to it. Already existing files and directories are shadowed. Therefore the order of the container objects is important. Container objects shadow files and directories defined by container objects located before them.

Constructor & Destructor Documentation

◆ deVirtualFileSystem()

deVirtualFileSystem::deVirtualFileSystem ( )

Create virtual file system.

◆ ~deVirtualFileSystem()

virtual deVirtualFileSystem::~deVirtualFileSystem ( )
protectedvirtual

Clean up virtual file system.

Note
Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ AddContainer()

void deVirtualFileSystem::AddContainer ( deVFSContainer container)

Add container.

◆ CanDeleteFile()

bool deVirtualFileSystem::CanDeleteFile ( decPath path) const

File can be deleted.

◆ CanReadFile()

bool deVirtualFileSystem::CanReadFile ( decPath path) const

File can be read from.

◆ CanWriteFile()

bool deVirtualFileSystem::CanWriteFile ( decPath path) const

File can be written to.

◆ DeleteFile()

void deVirtualFileSystem::DeleteFile ( decPath path) const

Delete specified file.

Throws an exception if file can not be deleted.

◆ ExistsFile()

bool deVirtualFileSystem::ExistsFile ( decPath path) const

File exists.

◆ GetContainerAt()

deVFSContainer* deVirtualFileSystem::GetContainerAt ( int  index) const

Container at position.

◆ GetContainerCount()

int deVirtualFileSystem::GetContainerCount ( ) const

Number of containers.

◆ GetFileModificationTime()

TIME_SYSTEM deVirtualFileSystem::GetFileModificationTime ( decPath path) const

Modification time of file.

Throws an exception if file type can not be retrieved.

◆ GetFileSize()

int deVirtualFileSystem::GetFileSize ( decPath path) const

Size of file.

Throws an exception if file type can not be retrieved.

◆ GetFileType()

deVFSContainer::eFileTypes deVirtualFileSystem::GetFileType ( decPath path) const

Type of file.

Throws an exception if file type can not be retrieved.

◆ HasContainer()

bool deVirtualFileSystem::HasContainer ( deVFSContainer container) const

Container is present.

◆ IndexOfContainer()

int deVirtualFileSystem::IndexOfContainer ( deVFSContainer container) const

Index of container or -1 if absent.

◆ OpenFileForReading()

decBaseFileReader* deVirtualFileSystem::OpenFileForReading ( decPath path) const

Open file for reading.

Throws an exception if file reader can not be created.

◆ OpenFileForWriting()

decBaseFileWriter* deVirtualFileSystem::OpenFileForWriting ( decPath path) const

Open file for writing.

Throws an exception if file writer can not be created.

◆ RemoveAllContainers()

void deVirtualFileSystem::RemoveAllContainers ( )

Remove all containers.

◆ RemoveContainer()

void deVirtualFileSystem::RemoveContainer ( deVFSContainer container)

Remove container.

◆ SearchFilesMatching()

void deVirtualFileSystem::SearchFilesMatching ( dePathList list,
decPath pattern 
) const

Search files and directories.

All found files and directories are added to the file listing.

Todo:
Add a version with a search interface for better handling large scale scanning.

◆ TouchFile()

void deVirtualFileSystem::TouchFile ( decPath path) const

Touch file setting the modification time to the current time.


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