Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
VfsDirectory Class Reference

#include <vfs_tree.h>

Public Types

typedef std::map< VfsPath, VfsFileVfsFiles
 
typedef std::map< VfsPath, VfsDirectoryVfsSubdirectories
 

Public Member Functions

 VfsDirectory ()
 
void DeleteSubtree (const VfsFile &file)
 remove the given file or subdirectory according to the priority of the passed .DELETED file. More...
 
VfsFileAddFile (const VfsFile &file)
 
VfsDirectoryAddSubdirectory (const VfsPath &name)
 
void RemoveFile (const VfsPath &name)
 remove the given file from the virtual directory (no effect on the physical file). More...
 
VfsFileGetFile (const VfsPath &name)
 
VfsDirectoryGetSubdirectory (const VfsPath &name)
 
const VfsFilesFiles () const
 
const VfsSubdirectoriesSubdirectories () const
 
void SetAssociatedDirectory (const PRealDirectory &realDirectory)
 side effect: the next ShouldPopulate() will return true. More...
 
const PRealDirectoryAssociatedDirectory () const
 
bool ShouldPopulate ()
 
void RequestRepopulate ()
 ensure the next ShouldPopulate returns true. More...
 
void Clear ()
 empty file and subdirectory lists (e.g. More...
 

Private Member Functions

bool DeleteTree (const VfsFile &file)
 remove all files with a lower priority than file and do the same for all subdirectories recursively. More...
 

Private Attributes

VfsFiles m_files
 
VfsSubdirectories m_subdirectories
 
PRealDirectory m_realDirectory
 
bool m_shouldPopulate
 

Member Typedef Documentation

◆ VfsFiles

◆ VfsSubdirectories

Constructor & Destructor Documentation

◆ VfsDirectory()

VfsDirectory::VfsDirectory ( )

Member Function Documentation

◆ AddFile()

VfsFile * VfsDirectory::AddFile ( const VfsFile file)
Returns
address of existing or newly inserted file.

◆ AddSubdirectory()

VfsDirectory * VfsDirectory::AddSubdirectory ( const VfsPath name)
Returns
address of existing or newly inserted subdirectory.

◆ AssociatedDirectory()

const PRealDirectory & VfsDirectory::AssociatedDirectory ( ) const
inline

◆ Clear()

void VfsDirectory::Clear ( )

empty file and subdirectory lists (e.g.

when rebuilding VFS). CAUTION: this invalidates all previously returned pointers.

◆ DeleteSubtree()

void VfsDirectory::DeleteSubtree ( const VfsFile file)

remove the given file or subdirectory according to the priority of the passed .DELETED file.

CAUTION: Invalidates all previously returned pointers of the file or subdirectory (and contents) if those have lower priority than file.

◆ DeleteTree()

bool VfsDirectory::DeleteTree ( const VfsFile file)
private

remove all files with a lower priority than file and do the same for all subdirectories recursively.

Returns
true if the directory is empty afterwards

◆ Files()

const VfsFiles & VfsDirectory::Files ( ) const
inline

◆ GetFile()

VfsFile * VfsDirectory::GetFile ( const VfsPath name)
Returns
file with the given name. (note: non-const to allow changes to the file)

◆ GetSubdirectory()

VfsDirectory * VfsDirectory::GetSubdirectory ( const VfsPath name)
Returns
subdirectory with the given name. (note: non-const to allow changes to the subdirectory)

◆ RemoveFile()

void VfsDirectory::RemoveFile ( const VfsPath name)

remove the given file from the virtual directory (no effect on the physical file).

no effect if the file does not exist.

◆ RequestRepopulate()

void VfsDirectory::RequestRepopulate ( )

ensure the next ShouldPopulate returns true.

◆ SetAssociatedDirectory()

void VfsDirectory::SetAssociatedDirectory ( const PRealDirectory realDirectory)

side effect: the next ShouldPopulate() will return true.

◆ ShouldPopulate()

bool VfsDirectory::ShouldPopulate ( )
Returns
whether this directory should be populated from its AssociatedDirectory(). note that calling this is a promise to do so if true is returned – the flag is reset immediately.

◆ Subdirectories()

const VfsSubdirectories & VfsDirectory::Subdirectories ( ) const
inline

Member Data Documentation

◆ m_files

VfsFiles VfsDirectory::m_files
private

◆ m_realDirectory

PRealDirectory VfsDirectory::m_realDirectory
private

◆ m_shouldPopulate

bool VfsDirectory::m_shouldPopulate
private

◆ m_subdirectories

VfsSubdirectories VfsDirectory::m_subdirectories
private

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