Drag[en]gine Game Engine  1.21
deVirtualFileSystem Class Reference

Virtual file system. More...

#include <deVirtualFileSystem.h>

Inheritance diagram for deVirtualFileSystem:
deObject

Public Types

typedef deTObjectReference< deVirtualFileSystemRef
 Type holding strong reference. More...
 
- Public Types inherited from deObject
typedef deTObjectReference< deObjectRef
 Type holding strong reference. More...
 

Public Member Functions

Management
bool ExistsFile (const decPath &path) const
 File exists. More...
 
bool CanReadFile (const decPath &path) const
 File can be read from. More...
 
bool CanWriteFile (const decPath &path) const
 File can be written to. More...
 
bool CanDeleteFile (const decPath &path) const
 File can be deleted. More...
 
decBaseFileReaderOpenFileForReading (const decPath &path) const
 Open file for reading. More...
 
decBaseFileWriterOpenFileForWriting (const decPath &path) const
 Open file for writing. More...
 
void DeleteFile (const decPath &path) const
 Delete specified file. More...
 
void TouchFile (const decPath &path) const
 Touch file setting the modification time to the current time. More...
 
void SearchFiles (const decPath &directory, deFileSearchVisitor &visitor) const
 Search files. More...
 
deVFSContainer::eFileTypes GetFileType (const decPath &path) const
 Type of file. More...
 
uint64_t GetFileSize (const decPath &path) const
 Size of file. More...
 
TIME_SYSTEM GetFileModificationTime (const decPath &path) const
 Modification time of file. 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...
 

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...
 

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.

Warning

VFS containers are thread-safe for all operations. This class is only thread-safe if containers are modified only before using the VFS but not while using it. If you need to change the containers while using the VFS use the deVFSModular container. This container is safe to be modified while in use.

Member Typedef Documentation

◆ Ref

Type holding strong reference.

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.

Warning
Breaks thread-safety if called after VFS is in use.

◆ CanDeleteFile()

bool deVirtualFileSystem::CanDeleteFile ( const decPath path) const

File can be deleted.

◆ CanReadFile()

bool deVirtualFileSystem::CanReadFile ( const decPath path) const

File can be read from.

◆ CanWriteFile()

bool deVirtualFileSystem::CanWriteFile ( const decPath path) const

File can be written to.

◆ DeleteFile()

void deVirtualFileSystem::DeleteFile ( const decPath path) const

Delete specified file.

Throws an exception if file can not be deleted.

◆ ExistsFile()

bool deVirtualFileSystem::ExistsFile ( const 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 ( const decPath path) const

Modification time of file.

Throws an exception if file type can not be retrieved.

◆ GetFileSize()

uint64_t deVirtualFileSystem::GetFileSize ( const decPath path) const

Size of file.

Throws an exception if file type can not be retrieved.

◆ GetFileType()

deVFSContainer::eFileTypes deVirtualFileSystem::GetFileType ( const 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 ( const decPath path) const

Open file for reading.

Throws an exception if file reader can not be created.

Warning
File reader has reference counted added. Use decBaseFileReaderReference::TakeOver().

◆ OpenFileForWriting()

decBaseFileWriter* deVirtualFileSystem::OpenFileForWriting ( const decPath path) const

Open file for writing.

Throws an exception if file writer can not be created.

Warning
File reader has reference counted added. Use decBaseFileWriterReference::TakeOver().

◆ RemoveAllContainers()

void deVirtualFileSystem::RemoveAllContainers ( )

Remove all containers.

Warning
Breaks thread-safety if called after VFS is in use.

◆ RemoveContainer()

void deVirtualFileSystem::RemoveContainer ( deVFSContainer container)

Remove container.

Warning
Breaks thread-safety if called after VFS is in use.

◆ SearchFiles()

void deVirtualFileSystem::SearchFiles ( const decPath directory,
deFileSearchVisitor visitor 
) const

Search files.

◆ TouchFile()

void deVirtualFileSystem::TouchFile ( const decPath path) const

Touch file setting the modification time to the current time.


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