# Ogre::ArchiveManager Class Reference

This class manages the available ArchiveFactory plugins. More...

`#include <OgreArchiveManager.h>`

Inheritance diagram for Ogre::ArchiveManager:
[legend]

List of all members.

## Public Member Functions

| ArchiveManager ()
| Default constructor - should never get called by a client app.
virtual | ~ArchiveManager ()
| Default destructor.
Archive * | load (const String &filename, const String &archiveType)
| Opens an archive for file reading.
void | unload (Archive *arch)
| Unloads an archive.
void | unload (const String &filename)
| Unloads an archive by name.
void | addArchiveFactory (ArchiveFactory *factory)
| Adds a new ArchiveFactory to the list of available factories.

## Static Public Member Functions

static ArchiveManager & | getSingleton (void)
| Override standard Singleton retrieval.
static ArchiveManager * | getSingletonPtr (void)
| Override standard Singleton retrieval.

## Protected Types

typedef std::map < String, ArchiveFactory * > | ArchiveFactoryMap
typedef std::map < String, Archive * > | ArchiveMap
| Currently loaded archives.

## Protected Attributes

ArchiveFactoryMap | mArchFactories
| Factories available to create archives, indexed by archive type (String identifier e.g. 'Zip').
ArchiveMap | mArchives

## Static Protected Attributes

static T * | ms_Singleton

## Detailed Description

This class manages the available ArchiveFactory plugins.

Definition at line 41 of file OgreArchiveManager.h.

## Member Typedef Documentation

typedef std::map<String, ArchiveFactory*> Ogre::ArchiveManager::ArchiveFactoryMap`[protected]`

Definition at line 44 of file OgreArchiveManager.h.

typedef std::map<String, Archive*> Ogre::ArchiveManager::ArchiveMap`[protected]`

Currently loaded archives.

Definition at line 48 of file OgreArchiveManager.h.

## Constructor & Destructor Documentation

Ogre::ArchiveManager::ArchiveManager | ( |  | ) |

Default constructor - should never get called by a client app.

Definition at line 54 of file OgreArchiveManager.h.

virtual Ogre::ArchiveManager::~ArchiveManager | ( |  | ) | `[virtual]`

Default destructor.

## Member Function Documentation

Archive* Ogre::ArchiveManager::load | ( | const String & | filename,
|  | const String & | archiveType |
| ) |  |  |

Opens an archive for file reading.

Remarks:
  The archives are created using class factories within extension libraries.

Parameters:

  | filename | The filename that will be opened
  | refLibrary | The library that contains the data-handling code

Returns:
  If the function succeeds, a valid pointer to an Archive object is returened.

  If the function fails, an exception is thrown.

void Ogre::ArchiveManager::unload | ( | Archive * | arch | ) |

Unloads an archive.

Remarks:
  You must ensure that this archive is not being used before removing it.

void Ogre::ArchiveManager::unload | ( | const String & | filename | ) |

Unloads an archive by name.

Remarks:
  You must ensure that this archive is not being used before removing it.

void Ogre::ArchiveManager::addArchiveFactory | ( | ArchiveFactory * | factory | ) |

Adds a new ArchiveFactory to the list of available factories.

Remarks:
  Plugin developers who add new archive codecs need to call this after defining their ArchiveFactory subclass and Archive subclasses for their archive type.

static ArchiveManager& Ogre::ArchiveManager::getSingleton | ( | void |  | ) | `[static]`

Override standard Singleton retrieval.

Remarks:
  Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.

  This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< T >.

static ArchiveManager* Ogre::ArchiveManager::getSingletonPtr | ( | void |  | ) | `[static]`

Override standard Singleton retrieval.

Remarks:
  Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.

  This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< T >.

## Member Data Documentation

ArchiveFactoryMap Ogre::ArchiveManager::mArchFactories`[protected]`

Factories available to create archives, indexed by archive type (String identifier e.g. 'Zip').

Definition at line 46 of file OgreArchiveManager.h.

ArchiveMap Ogre::ArchiveManager::mArchives`[protected]`

Definition at line 49 of file OgreArchiveManager.h.

template<typename T>

T* Ogre::Singleton< T >::ms_Singleton`[static, protected, inherited]`

Definition at line 61 of file OgreSingleton.h.

Referenced by Ogre::Singleton< Ogre::FontManager >::getSingleton(), Ogre::Singleton< Ogre::FontManager >::getSingletonPtr(), Ogre::Singleton< Ogre::FontManager >::Singleton(), and Ogre::Singleton< Ogre::FontManager >::~Singleton().

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

- OgreArchiveManager.h

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat May 10 16:25:16 2008