Alientech 0.01
An extendable game engine
alien::ACHDirectory Class Reference

Describes a directory in a CargoHold object. More...

#include <CACHDirectory.h>

List of all members.

Public Member Functions

 ACHDirectory (ACHDirectory *Parent=NULL, string Name="root")
 Constructor. Also acts as a default constructor.
string getName ()
 Retrieves the name of the directory.
ACHDirectorygetParent ()
 Retrieves the parent of the directory.
vector< string > getListOfFiles ()
 Provides a copy of the internal list of files.
vector< string > getListOfSubdirs ()
 Provides a copy of the internal list of subdirectories.
void print (string pre="")
 Prints out the directory/file structure inside this directory.
void setName (string NewName)
 Sets the name of the directory.
void setParent (ACHDirectory *NewParent)
 Sets the parent directory of the directory.
void addSubdir (ACHDirectory *subdirectory)
 Adds another subdirectory to the internal list.
void addFile (ACHFile *file)
 Adds another file to the internal list.
bool containsSubdir (string DirectoryName)
 Checks whether there is a directory of the given name within this one.
bool containsFile (string FileName)
 Checks whether there is a file of the given name within this one.
void destroy ()
 Deallocates the memory for the subdirectories and files All of the subdirectories and files are dynamically allocated, so they have to be manually removed. The function recursively destroys all files and subdirectories below it as well.

Static Public Member Functions

static ACHDirectoryreadDirectory (ifstream *file)
 Reads a directory from the provided CargoHold file.

Detailed Description

Describes a directory in a CargoHold object.

This class encapsulates the details of a directory in a CargoHold object. It includes lists of files and subdirectories. The end user/developer does not need to deal with it directly since it is just for internal use.

Definition at line 16 of file CACHDirectory.h.


Constructor & Destructor Documentation

ACHDirectory::ACHDirectory ( ACHDirectory Parent = NULL,
string  Name = "root" 
)

Constructor. Also acts as a default constructor.

Parameters:
Parentpointer to parent directory
Namename of the directory

Definition at line 6 of file CACHDirectory.cpp.


Member Function Documentation

void ACHDirectory::addFile ( ACHFile file)

Adds another file to the internal list.

Parameters:
filea pointer to the new file object

Definition at line 65 of file CACHDirectory.cpp.

void ACHDirectory::addSubdir ( ACHDirectory subdirectory)

Adds another subdirectory to the internal list.

Parameters:
subdirectorya pointer to the new subdirectory object

Definition at line 59 of file CACHDirectory.cpp.

bool ACHDirectory::containsFile ( string  FileName)

Checks whether there is a file of the given name within this one.

Parameters:
FileNamethe name of the file
Returns:
true if such a file exists, false otherwise

Definition at line 79 of file CACHDirectory.cpp.

bool ACHDirectory::containsSubdir ( string  DirectoryName)

Checks whether there is a directory of the given name within this one.

Parameters:
DirectoryNamethe name of the directory
Returns:
true if such a directory exists, false otherwise

Definition at line 71 of file CACHDirectory.cpp.

void ACHDirectory::destroy ( )

Deallocates the memory for the subdirectories and files All of the subdirectories and files are dynamically allocated, so they have to be manually removed. The function recursively destroys all files and subdirectories below it as well.

Definition at line 133 of file CACHDirectory.cpp.

vector< string > ACHDirectory::getListOfFiles ( )

Provides a copy of the internal list of files.

Definition at line 19 of file CACHDirectory.cpp.

vector< string > ACHDirectory::getListOfSubdirs ( )

Provides a copy of the internal list of subdirectories.

Definition at line 27 of file CACHDirectory.cpp.

string ACHDirectory::getName ( )

Retrieves the name of the directory.

Definition at line 9 of file CACHDirectory.cpp.

ACHDirectory * ACHDirectory::getParent ( )

Retrieves the parent of the directory.

Definition at line 14 of file CACHDirectory.cpp.

void ACHDirectory::print ( string  pre = "")

Prints out the directory/file structure inside this directory.

Parameters:
preA prefix that goes in front of every line. The function uses this to add tab characters in front of child directories

Definition at line 35 of file CACHDirectory.cpp.

ACHDirectory * ACHDirectory::readDirectory ( ifstream *  file) [static]

Reads a directory from the provided CargoHold file.

Parameters:
filea pointer to the file object

Definition at line 87 of file CACHDirectory.cpp.

void ACHDirectory::setName ( string  NewName)

Sets the name of the directory.

Parameters:
NewNamethe new name of the directory

Definition at line 49 of file CACHDirectory.cpp.

void ACHDirectory::setParent ( ACHDirectory NewParent)

Sets the parent directory of the directory.

Parameters:
NewParentthe new parent of the directory

Definition at line 54 of file CACHDirectory.cpp.


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