Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

Directory Class Reference

#include <directory.h>

Inheritance diagram for Directory:

Inheritance graph
[legend]
Collaboration diagram for Directory:

Collaboration graph
[legend]
List of all members.

Detailed Description

Directory abstraction A directory can contain files and other directories, and is the base class for packages. Each directory contains templates for all files, and the actual File objects gets allocated on request, the GetByName or GetAllFiles methods.

Author:
Mattias Jansson (mattias@realityrift.com)


Public Member Functions

 Directory (const std::string &rstrName, Directory *pkParent, bool bParse=false, bool bRecurse=true)
virtual ~Directory ()
bool Parse (bool bRecurse=true)
const std::string & GetName () const
const std::string & GetFullPath ()
void AttachNode (Directory *pkDirectory)
void DetachNode (Directory *pkDirectory)
FileGetByName (const std::string &rstrName, bool bRecurse=true)
DirectoryGetDirectoryByName (const std::string &rstrName)
void GetFiles (std::vector< File * > *pvpkFiles) const
const std::vector< Directory * > & GetDirectories () const
DirectoryGetParentDirectory ()
bool IsPackage () const
bool IsParsed () const
void PrintHierarchy (int iDepth)

Protected Attributes

HashTable< FileTemplate > * m_pkFiles
std::vector< Directory * > m_vpkDirectories
Directorym_pkParent
std::string m_strName
std::string m_strFullPath
bool m_bIsParsed
bool m_bIsPackage


Constructor & Destructor Documentation

Directory const std::string &  rstrName,
Directory pkParent,
bool  bParse = false,
bool  bRecurse = true
 

Create directory and attach to parent, if any

Parameters:
rstrName Directory name
pkParent Parent directory
bParse Parse rstrName as a directory in the native file system
bRecurse Recursive parsing flag

virtual ~Directory  )  [virtual]
 

Deallocate objects and detach from parent


Member Function Documentation

bool Parse bool  bRecurse = true  ) 
 

Parse directory in native file system

Parameters:
bRecurse Recursive parsing flag
Returns:
true if parsing successful, false if error (not found)

const std::string& GetName  )  const [inline]
 

Returns:
Name of this directory

const std::string& GetFullPath  ) 
 

Returns:
Full path for this directory

void AttachNode Directory pkDirectory  ) 
 

Attach a directory

Parameters:
pkDirectory Directory to attach

void DetachNode Directory pkDirectory  ) 
 

Detach a directory

Parameters:
pkDirectory Directory to detach

File* GetByName const std::string &  rstrName,
bool  bRecurse = true
 

Search hierarchy for file

Parameters:
rstrName Name of file
bRecurse Recursively look for file in subdirectories if true (default)
Returns:
Ptr to file if found, null if not (must be deleted after use)

Directory* GetDirectoryByName const std::string &  rstrName  ) 
 

Search hierarchy for directory

Parameters:
rstrName Name of directory
Returns:
Ptr to node if found, null if not (should NOT be deleted after use)

void GetFiles std::vector< File * > *  pvpkFiles  )  const
 

Get all files (must be deallocated when finished using)

Parameters:
pvpkFiles Vector receiving pointers to files

const std::vector< Directory* >& GetDirectories  )  const [inline]
 

Get vector of all directories

Returns:
const vector with all directories

Directory* GetParentDirectory  ) 
 

Returns:
Parent directory (if any)

bool IsPackage  )  const [inline]
 

Query if we are a package or directory

Returns:
true if package, false if directory

bool IsParsed  )  const [inline]
 

Returns:
true if directory has been parsed, false if not

void PrintHierarchy int  iDepth  ) 
 

Print hierarchy

Parameters:
iDepth Recurse depth


Member Data Documentation

HashTable< FileTemplate >* m_pkFiles [protected]
 

Files in this directory

std::vector< Directory* > m_vpkDirectories [protected]
 

Subdirectories

Directory* m_pkParent [protected]
 

Parent directory

std::string m_strName [protected]
 

Name of this directory

std::string m_strFullPath [protected]
 

Full path

bool m_bIsParsed [protected]
 

Parsed flag

bool m_bIsPackage [protected]
 

Package flag


The documentation for this class was generated from the following file:
Generated on Wed Jan 21 14:21:11 2004 for NeoEngine by doxygen 1.3.5