Class to handle management of on-disk resources.
More...
#include <ResourceManager.h>
Class to handle management of on-disk resources.
Resource * Menge::ResourceManager::getResource |
( |
const std::string & |
fileName, |
|
|
Resource *(*)(const std::string &) |
reader, |
|
|
const std::string & |
suffix |
|
) |
| |
|
static |
Retrieve a resource from the manager.
- Parameters
-
fileName | The name of the file associated with the resource. |
reader | Pointer to a function for parsing the given file and producing a resource instance. |
suffix | The string to append to the file name. This allows different types of resources basedon on the same file resource to be distinguished. It is the burden of the programmer to make sure each type provides a unique suffix, otherwise problems will arise between suffix collisions. |
- Returns
- A pointer to the reference, if it is loaded, NULL otherwise. The caller is responsible for knowing what type of resource it should be and test it using a dynamic-cast.
bool Menge::ResourceManager::removeResource |
( |
Resource * |
rsrc | ) |
|
|
static |
Remove the given resource.
- Parameters
-
rsrc | A pointer to the resource to remove. |
- Returns
- True if the pointer is successfully removed, false otherwise. It can fail if the resource doesn't belong to the manager or if the resources reference count is not zero.
The documentation for this class was generated from the following files:
- src/menge/MengeCore/resources/ResourceManager.h
- src/menge/MengeCore/resources/ResourceManager.cpp