Drag[en]gine Game Engine
1.21
|
Virtual file system. More...
#include <deVirtualFileSystem.h>
Public Types | |
typedef deTObjectReference< deVirtualFileSystem > | Ref |
Type holding strong reference. More... | |
Public Types inherited from deObject | |
typedef deTObjectReference< deObject > | Ref |
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... | |
decBaseFileReader * | OpenFileForReading (const decPath &path) const |
Open file for reading. More... | |
decBaseFileWriter * | OpenFileForWriting (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... | |
deVFSContainer * | GetContainerAt (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... | |
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.
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.
Type holding strong reference.
deVirtualFileSystem::deVirtualFileSystem | ( | ) |
Create virtual file system.
|
protectedvirtual |
Clean up virtual file system.
void deVirtualFileSystem::AddContainer | ( | deVFSContainer * | container | ) |
Add container.
bool deVirtualFileSystem::CanDeleteFile | ( | const decPath & | path | ) | const |
File can be deleted.
bool deVirtualFileSystem::CanReadFile | ( | const decPath & | path | ) | const |
File can be read from.
bool deVirtualFileSystem::CanWriteFile | ( | const decPath & | path | ) | const |
File can be written to.
void deVirtualFileSystem::DeleteFile | ( | const decPath & | path | ) | const |
Delete specified file.
Throws an exception if file can not be deleted.
bool deVirtualFileSystem::ExistsFile | ( | const decPath & | path | ) | const |
File exists.
deVFSContainer* deVirtualFileSystem::GetContainerAt | ( | int | index | ) | const |
Container at position.
int deVirtualFileSystem::GetContainerCount | ( | ) | const |
Number of containers.
TIME_SYSTEM deVirtualFileSystem::GetFileModificationTime | ( | const decPath & | path | ) | const |
Modification time of file.
Throws an exception if file type can not be retrieved.
uint64_t deVirtualFileSystem::GetFileSize | ( | const decPath & | path | ) | const |
Size of file.
Throws an exception if file type can not be retrieved.
deVFSContainer::eFileTypes deVirtualFileSystem::GetFileType | ( | const decPath & | path | ) | const |
Type of file.
Throws an exception if file type can not be retrieved.
bool deVirtualFileSystem::HasContainer | ( | deVFSContainer * | container | ) | const |
Container is present.
int deVirtualFileSystem::IndexOfContainer | ( | deVFSContainer * | container | ) | const |
Index of container or -1 if absent.
decBaseFileReader* deVirtualFileSystem::OpenFileForReading | ( | const decPath & | path | ) | const |
Open file for reading.
Throws an exception if file reader can not be created.
decBaseFileWriter* deVirtualFileSystem::OpenFileForWriting | ( | const decPath & | path | ) | const |
Open file for writing.
Throws an exception if file writer can not be created.
void deVirtualFileSystem::RemoveAllContainers | ( | ) |
Remove all containers.
void deVirtualFileSystem::RemoveContainer | ( | deVFSContainer * | container | ) |
Remove container.
void deVirtualFileSystem::SearchFiles | ( | const decPath & | directory, |
deFileSearchVisitor & | visitor | ||
) | const |
Search files.
void deVirtualFileSystem::TouchFile | ( | const decPath & | path | ) | const |
Touch file setting the modification time to the current time.