Ogre::ZipArchive Class Reference
Core » Resources

Specialisation of the Archive class to allow reading of files from a zip format source archive. More...

`#include <OgreZip.h>`

Inheritance diagram for Ogre::ZipArchive:
[legend]

## Public Member Functions

| ZipArchive (const String &name, const String &archType, zzip_plugin_io_handlers *pluginIo=NULL)
| ~ZipArchive ()
DataStreamPtr | create (const String &filename) const
| Create a new file (or overwrite one already there). More...
bool | exists (const String &filename)
| Find out if the named file exists (note: fully qualified filename required) More...
StringVectorPtr | find (const String &pattern, bool recursive=true, bool dirs=false)
| Find all file or directory names matching a given pattern in this archive. More...
FileInfoListPtr | findFileInfo (const String &pattern, bool recursive=true, bool dirs=false) const
| Find all files or directories matching a given pattern in this archive and get some detailed information about them. More...
time_t | getModifiedTime (const String &filename)
| Retrieve the modification time of a given file. More...
const String & | getName (void) const
| Get the name of this archive. More...
const String & | getType (void) const
| Return the type code of this Archive. More...
bool | isCaseSensitive (void) const
| Returns whether this archive is case sensitive in the way it matches files. More...
virtual bool | isReadOnly () const
| Reports whether this Archive is read-only, or whether the contents can be updated. More...
StringVectorPtr | list (bool recursive=true, bool dirs=false)
| List all file names in the archive. More...
FileInfoListPtr | listFileInfo (bool recursive=true, bool dirs=false)
| List all files in the archive with accompanying information. More...
void | load ()
| Loads the archive. More...
DataStreamPtr | open (const String &filename, bool readOnly=true) const
| Open a stream on a given file. More...
void | operator delete (void *ptr)
void | operator delete (void *ptr, void *)
void | operator delete (void *ptr, const char *, int, const char *)
void | operator delete[] (void *ptr)
void | operator delete[] (void *ptr, const char *, int, const char *)
void * | operator new (size_t sz, const char *file, int line, const char *func)
| operator new, with debug line info More...
void * | operator new (size_t sz)
void * | operator new (size_t sz, void *ptr)
| placement operator new More...
void * | operator new[] (size_t sz, const char *file, int line, const char *func)
| array operator new, with debug line info More...
void * | operator new[] (size_t sz)
void | remove (const String &filename) const
| Delete a named file. More...
void | unload ()
| Unloads the archive. More...

## Protected Member Functions

void | checkZzipError (int zzipError, const String &operation) const
| Handle any errors from zzip. More...

## Protected Attributes

FileInfoList | mFileList
| File list (since zziplib seems to only allow scanning of dir tree once) More...
String | mName
| Archive name. More...
zzip_plugin_io_handlers * | mPluginIo
| A pointer to file io alternative implementation. More...
bool | mReadOnly
| Read-only flag. More...
String | mType
| Archive type code. More...
ZZIP_DIR * | mZzipDir
| Handle to root zip file. More...
| OGRE_AUTO_MUTEX

## Detailed Description

Specialisation of the Archive class to allow reading of files from a zip format source archive.

Remarks
  This archive format supports all archives compressed in the standard zip format, including iD pk3 files.

Definition at line 59 of file OgreZip.h.

## Constructor & Destructor Documentation

## ZipArchive()

Ogre::ZipArchive::ZipArchive | ( | const String & | name,
|  | const String & | archType,
|  | zzip_plugin_io_handlers * | pluginIo = `NULL`
| ) |  |

## ~ZipArchive()

Ogre::ZipArchive::~ZipArchive | ( |  | ) |

## Member Function Documentation

## checkZzipError()

void Ogre::ZipArchive::checkZzipError | ( | int | zzipError,
|  | const String & | operation
| ) |  | const

protected

Handle any errors from zzip.

## create()

DataStreamPtr Ogre::ZipArchive::create | ( | const String & | filename | ) | const

virtual

Create a new file (or overwrite one already there).

Note
  If the archive is read-only then this method will fail.

Parameters

  filename | The fully qualified name of the file

Returns
  A shared pointer to a DataStream which can be used to read / write the file.

Reimplemented from Ogre::Archive.

## exists()

bool Ogre::ZipArchive::exists | ( | const String & | filename | ) |

virtual

Find out if the named file exists (note: fully qualified filename required)

Implements Ogre::Archive.

## find()

StringVectorPtr Ogre::ZipArchive::find | ( | const String & | pattern,
|  | bool | recursive = `true`,
|  | bool | dirs = `false`
| ) |  |

virtual

Find all file or directory names matching a given pattern in this archive.

Note
  This method only returns filenames, you can also retrieve other information using findFileInfo.

Parameters

  pattern | The pattern to search for; wildcards (*) are allowed
  recursive | Whether all paths of the archive are searched (if the archive has a concept of that)
  dirs | Set to true if you want the directories to be listed instead of files

Returns
  A list of filenames matching the criteria, all are fully qualified

Implements Ogre::Archive.

## findFileInfo()

FileInfoListPtr Ogre::ZipArchive::findFileInfo | ( | const String & | pattern,
|  | bool | recursive = `true`,
|  | bool | dirs = `false`
| ) |  | const

virtual

Find all files or directories matching a given pattern in this archive and get some detailed information about them.

Parameters

  pattern | The pattern to search for; wildcards (*) are allowed
  recursive | Whether all paths of the archive are searched (if the archive has a concept of that)
  dirs | Set to true if you want the directories to be listed instead of files

Returns
  A list of file information structures for all files matching the criteria.

Implements Ogre::Archive.

## getModifiedTime()

time_t Ogre::ZipArchive::getModifiedTime | ( | const String & | filename | ) |

virtual

Retrieve the modification time of a given file.

Implements Ogre::Archive.

## getName()

const String& Ogre::Archive::getName | ( | void |  | ) | const

inherited

Get the name of this archive.

Definition at line 110 of file OgreArchive.h.

## getType()

const String& Ogre::Archive::getType | ( | void |  | ) | const

inherited

Return the type code of this Archive.

Definition at line 233 of file OgreArchive.h.

Referenced by Ogre::APKFileSystemArchiveFactory::createInstance(), and Ogre::APKFileSystemArchiveFactory::~APKFileSystemArchiveFactory().

## isCaseSensitive()

bool Ogre::ZipArchive::isCaseSensitive | ( | void |  | ) | const

virtual

Returns whether this archive is case sensitive in the way it matches files.

Implements Ogre::Archive.

Definition at line 76 of file OgreZip.h.

## isReadOnly()

virtual bool Ogre::Archive::isReadOnly | ( |  | ) | const

virtual inherited

Reports whether this Archive is read-only, or whether the contents can be updated.

Definition at line 134 of file OgreArchive.h.

References Ogre::FileInfo::filename.

## list()

StringVectorPtr Ogre::ZipArchive::list | ( | bool | recursive = `true`,
|  | bool | dirs = `false`
| ) |  |

virtual

List all file names in the archive.

Note
  This method only returns filenames, you can also retrieve other information using listFileInfo.

Parameters

  recursive | Whether all paths of the archive are searched (if the archive has a concept of that)
  dirs | Set to true if you want the directories to be listed instead of files

Returns
  A list of filenames matching the criteria, all are fully qualified

Implements Ogre::Archive.

## listFileInfo()

FileInfoListPtr Ogre::ZipArchive::listFileInfo | ( | bool | recursive = `true`,
|  | bool | dirs = `false`
| ) |  |

virtual

List all files in the archive with accompanying information.

Parameters

  recursive | Whether all paths of the archive are searched (if the archive has a concept of that)
  dirs | Set to true if you want the directories to be listed instead of files

Returns
  A list of structures detailing quite a lot of information about all the files in the archive.

Implements Ogre::Archive.

## load()

void Ogre::ZipArchive::load | ( |  | ) |

virtual

Loads the archive.

Remarks
  This initializes all the internal data of the class.

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

Implements Ogre::Archive.

## open()

DataStreamPtr Ogre::ZipArchive::open | ( | const String & | filename,
|  | bool | readOnly = `true`
| ) |  | const

virtual

Open a stream on a given file.

Note
  There is no equivalent 'close' method; the returned stream controls the lifecycle of this file operation.

Parameters

  filename | The fully qualified name of the file
  readOnly | Whether to open the file in read-only mode or not (note, if the archive is read-only then this cannot be set to false)

Returns
  A shared pointer to a DataStream which can be used to read / write the file. If the file is not present, returns a null shared pointer.

Implements Ogre::Archive.

## operator delete() [1/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) |

inherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

## operator delete() [2/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | void * |
| ) |  |

inherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

## operator delete() [3/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  |

inherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [1/2]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) |

inherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [2/2]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  |

inherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

## operator new() [1/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  |

inherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

## operator new() [2/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) |

inherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

## operator new() [3/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | void * | ptr
| ) |  |

inherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

## operator new[]() [1/2]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  |

inherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

## operator new[]() [2/2]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz | ) |

inherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

## remove()

void Ogre::ZipArchive::remove | ( | const String & | filename | ) | const

virtual

Delete a named file.

Remarks
  Not possible on read-only archives

Parameters

  filename | The fully qualified name of the file

Reimplemented from Ogre::Archive.

## unload()

void Ogre::ZipArchive::unload | ( |  | ) |

virtual

Unloads the archive.

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

Implements Ogre::Archive.

## Member Data Documentation

## mFileList

FileInfoList Ogre::ZipArchive::mFileList

protected

File list (since zziplib seems to only allow scanning of dir tree once)

Definition at line 67 of file OgreZip.h.

## mName

String Ogre::Archive::mName

protected inherited

Archive name.

Definition at line 92 of file OgreArchive.h.

## mPluginIo

zzip_plugin_io_handlers* Ogre::ZipArchive::mPluginIo

protected

A pointer to file io alternative implementation.

Definition at line 69 of file OgreZip.h.

## mReadOnly

bool Ogre::Archive::mReadOnly

protected inherited

Read-only flag.

Definition at line 96 of file OgreArchive.h.

## mType

String Ogre::Archive::mType

protected inherited

Archive type code.

Definition at line 94 of file OgreArchive.h.

## mZzipDir

ZZIP_DIR* Ogre::ZipArchive::mZzipDir

protected

Handle to root zip file.

Definition at line 63 of file OgreZip.h.

## OGRE_AUTO_MUTEX

Ogre::ZipArchive::OGRE_AUTO_MUTEX

protected

Definition at line 71 of file OgreZip.h.

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

- OgreZip.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.