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

Ogre::ArchiveEx Class Reference

Archive-handling class. More...

#include <OgreArchiveEx.h>

Inheritance diagram for Ogre::ArchiveEx:

Ogre::Resource Ogre::Zip List of all members.

Public Methods

 ArchiveEx ()
 Default constructor. More...

 ArchiveEx (const String &name)
 Usual constructor - used by ArchiveManager. More...

virtual ~ArchiveEx ()
 Default destructor. More...

virtual void load ()=0
 Loads the archive. More...

virtual void unload ()=0
 Unloads the archive. More...

virtual bool fileOpen (const String &strFile, FILE **ppFile) const=0
virtual bool fileRead (const String &strFile, DataChunk **ppChunk) const=0
 Reads the contents of a file within the archive and copies it in the passed DataChunk. More...

virtual bool fileSave (FILE *pFile, const String &strPath, bool bOverwrite=false)=0
 Creates a new file in the archive and copies in it the contents of the file associated with the passed FILE stream. More...

virtual bool fileWrite (const DataChunk &refChunk, const String &strPath, bool bOverwrite=false)=0
 Creates a new file in the archive and copies in it the contents of the passed DataChunk. More...

virtual bool fileDele (const String &strFile)=0
 Deletes a file from the archive. More...

virtual bool fileMove (const String &strSrc, const String &strDest, bool bOverwrite)=0
 Moves a file within the archive. More...

virtual bool fileInfo (const String &strFile, FileInfo **ppInfo) const=0
 Retrieves information about a file within the archive. More...

virtual bool fileCopy (const String &strSrc, const String &strDest, bool bOverwrite)=0
 Copies a file within the archive. More...

virtual bool fileTest (const String &strFile) const=0
 Tests wheter a file within the archive can be succesfully read. More...

virtual std::vector< StringdirGetFiles (const String &strDir) const=0
 Finds the names of all the files within a directory inside the archive. More...

virtual std::vector< StringdirGetSubs (const String &strDir) const=0
 Finds the names of all the subdirectories within a directory inside the archive. More...

virtual bool dirDele (const String &strDir, bool bRecursive)=0
 Deletes a directory from the archive. More...

virtual bool dirMove (const String &strSrc, const String &strDest, bool bOverwrite)=0
virtual bool dirInfo (const String &strDir, FileInfo **ppInfo) const=0
virtual bool dirCopy (const String &strSrc, const String &strDest, bool bOverwrite)=0
virtual bool dirTest (const String &strDir) const=0
virtual std::vector< StringgetAllNamesLike (const String &strStartPath, const String &strPattern, bool bRecursive=true)=0
virtual bool _allowFileCaching () const=0
 This function gets called by the resource manager to know if it is okay to cahche all the files in the achive. More...

virtual size_t getSize (void)
 Retrieves info about the size of the resource. More...

void touch (void)
 'Touches' the resource to indicate it has been used. More...

time_t getLastAccess (void) const
 Gets the last time the resource was 'touched'. More...

const StringgetName (void) const
 Gets resource name. More...

bool isLoaded (void) const
 Returns true if the Resource has been loaded, false otherwise. More...

virtual void destroy ()
 A method to make the resource delete itself. More...


Protected Attributes

String mName
bool mIsLoaded
time_t mLastAccess
size_t mSize

Detailed Description

Archive-handling class.

Remarks:
This class is supposed to be subclassed in order to create specialised archive codecs that should reside in .DLL's/.so's.
Author:
Adrian Cearnau (cearny@cearny.ro)
Since:
31st of January 2002


Constructor & Destructor Documentation

Ogre::ArchiveEx::ArchiveEx   [inline]
 

Default constructor.

Note:

Should never get called.

Ogre::ArchiveEx::ArchiveEx const String   name [inline]
 

Usual constructor - used by ArchiveManager.

Warning:
Never call directly.

virtual Ogre::ArchiveEx::~ArchiveEx   [inline, virtual]
 

Default destructor.


Member Function Documentation

virtual bool Ogre::ArchiveEx::_allowFileCaching   const [pure virtual]
 

This function gets called by the resource manager to know if it is okay to cahche all the files in the achive.

Remarks:
Allowing file caching may not always be a very good idea. For example, caching all the files on a distant web server would work very slowly.
Since:
29.04.2002

Implemented in Ogre::Zip.

virtual void Ogre::Resource::destroy void    [inline, virtual, inherited]
 

A method to make the resource delete itself.

Note:
This exists because Resource objects could be created in other processes, and they need to be destroyed in the process that created them.

virtual bool Ogre::ArchiveEx::dirCopy const String   strSrc,
const String   strDest,
bool    bOverwrite
[pure virtual]
 

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::dirDele const String   strDir,
bool    bRecursive
[pure virtual]
 

Deletes a directory from the archive.

Parameters:
strDir  The path to the directory to delete.
bRecursive  If set to true, all the subdirectories of the given directory will also be deleted.
Returns:
If the function succeeds, true is returned.

If the function fails, false is returned.

Note:

If the directory contains other subdirectories, and the bRecursive parameter is set to false, only the files in the current directory are deleted and the directory will not be removed.

Implemented in Ogre::Zip.

virtual std::vector<String> Ogre::ArchiveEx::dirGetFiles const String   strDir const [pure virtual]
 

Finds the names of all the files within a directory inside the archive.

Parameters:
strDir  The directory's path.
Returns:
A StringVector containing all the files.

Implemented in Ogre::Zip.

virtual std::vector<String> Ogre::ArchiveEx::dirGetSubs const String   strDir const [pure virtual]
 

Finds the names of all the subdirectories within a directory inside the archive.

Parameters:
strDir  The directory's path.
Returns:
A StringVector containing the names of all the subdirectories.

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::dirInfo const String   strDir,
FileInfo **    ppInfo
const [pure virtual]
 

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::dirMove const String   strSrc,
const String   strDest,
bool    bOverwrite
[pure virtual]
 

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::dirTest const String   strDir const [pure virtual]
 

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::fileCopy const String   strSrc,
const String   strDest,
bool    bOverwrite
[pure virtual]
 

Copies a file within the archive.

Parameters:
strSrc  The source file.
strDest  The destination path.
bOverwrite  If set to true, a file with the same name already exists at the destination and appending or deleting is possible, the old file is deleted and a new one containing the new data is created.
Returns:
If the function succeeds, true is returned.

If the function fails, false is returned.

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::fileDele const String   strFile [pure virtual]
 

Deletes a file from the archive.

Parameters:
strFile  The name of the file te be deleted.
Returns:
If the function succeeds, true is returned.

If the function fails, false is returned.

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::fileInfo const String   strFile,
FileInfo **    ppInfo
const [pure virtual]
 

Retrieves information about a file within the archive.

Parameters:
strFile  The name of the file to retrieve information for.
ppInfo  Pointer to the memory address of a FileInfo struct that will be filled with the requested information.
Returns:
If the function succeeds, true is returned.

If the function fails, false is returned.

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::fileMove const String   strSrc,
const String   strDest,
bool    bOverwrite
[pure virtual]
 

Moves a file within the archive.

Parameters:
strSrc  The source file.
strDest  The location within the archive where to move the file.
bOverwrite  If set to true, a file with the same name already exists at the destination and appending or deleting is possible, the old file is deleted and a new one containing the new data is created.
Returns:
If the function succeeds, true is returned.

If the function fails, false is returned.

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::fileOpen const String   strFile,
FILE **    ppFile
const [pure virtual]
 

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::fileRead const String   strFile,
DataChunk **    ppChunk
const [pure virtual]
 

Reads the contents of a file within the archive and copies it in the passed DataChunk.

Parameters:
strFile  The name of the file to read from the archive.
ppChunk  A pointer to the addres of a DataChunk class that will hold the file's contens.
Returns:
If the function succeeds, true is returned.

If the function fails, false is returned.

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::fileSave FILE *    pFile,
const String   strPath,
bool    bOverwrite = false
[pure virtual]
 

Creates a new file in the archive and copies in it the contents of the file associated with the passed FILE stream.

Parameters:
pFile  A valid FILE pointer that holds the file stream information.
strPath  The location inside the archive where the new file will be created.
bOverwrite  If set to true, a file with the same name already exists inside the archive and appending or deleting is possible, the old file is deleted and a new one containing the new data is created.
Returns:
If the function succeeds, true is returned.

If the function fails, false is returned.

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::fileTest const String   strFile const [pure virtual]
 

Tests wheter a file within the archive can be succesfully read.

Parameters:
strFile  The name of the file to be tested.
Returns:
If the file can be read, true is returned.

If the file cannot be read, false is returned.

Implemented in Ogre::Zip.

virtual bool Ogre::ArchiveEx::fileWrite const DataChunk   refChunk,
const String   strPath,
bool    bOverwrite = false
[pure virtual]
 

Creates a new file in the archive and copies in it the contents of the passed DataChunk.

Parameters:
refChunk  A DataChunk class that contains the data to be written to the new file.
strPath  The location inside the archive where the new file will be created.
bOverwrite  If set to true, a file with the same name already exists inside the archive and appending or deleting is possible, the old file is deleted and a new one containing the new data is created.
Returns:
If the function succeeds, true is returned.

If the function fails, false is returned.

Implemented in Ogre::Zip.

virtual std::vector<String> Ogre::ArchiveEx::getAllNamesLike const String   strStartPath,
const String   strPattern,
bool    bRecursive = true
[pure virtual]
 

Implemented in Ogre::Zip.

time_t Ogre::Resource::getLastAccess void    const [inline, inherited]
 

Gets the last time the resource was 'touched'.

const String& Ogre::Resource::getName void    const [inline, inherited]
 

Gets resource name.

Reimplemented in Ogre::Material.

virtual size_t Ogre::Resource::getSize void    [inline, virtual, inherited]
 

Retrieves info about the size of the resource.

bool Ogre::Resource::isLoaded void    const [inline, inherited]
 

Returns true if the Resource has been loaded, false otherwise.

virtual void Ogre::ArchiveEx::load   [pure virtual]
 

Loads the archive.

Remarks:
This initializes all the internal data of the class.
Warning:
Do not call this function directly, it is ment to be used only by the ArchiveManager class.

Implements Ogre::Resource.

Implemented in Ogre::Zip.

void Ogre::Resource::touch void    [inline, inherited]
 

'Touches' the resource to indicate it has been used.

virtual void Ogre::ArchiveEx::unload   [pure virtual]
 

Unloads the archive.

Warning:
Do not call this function directly, it is ment to be used only by the ArchiveManager class.

Reimplemented from Ogre::Resource.

Implemented in Ogre::Zip.


Member Data Documentation

bool Ogre::Resource::mIsLoaded [protected, inherited]
 

time_t Ogre::Resource::mLastAccess [protected, inherited]
 

String Ogre::Resource::mName [protected, inherited]
 

size_t Ogre::Resource::mSize [protected, inherited]
 

Copyright © 2002 by The OGRE Team