Pyrogenesis  trunk
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
VfsDirectory Class Reference

#include <vfs_tree.h>

Collaboration diagram for VfsDirectory:
Collaboration graph
[legend]

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
 
volatile intptr_t m_shouldPopulate
 

Member Typedef Documentation

Constructor & Destructor Documentation

VfsDirectory::VfsDirectory ( )

Member Function Documentation

VfsFile * VfsDirectory::AddFile ( const VfsFile file)
Returns
address of existing or newly inserted file.
VfsDirectory * VfsDirectory::AddSubdirectory ( const VfsPath name)
Returns
address of existing or newly inserted subdirectory.
const PRealDirectory& VfsDirectory::AssociatedDirectory ( ) const
inline
void VfsDirectory::Clear ( )

empty file and subdirectory lists (e.g.

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

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.

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
const VfsFiles& VfsDirectory::Files ( ) const
inline
VfsFile * VfsDirectory::GetFile ( const VfsPath name)
Returns
file with the given name. (note: non-const to allow changes to the file)
VfsDirectory * VfsDirectory::GetSubdirectory ( const VfsPath name)
Returns
subdirectory with the given name. (note: non-const to allow changes to the subdirectory)
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.

void VfsDirectory::RequestRepopulate ( )

ensure the next ShouldPopulate returns true.

void VfsDirectory::SetAssociatedDirectory ( const PRealDirectory realDirectory)

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

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.
const VfsSubdirectories& VfsDirectory::Subdirectories ( ) const
inline

Member Data Documentation

VfsFiles VfsDirectory::m_files
private
PRealDirectory VfsDirectory::m_realDirectory
private
volatile intptr_t VfsDirectory::m_shouldPopulate
private
VfsSubdirectories VfsDirectory::m_subdirectories
private

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