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

Ogre::Zip Class Reference

#include <OgreZip.h>

Inheritance diagram for Ogre::Zip:

Inheritance graph
[legend]
List of all members.

Public Methods

 Zip ()
 Zip (const String &name)
 ~Zip ()
void load ()
 Loads the archive.

void unload ()
 Unloads the archive.

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

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

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

bool fileDele (const String &strFile)
 Deletes a file from the archive.

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

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

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

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

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

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

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

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

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

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

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

const StringgetName (void) const
 Gets resource name.

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

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


Protected Attributes

String mName
ResourceHandle mHandle
bool mIsLoaded
time_t mLastAccess
size_t mSize

Private Attributes

unzFile mArchive

Constructor & Destructor Documentation

Ogre::Zip::Zip  
 

Definition at line 241 of file OgreZip.cpp.

Ogre::Zip::Zip const String   name
 

Definition at line 244 of file OgreZip.cpp.

References Ogre::Resource::mName.

Ogre::Zip::~Zip  
 

Definition at line 250 of file OgreZip.cpp.


Member Function Documentation

bool Ogre::Zip::_allowFileCaching   const [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

Implements Ogre::ArchiveEx.

Definition at line 71 of file OgreZip.h.

virtual void Ogre::Resource::destroy void    [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.

Definition at line 137 of file OgreResource.h.

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

Implements Ogre::ArchiveEx.

Definition at line 156 of file OgreZip.cpp.

bool Ogre::Zip::dirDele const String   strDir,
bool    bRecursive
[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.

Implements Ogre::ArchiveEx.

Definition at line 138 of file OgreZip.cpp.

std::vector< String > Ogre::Zip::dirGetFiles const String   strDir const [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.

Implements Ogre::ArchiveEx.

Definition at line 126 of file OgreZip.cpp.

std::vector< String > Ogre::Zip::dirGetSubs const String   strDir const [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.

Implements Ogre::ArchiveEx.

Definition at line 132 of file OgreZip.cpp.

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

Implements Ogre::ArchiveEx.

Definition at line 150 of file OgreZip.cpp.

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

Implements Ogre::ArchiveEx.

Definition at line 144 of file OgreZip.cpp.

bool Ogre::Zip::dirTest const String   strDir const [virtual]
 

Implements Ogre::ArchiveEx.

Definition at line 162 of file OgreZip.cpp.

bool Ogre::Zip::fileCopy const String   strSrc,
const String   strDest,
bool    bOverwrite
[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.

Implements Ogre::ArchiveEx.

Definition at line 102 of file OgreZip.cpp.

bool Ogre::Zip::fileDele const String   strFile [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.

Implements Ogre::ArchiveEx.

Definition at line 114 of file OgreZip.cpp.

bool Ogre::Zip::fileInfo const String   strFile,
FileInfo **    ppInfo
const [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.

Implements Ogre::ArchiveEx.

Definition at line 120 of file OgreZip.cpp.

bool Ogre::Zip::fileMove const String   strSrc,
const String   strDest,
bool    bOverwrite
[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.

Implements Ogre::ArchiveEx.

Definition at line 108 of file OgreZip.cpp.

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

Implements Ogre::ArchiveEx.

Definition at line 38 of file OgreZip.cpp.

References mArchive.

bool Ogre::Zip::fileRead const String   strFile,
DataChunk **    ppChunk
const [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.

Implements Ogre::ArchiveEx.

Definition at line 63 of file OgreZip.cpp.

References Ogre::DataChunk::allocate(), Ogre::DataChunk::getPtr(), and mArchive.

bool Ogre::Zip::fileSave FILE *    pFile,
const String   strPath,
bool    bOverwrite = false
[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.

Implements Ogre::ArchiveEx.

Definition at line 82 of file OgreZip.cpp.

bool Ogre::Zip::fileTest const String   strFile const [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.

Implements Ogre::ArchiveEx.

Definition at line 94 of file OgreZip.cpp.

References mArchive.

bool Ogre::Zip::fileWrite const DataChunk   refChunk,
const String   strPath,
bool    bOverwrite = false
[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.

Implements Ogre::ArchiveEx.

Definition at line 88 of file OgreZip.cpp.

StringVector Ogre::Zip::getAllNamesLike const String   strStartPath,
const String   strPattern,
bool    bRecursive = true
[virtual]
 

Implements Ogre::ArchiveEx.

Definition at line 168 of file OgreZip.cpp.

References mArchive, Ogre::StringVector, and Ogre::String::toLowerCase().

ResourceHandle Ogre::Resource::getHandle void    const [inherited]
 

Definition at line 120 of file OgreResource.h.

References Ogre::ResourceHandle.

Referenced by Ogre::Material::clone(), Ogre::BspLevel::loadQuake3Level(), and Ogre::ResourceManager::unload().

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

Gets the last time the resource was 'touched'.

Definition at line 108 of file OgreResource.h.

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

Gets resource name.

Reimplemented in Ogre::Material, and Ogre::Overlay.

Definition at line 115 of file OgreResource.h.

Referenced by Ogre::D3D9Texture::_loadCubeTex(), Ogre::Mesh::_notifySkeleton(), Ogre::ResourceManager::add(), Ogre::PopupMenuGuiElement::addListItem(), Ogre::ListGuiElement::addListItem(), Ogre::PopupMenuGuiElement::addMenuItem(), Ogre::MeshManager::createPrefabPlane(), Ogre::TTYGuiElement::getFontName(), Ogre::TextAreaGuiElement::getFontName(), Ogre::PopupMenuGuiElement::getListItemName(), Ogre::ListGuiElement::getListItemName(), Ogre::GpuProgramUsage::getProgramName(), Ogre::MeshSerializer::importMesh(), Ogre::GLTexture::load(), Ogre::TextureManager::loadImage(), Ogre::TextureManager::loadRawData(), Ogre::FontManager::logBadAttrib(), Ogre::MeshSerializerImpl_v1::readMaterial(), Ogre::MeshSerializerImpl::readMeshLodInfo(), Ogre::MeshSerializerImpl_v1::readMeshLodUsageGenerated(), Ogre::MeshSerializerImpl::readMeshLodUsageGenerated(), Ogre::MeshSerializerImpl::readMeshLodUsageManual(), Ogre::PopupMenuGuiElement::removeListItem(), Ogre::ListGuiElement::removeListItem(), Ogre::SceneManager::setSkyBox(), Ogre::SceneManager::setSkyDome(), and Ogre::ResourceManager::unload().

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

Retrieves info about the size of the resource.

Definition at line 93 of file OgreResource.h.

Referenced by Ogre::ResourceManager::unload().

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

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

Definition at line 127 of file OgreResource.h.

Referenced by Ogre::GpuProgramUsage::_load(), Ogre::SceneManager::deriveShadowCasterPass(), Ogre::SceneManager::deriveShadowReceiverPass(), Ogre::Technique::isLoaded(), Ogre::D3D9Texture::load(), Ogre::D3D9Texture::unload(), and Ogre::D3D9Texture::~D3D9Texture().

void Ogre::Zip::load   [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::ArchiveEx.

Definition at line 216 of file OgreZip.cpp.

References Except, mArchive, Ogre::Resource::mIsLoaded, and Ogre::Resource::mName.

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

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

Reimplemented in Ogre::Material.

Definition at line 100 of file OgreResource.h.

Referenced by Ogre::Mesh::clone(), Ogre::MeshManager::createCurvedIllusionPlane(), Ogre::MeshManager::createCurvedPlane(), Ogre::MeshManager::createPlane(), and Ogre::ResourceManager::load().

void Ogre::Zip::unload   [virtual]
 

Unloads the archive.

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

Implements Ogre::ArchiveEx.

Definition at line 231 of file OgreZip.cpp.

References mArchive, and Ogre::Resource::mName.


Member Data Documentation

unzFile Ogre::Zip::mArchive [private]
 

Definition at line 74 of file OgreZip.h.

Referenced by fileOpen(), fileRead(), fileTest(), getAllNamesLike(), load(), and unload().

ResourceHandle Ogre::Resource::mHandle [protected, inherited]
 

Definition at line 57 of file OgreResource.h.

Referenced by Ogre::ResourceManager::add(), Ogre::Material::clone(), Ogre::Material::copyDetailsTo(), and Ogre::Material::operator=().

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

Definition at line 58 of file OgreResource.h.

Referenced by Ogre::D3D9Texture::_initMembers(), Ogre::D3D9Texture::_loadCubeTex(), Ogre::D3D9Texture::_loadNormTex(), Ogre::D3D9Texture::_loadVolumeTex(), Ogre::Material::_notifyNeedsRecompile(), Ogre::Material::clone(), Ogre::D3DTexture::createSurface2D(), Ogre::D3DTexture::createSurface3D(), Ogre::D3D9Texture::D3D9Texture(), Ogre::D3DTexture::D3DTexture(), Ogre::DynLib::DynLib(), load(), Ogre::SkeletonInstance::load(), Ogre::Skeleton::load(), Ogre::PatchMesh::load(), Ogre::Mesh::load(), Ogre::Material::load(), Ogre::HighLevelGpuProgram::load(), Ogre::GpuProgram::load(), Ogre::GLTexture::load(), Ogre::Font::load(), Ogre::DynLib::load(), Ogre::D3D9Texture::load(), Ogre::D3D9GpuProgram::load(), Ogre::D3DTexture::load(), Ogre::BspLevel::load(), Ogre::D3D9Texture::loadImage(), Ogre::D3DTexture::loadImage(), Ogre::D3DTexture::loadImage3D(), Ogre::GLTexture::loadImages(), Ogre::Material::Material(), Ogre::Material::operator=(), Ogre::Skeleton::unload(), Ogre::Mesh::unload(), Ogre::Material::unload(), Ogre::HighLevelGpuProgram::unload(), Ogre::GLTexture::unload(), Ogre::Font::unload(), Ogre::DynLib::unload(), Ogre::D3D9Texture::unload(), Ogre::D3DTexture::unload(), and Ogre::BspLevel::~BspLevel().

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

Definition at line 59 of file OgreResource.h.

Referenced by Ogre::Material::operator=().

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

Definition at line 56 of file OgreResource.h.

Referenced by Ogre::Skeleton::_dumpContents(), Ogre::Mesh::_rationaliseBoneAssignments(), Ogre::BspLevel::BspLevel(), Ogre::Mesh::buildEdgeList(), Ogre::Mesh::buildTangentVectors(), Ogre::Material::clone(), Ogre::Material::compile(), Ogre::Material::copyDetailsTo(), Ogre::Quake3Shader::createAsMaterial(), Ogre::D3D9HLSLProgram::createLowLevelImpl(), Ogre::CgProgram::createLowLevelImpl(), Ogre::Font::createTextureFromFont(), Ogre::D3D9Texture::D3D9Texture(), Ogre::D3DTexture::D3DTexture(), Ogre::DynLib::DynLib(), Ogre::Font::Font(), Ogre::Mesh::generateLodLevels(), Ogre::Material::getBestTechnique(), Ogre::Overlay::getName(), Ogre::Material::getName(), Ogre::GLTexture::GLTexture(), Ogre::GpuProgram::GpuProgram(), load(), Ogre::Skeleton::load(), Ogre::Mesh::load(), Ogre::GLTexture::load(), Ogre::Font::load(), Ogre::DynLib::load(), Ogre::D3DTexture::load(), Ogre::BspLevel::load(), Ogre::D3D9GpuFragmentProgram::loadFromMicrocode(), Ogre::D3D9GpuVertexProgram::loadFromMicrocode(), Ogre::GLArbGpuProgram::loadFromSource(), Ogre::D3D9HLSLProgram::loadFromSource(), Ogre::D3D9GpuProgram::loadFromSource(), Ogre::CgProgram::loadFromSource(), Ogre::GLTexture::loadImages(), Ogre::Material::Material(), Ogre::Mesh::Mesh(), Ogre::Material::operator=(), Ogre::Overlay::Overlay(), Ogre::Quake3Shader::Quake3Shader(), Ogre::CgProgram::selectProfile(), Ogre::Mesh::setSkeletonName(), Ogre::Skeleton::Skeleton(), Ogre::StringResource::StringResource(), unload(), Ogre::DynLib::unload(), Ogre::CgProgram::unloadImpl(), and Zip().

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

Definition at line 60 of file OgreResource.h.

Referenced by Ogre::D3D9Texture::_setFinalAttributes(), Ogre::D3DTexture::loadImage(), Ogre::D3DTexture::loadImage3D(), Ogre::GLTexture::loadImages(), and Ogre::Material::operator=().


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

Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:27:33 2004