NSFileSystem::TFSFileSystem Class Reference

This class defines filesystem. More...

#include <FileSystem.h>

Inheritance diagram for NSFileSystem::TFSFileSystem:

Inheritance graph
[legend]
Collaboration diagram for NSFileSystem::TFSFileSystem:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TFSFileSystem (void)
 Constructor.
 ~TFSFileSystem (void)
 Destructor.
 TFSFileSystem (const TFSFileSystem &orig)
 fake copy constructor
void operator= (const TFSFileSystem &orig)
 fake assignment operator
BOOL RegisterPath (const TString &path)
 Register next path into system.
BOOL RegisterCabinet (const TString &filename)
 Register next cabinet into system.
DWORD RegisterMultiplePaths (const TString &paths)
 This method register more paths into VFS.
DWORD RegisterMultipleCabinets (const TString &cabinets)
 This method register more cabinets into VFS.
TVirtualFileGetFile (const TString &filename) const
 This method try to find given file in filesystem.
DWORD GetRegisteredPathCount (void) const
 Return number of registered paths in manager.
DWORD GetRegisteredCabinetCount (void) const
 Return number of registered cabinets in manager.
const TStringGetRegisteredPath (const DWORD &index) const
 Return name of specified register path on given index.
const TStringGetRegisteredCabinet (const DWORD &index) const
 Return name of specified register cabinet on given index.
BOOL Exists (const TString &filename) const
 Determines whether specified file exists in filesystem.
TBufferGetFileData (const TString &filename) const
 This method read all data from specified file and returns it in dynamically allocated buffer.

Detailed Description

This class defines filesystem.

You can use filesystem to get data from real files or from files stored inside cabinet.

After constructing filesystem has registered only path "." - actual directory.

You may register next directories or cabinet files to filesystem.

While finding file, filesystem at first search real files and when no file was found it tries find file in registred cabinets.

When you get pointer to file it is independent on VFS from which has been loaded. Thus you can destroy file system after getting file without problem.

Definition at line 49 of file FileSystem.h.


Constructor & Destructor Documentation

TFSFileSystem::TFSFileSystem void   ) 
 

Constructor.

Creates filesystem which has registered actual directory "./".

Definition at line 24 of file FileSystem.cpp.

References TArrayPtrs< T, size, step >::AddItem().

Here is the call graph for this function:

TFSFileSystem::~TFSFileSystem void   ) 
 

Destructor.

Definition at line 32 of file FileSystem.cpp.

NSFileSystem::TFSFileSystem::TFSFileSystem const TFSFileSystem orig  ) 
 

fake copy constructor


Member Function Documentation

BOOL TFSFileSystem::Exists const TString filename  )  const
 

Determines whether specified file exists in filesystem.

Parameters:
filename [in] name of searched file
string for creating final path to real file on disk

Definition at line 212 of file FileSystem.cpp.

References TString::c_str(), TArrayPtrs< T, size, step >::Size(), and TRUE.

Here is the call graph for this function:

TVirtualFile * TFSFileSystem::GetFile const TString filename  )  const
 

This method try to find given file in filesystem.

At first registered paths are traverse in order of registered paths (first path is always "./"). If file wasn't found cabinet are searched through.

Method returns NULL if file couldn't be found.

Parameters:
filename [in] name of searched file
string for creating final path to real file on disk

Definition at line 163 of file FileSystem.cpp.

References NSFileSystem::TVirtualFileReal::OpenFile(), and TArrayPtrs< T, size, step >::Size().

Referenced by GetFileData(), NSConfigFile::TConfigFile::LoadConfigFileFromVFS(), NSMeshes::TDeclarationLoader::LoadDeclarationFromFile(), NSMeshes::TMeshLoader::LoadMeshDataFromFile(), and NSMeshes::TMeshLoader::LoadMeshFromFile().

Here is the call graph for this function:

TBuffer * TFSFileSystem::GetFileData const TString filename  )  const
 

This method read all data from specified file and returns it in dynamically allocated buffer.

If specified file doesnt exists then NULL is returned.

This method allocates memory which must be deallocated by caller!!!

Parameters:
filename [in] name of file from which data will be loaded

Definition at line 256 of file FileSystem.cpp.

References NSFileSystem::TVirtualFile::Close(), DBGTEXTF, TBuffer::GetData(), GetFile(), NSFileSystem::TVirtualFile::GetSize(), and NSFileSystem::TVirtualFile::Read().

Here is the call graph for this function:

const TString & NSFileSystem::TFSFileSystem::GetRegisteredCabinet const DWORD index  )  const [inline]
 

Return name of specified register cabinet on given index.

Parameters:
index [in] zero-based index (must be in range)

Definition at line 111 of file FileSystem.h.

DWORD NSFileSystem::TFSFileSystem::GetRegisteredCabinetCount void   )  const [inline]
 

Return number of registered cabinets in manager.

Definition at line 93 of file FileSystem.h.

References TArrayPtrs< T, size, step >::Count().

Here is the call graph for this function:

const TString & NSFileSystem::TFSFileSystem::GetRegisteredPath const DWORD index  )  const [inline]
 

Return name of specified register path on given index.

Parameters:
index [in] zero-based index (must be in range)

Definition at line 102 of file FileSystem.h.

DWORD NSFileSystem::TFSFileSystem::GetRegisteredPathCount void   )  const [inline]
 

Return number of registered paths in manager.

Definition at line 86 of file FileSystem.h.

References TArrayPtrs< T, size, step >::Count().

Here is the call graph for this function:

void NSFileSystem::TFSFileSystem::operator= const TFSFileSystem orig  ) 
 

fake assignment operator

BOOL TFSFileSystem::RegisterCabinet const TString filename  ) 
 

Register next cabinet into system.

Parameters:
filename [in] name of valid cabinet file

Definition at line 61 of file FileSystem.cpp.

References TArrayPtrs< T, size, step >::AddItem(), FALSE, NSFileSystem::TFSCabinet::LoadCabinet(), and TRUE.

Referenced by RegisterMultipleCabinets().

Here is the call graph for this function:

DWORD TFSFileSystem::RegisterMultipleCabinets const TString cabinets  ) 
 

This method register more cabinets into VFS.

Cabinets are contained in string, each must be terminated by ';'

Method returns number of successfully registered cabinets.

Parameters:
cabinets [in] string with cabinets in format "dir1/cabinet;cabinet;"

Definition at line 123 of file FileSystem.cpp.

References TString::Add(), TString::At(), TString::ClearDeallocOff(), TString::Length(), and RegisterCabinet().

Here is the call graph for this function:

DWORD TFSFileSystem::RegisterMultiplePaths const TString paths  ) 
 

This method register more paths into VFS.

Paths are contained in string, each path must be terminated by '/;'

Method returns number of successfully registered paths.

Parameters:
paths [in] string with paths in format "dir1/dirlast/;dir2/dir_other/;"

Definition at line 85 of file FileSystem.cpp.

References TString::Add(), TString::At(), TString::ClearDeallocOff(), TString::Length(), and RegisterPath().

Here is the call graph for this function:

BOOL TFSFileSystem::RegisterPath const TString path  ) 
 

Register next path into system.

This path must have '/' as last character and must be valid!!!

Parameters:
path [in] registered path terminated with '/'

Definition at line 42 of file FileSystem.cpp.

References TArrayPtrs< T, size, step >::AddItem(), TString::At(), DBGTEXTF, FALSE, TString::Length(), and TRUE.

Referenced by RegisterMultiplePaths().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Wed Nov 28 22:44:52 2007 for Joy4D by  doxygen 1.4.6-NO