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

Package Class Reference

#include <package.h>

Inheritance diagram for Package:

Inheritance graph
[legend]
Collaboration diagram for Package:

Collaboration graph
[legend]
List of all members.

Detailed Description

File management in packages A package can both contain real files and virtual files (read from package file).

Author:
Mattias Jansson (mattias@realityrift.com)


Public Types

enum  FILEFLAG { FILEFLAG_NORMAL = 0x00000000, FILEFLAG_BZIP2_COMPRESSED = 0x00000001 }
 File flags for package manager. More...


Public Member Functions

 Package (Directory *pkParent, const std::string &rstrFile, FileManager *pkManager)
virtual ~Package ()
FileGetBaseFile ()
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)
void SetFileManager (FileManager *pkManager)
bool Load (const std::string &rstrFilename, unsigned int uiFlags=0, bool bForceReload=false, bool bSearchFileSystem=false)
bool Load (File *pkFile, unsigned int uiFlags=0, bool bForceReload=false)

Protected Member Functions

virtual bool LoadNode (unsigned int uiFlags)
void ReadCluster (Directory *pkDirectory)

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
Filem_pkFile
bool m_bLoaded
bool m_bKeepFile
FileManagerm_pkFileManager


Member Enumeration Documentation

enum FILEFLAG
 

File flags for package manager.

Enumeration values:
FILEFLAG_NORMAL  Normal uncompressed data for file
FILEFLAG_BZIP2_COMPRESSED  File is bzip2 compressed


Constructor & Destructor Documentation

Package Directory pkParent,
const std::string &  rstrFile,
FileManager pkManager
 

Open and parse package file. You can also put in a directory in the normal file system and it will be recursivly parsed

Parameters:
pkParent Parent directory
rstrFile Package file name
pkManager File manager we are connected to

virtual ~Package  )  [virtual]
 

Deallocate hierarchy


Member Function Documentation

virtual bool LoadNode unsigned int  uiFlags  )  [protected, virtual]
 

Main loader method. Called by LoadableEntity to load object if file was opened successfully

Parameters:
uiFlags Loader flags (currently ignored for packages)
Returns:
true if load was successful, false otherwise

Implements LoadableEntity.

void ReadCluster Directory pkDirectory  )  [protected]
 

Read cluster data from file. Recursive.

Parameters:
pkDirectory Directory to read

File* GetBaseFile  )  [inline]
 

Get package file ptr

Returns:
File ptr

bool Parse bool  bRecurse = true  )  [inherited]
 

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, inherited]
 

Returns:
Name of this directory

const std::string& GetFullPath  )  [inherited]
 

Returns:
Full path for this directory

void AttachNode Directory pkDirectory  )  [inherited]
 

Attach a directory

Parameters:
pkDirectory Directory to attach

void DetachNode Directory pkDirectory  )  [inherited]
 

Detach a directory

Parameters:
pkDirectory Directory to detach

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

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  )  [inherited]
 

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 [inherited]
 

Get all files (must be deallocated when finished using)

Parameters:
pvpkFiles Vector receiving pointers to files

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

Get vector of all directories

Returns:
const vector with all directories

Directory* GetParentDirectory  )  [inherited]
 

Returns:
Parent directory (if any)

bool IsPackage  )  const [inline, inherited]
 

Query if we are a package or directory

Returns:
true if package, false if directory

bool IsParsed  )  const [inline, inherited]
 

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

void PrintHierarchy int  iDepth  )  [inherited]
 

Print hierarchy

Parameters:
iDepth Recurse depth

void SetFileManager FileManager pkManager  )  [inherited]
 

Set new file manager object

Parameters:
pkManager Ptr to file manager object

bool Load const std::string &  rstrFilename,
unsigned int  uiFlags = 0,
bool  bForceReload = false,
bool  bSearchFileSystem = false
[inherited]
 

Load resource

Parameters:
rstrFilename Filename
uiFlags Flags to pass to loader
bForceReload Force reload if already loaded (default false)
bSearchFileSystem Look in normal file system for file if not found in file manager (default false)
Returns:
true if successful (or already loaded and not force flag set), false otherwise (load/reload failed)

bool Load File pkFile,
unsigned int  uiFlags = 0,
bool  bForceReload = false
[inherited]
 

Load resource

Parameters:
pkFile File object
uiFlags Flags to pass to loader
bForceReload Force reload if already loaded
Returns:
true if successful (or already loaded and not force flag set), false otherwise (load/reload failed)


Member Data Documentation

HashTable< FileTemplate >* m_pkFiles [protected, inherited]
 

Files in this directory

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

Subdirectories

Directory* m_pkParent [protected, inherited]
 

Parent directory

std::string m_strName [protected, inherited]
 

Name of this directory

std::string m_strFullPath [protected, inherited]
 

Full path

bool m_bIsParsed [protected, inherited]
 

Parsed flag

bool m_bIsPackage [protected, inherited]
 

Package flag

File* m_pkFile [protected, inherited]
 

File

bool m_bLoaded [protected, inherited]
 

Flag indicating node is loaded

bool m_bKeepFile [protected, inherited]
 

Flag to block file deletion on load completion

FileManager* m_pkFileManager [protected, inherited]
 

File manager


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