Inside Easy2D, when you load any resource through the reading of an xml file, the resource will be automatically added to this map. If any subsequent load to the same resource through xml happens, Easy2D will check the map and get the resource from it, preventing double-loading of the same resource.
Public Member Functions | |
void | Clear (void) |
Removes all resources from the map. | |
Resource * | GetResource (string name) |
Gets a resource contained in the map. | |
void | PutResource (string name, Resource *resource) |
Inserts a resource into the map. | |
bool | RemoveResource (string name) |
Removes a resource from the map. | |
Static Public Member Functions | |
static ResourceMap * | GetInstance (void) |
Gets an object for this class. |
ResourceMap * e2d::core::ResourceMap::GetInstance | ( | void | ) | [static] |
This class is a Singleton. If you want an instance of this class to work with, use this method to get it.
void e2d::core::ResourceMap::Clear | ( | void | ) |
Removes every resource stored inside the map.
Resource * e2d::core::ResourceMap::GetResource | ( | string | name | ) |
Gets a resource contained in the map
name | Name of the resource you want. |
void e2d::core::ResourceMap::PutResource | ( | string | name, | |
Resource * | resource | |||
) |
Inserts into the map the resource passed as parameter associated with the name provided.
name | The name of the resource. | |
resource | The resource you want to put in the map. |
Exception | if a resource by that name already exists within the map. |
bool e2d::core::ResourceMap::RemoveResource | ( | string | name | ) |
Removes a resource from the map, thus freeing the memory it uses. If a resource by this name does not exist, nothing happens.
name | The name of the resource you want to remove. |