Drag[en]gine Game Engine  1.0
deVFSContainer Class Referenceabstract

Virtual file system container. More...

#include <deVFSContainer.h>

Inheritance diagram for deVFSContainer:
deObject deVFSDiskDirectory deVFSMemoryFiles deVFSNull deVFSCacheDiskDirectory

Public Types

enum  eFileTypes { eftRegularFile, eftDirectory, eftSpecial, eftTypeCount }
 File types. More...
 

Public Member Functions

Management
decPathGetRootPath ()
 Root path. More...
 
bool GetHidden () const
 Container is hidden. More...
 
void SetHidden (bool hidden)
 Set if container is hidden. More...
 
virtual bool ExistsFile (decPath &path)=0
 File exists. More...
 
virtual bool CanReadFile (decPath &path)=0
 File can be read. More...
 
virtual bool CanWriteFile (decPath &path)=0
 File can be written. More...
 
virtual bool CanDeleteFile (decPath &path)=0
 File can be deleted. More...
 
virtual decBaseFileReaderOpenFileForReading (decPath &path)=0
 Open file for reading. More...
 
virtual decBaseFileWriterOpenFileForWriting (decPath &path)=0
 Open file for writing. More...
 
virtual void DeleteFile (decPath &path)=0
 Delete file. More...
 
virtual void TouchFile (decPath &path)=0
 Touch file setting the modification time to the current time. More...
 
virtual void SearchFilesMatching (dePathList &list, decPath &pattern)=0
 Search all visible files and directories. More...
 
virtual eFileTypes GetFileType (decPath &path)=0
 Type of file. More...
 
virtual long GetFileSize (decPath &path)=0
 Size of file. More...
 
virtual TIME_SYSTEM GetFileModificationTime (decPath &path)=0
 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

 deVFSContainer ()
 Create virtual file system container with the root path '/'. More...
 
 deVFSContainer (decPath &rootPath)
 Create virtual file system container with the given root path. More...
 
virtual ~deVFSContainer ()
 Clean up virtual file system container. More...
 

Additional Inherited Members

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

Detailed Description

Virtual file system container.

A virtual file system container provides a collection of real or virtuel files. Containers can be queried for a listing of files, the existance of files and to open files for reading and writing. Each container has a path assigned where the root of the container is. All files and directories inside the container are inserted into the virtual file system under this path. The content does not replace the content of the given path as a mount command would do but adds the its own content to the content already existing. Duplicate files are shadowed in this process. The order of containers therefore matters.

Containers can be hidden. Hidden containers do not show up in file listings unless the listing is done from a path inside the container path. This allows to add special containers that should not be easily visible to game scripts unless the path is known.

Member Enumeration Documentation

◆ eFileTypes

File types.

Enumerator
eftRegularFile 

Regular file.

eftDirectory 

Directory.

eftSpecial 

A special file which is neither a regular file nor a directory.

eftTypeCount 

Dummy entry ( count of types )

Constructor & Destructor Documentation

◆ deVFSContainer() [1/2]

deVFSContainer::deVFSContainer ( )

Create virtual file system container with the root path '/'.

◆ deVFSContainer() [2/2]

deVFSContainer::deVFSContainer ( decPath rootPath)

Create virtual file system container with the given root path.

◆ ~deVFSContainer()

virtual deVFSContainer::~deVFSContainer ( )
protectedvirtual

Clean up virtual file system container.

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

◆ CanDeleteFile()

virtual bool deVFSContainer::CanDeleteFile ( decPath path)
pure virtual

File can be deleted.

The path is relative to the root path.

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, and deVFSNull.

Referenced by GetHidden().

◆ CanReadFile()

virtual bool deVFSContainer::CanReadFile ( decPath path)
pure virtual

File can be read.

Path is relative to the root path. The result of this call is usually the same as of ExistsFile unless permissions prevent reading of an existing file.

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, and deVFSNull.

Referenced by GetHidden().

◆ CanWriteFile()

virtual bool deVFSContainer::CanWriteFile ( decPath path)
pure virtual

File can be written.

The path is relative to the root path. If a file has parent directories not existing yet they have to be created in a subsequent call to OpenFileForWriting. If this is the case return true only if the creation of the parent directories is also allowed in addition to creating a new file. If the file exists permission flags can prevent writing.

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, and deVFSNull.

Referenced by GetHidden().

◆ DeleteFile()

virtual void deVFSContainer::DeleteFile ( decPath path)
pure virtual

Delete file.

Path is relative to the root path.

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, deVFSCacheDiskDirectory, and deVFSNull.

Referenced by GetHidden().

◆ ExistsFile()

virtual bool deVFSContainer::ExistsFile ( decPath path)
pure virtual

File exists.

Path is elative to the root path.

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, and deVFSNull.

Referenced by GetHidden().

◆ GetFileModificationTime()

virtual TIME_SYSTEM deVFSContainer::GetFileModificationTime ( decPath path)
pure virtual

Modification time of file.

If the file does not exist an exception is thrown.

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, and deVFSNull.

Referenced by GetHidden().

◆ GetFileSize()

virtual long deVFSContainer::GetFileSize ( decPath path)
pure virtual

Size of file.

If the file does not exist an exception is thrown.

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, and deVFSNull.

Referenced by GetHidden().

◆ GetFileType()

virtual eFileTypes deVFSContainer::GetFileType ( decPath path)
pure virtual

Type of file.

If the file does not exist an exception is thrown.

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, and deVFSNull.

Referenced by GetHidden().

◆ GetHidden()

◆ GetRootPath()

decPath& deVFSContainer::GetRootPath ( )
inline

Root path.

◆ OpenFileForReading()

virtual decBaseFileReader* deVFSContainer::OpenFileForReading ( decPath path)
pure virtual

Open file for reading.

The path is relative to the root path. If the file can not be found an exception is raised. Use the CanReadFile function to test if a file can be opened for reading.

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, and deVFSNull.

Referenced by GetHidden().

◆ OpenFileForWriting()

virtual decBaseFileWriter* deVFSContainer::OpenFileForWriting ( decPath path)
pure virtual

Open file for writing.

The path is relative to the root path. If the file can not be found an exception is raised. Use the CanWriteFile function to test if a file can be opened for writing. Not existing directories have to be created if the CanWriteFile function returns true for a file whose parent directory does not exist yet.

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, deVFSCacheDiskDirectory, and deVFSNull.

Referenced by GetHidden().

◆ SearchFilesMatching()

virtual void deVFSContainer::SearchFilesMatching ( dePathList list,
decPath pattern 
)
pure virtual

Search all visible files and directories.

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

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, and deVFSNull.

Referenced by GetHidden().

◆ SetHidden()

void deVFSContainer::SetHidden ( bool  hidden)

Set if container is hidden.

Referenced by GetHidden().

◆ TouchFile()

virtual void deVFSContainer::TouchFile ( decPath path)
pure virtual

Touch file setting the modification time to the current time.

Implemented in deVFSDiskDirectory, deVFSMemoryFiles, and deVFSNull.

Referenced by GetHidden().


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