Resource Manager. More...
#include <resource_manager.h>
Public Member Functions | |
Construction | |
CL_ResourceManager () | |
Construct a resource manager. | |
CL_ResourceManager (const CL_String &filename) | |
Constructs a ResourceManager. | |
CL_ResourceManager (const CL_String &filename, CL_VirtualDirectory directory) | |
Constructs a ResourceManager. | |
CL_ResourceManager (CL_IODevice file, CL_VirtualDirectory directory=CL_VirtualDirectory()) | |
Constructs a ResourceManager. | |
CL_ResourceManager (const CL_ResourceManager &other) | |
Constructs a ResourceManager. | |
~CL_ResourceManager () | |
Attributes | |
bool | resource_exists (const CL_String &resource_id) const |
Returns true if a resource exists. | |
std::vector< CL_String > | get_section_names () const |
Returns all the resource sections available. | |
std::vector< CL_String > | get_resource_names () const |
Returns a list of all resources available. | |
std::vector< CL_String > | get_resource_names (const CL_String §ion) const |
std::vector< CL_String > | get_resource_names_of_type (const CL_String &type) const |
Returns a list of all resources available matching a given type. | |
std::vector< CL_String > | get_resource_names_of_type (const CL_String &type, const CL_String §ion) const |
CL_Resource | get_resource (const CL_String &resource_id, bool resolve_alias=true, int reserved=0) |
Returns CL_Resource representing the given resource. | |
CL_VirtualDirectory | get_directory (const CL_Resource &resource) const |
Returns the directory to load resource data from. | |
bool | get_boolean_resource (const CL_String &resource_id, bool default_value) |
Returns the value of a boolean resource. (using the value attribute). | |
int | get_integer_resource (const CL_String &resource_id, int default_value) |
Returns the value of an integer resource. (using the value attribute). | |
CL_String | get_string_resource (const CL_String &resource_id, const CL_StringRef &default_value) |
Returns the value of an string resource. (using the value attribute). | |
Operations | |
CL_ResourceManager & | operator= (const CL_ResourceManager ©) |
bool | operator== (const CL_ResourceManager &manager) const |
void | set_directory (const CL_VirtualDirectory &directory) |
Set the resource data directory. | |
void | add_resources (const CL_ResourceManager &additional_resources) |
Add resources from an other resource manager. | |
void | remove_resources (const CL_ResourceManager &additional_resources) |
Remove resources from an other resource manager. | |
CL_Resource | create_resource (const CL_String &resource_id, const CL_String &type) |
Construct a new resource object. | |
void | destroy_resource (const CL_String &resource_id) |
Destroy resource object. | |
void | save (const CL_String &filename) |
Save resource XML tree to file. | |
void | save (const CL_String &filename, CL_VirtualDirectory directory) |
Save. | |
void | save (CL_IODevice file) |
Save. | |
void | load (const CL_String &filename) |
Load resource XML tree from file. | |
void | load (const CL_String &filename, CL_VirtualDirectory directory) |
Load. | |
void | load (CL_IODevice file, CL_VirtualDirectory directory=CL_VirtualDirectory()) |
Load. | |
Implementation | |
| |
class | CL_Resource |
Resource Manager.
CL_ResourceManager::CL_ResourceManager | ( | ) |
Construct a resource manager.
CL_ResourceManager::CL_ResourceManager | ( | const CL_String & | filename | ) |
Constructs a ResourceManager.
filename | = String |
CL_ResourceManager::CL_ResourceManager | ( | const CL_String & | filename, | |
CL_VirtualDirectory | directory | |||
) |
Constructs a ResourceManager.
filename | = String | |
directory | = Virtual Directory |
CL_ResourceManager::CL_ResourceManager | ( | CL_IODevice | file, | |
CL_VirtualDirectory | directory = CL_VirtualDirectory() | |||
) |
Constructs a ResourceManager.
file | = IODevice | |
directory | = Virtual Directory |
CL_ResourceManager::CL_ResourceManager | ( | const CL_ResourceManager & | other | ) |
Constructs a ResourceManager.
other | = Resource Manager |
CL_ResourceManager::~CL_ResourceManager | ( | ) |
void CL_ResourceManager::add_resources | ( | const CL_ResourceManager & | additional_resources | ) |
Add resources from an other resource manager.
This function only makes the resource manager search other managers, it does not copy the resources into this manager.
CL_Resource CL_ResourceManager::create_resource | ( | const CL_String & | resource_id, | |
const CL_String & | type | |||
) |
Construct a new resource object.
void CL_ResourceManager::destroy_resource | ( | const CL_String & | resource_id | ) |
Destroy resource object.
bool CL_ResourceManager::get_boolean_resource | ( | const CL_String & | resource_id, | |
bool | default_value | |||
) |
Returns the value of a boolean resource. (using the value attribute).
CL_VirtualDirectory CL_ResourceManager::get_directory | ( | const CL_Resource & | resource | ) | const |
Returns the directory to load resource data from.
int CL_ResourceManager::get_integer_resource | ( | const CL_String & | resource_id, | |
int | default_value | |||
) |
Returns the value of an integer resource. (using the value attribute).
CL_Resource CL_ResourceManager::get_resource | ( | const CL_String & | resource_id, | |
bool | resolve_alias = true , |
|||
int | reserved = 0 | |||
) |
Returns CL_Resource representing the given resource.
std::vector<CL_String> CL_ResourceManager::get_resource_names | ( | ) | const |
Returns a list of all resources available.
The returned resources are in the form "section/subsection/.../resourcename".
std::vector<CL_String> CL_ResourceManager::get_resource_names_of_type | ( | const CL_String & | type | ) | const |
Returns a list of all resources available matching a given type.
The returned resources are in the form "section/subsection/.../resourcename".
std::vector<CL_String> CL_ResourceManager::get_resource_names_of_type | ( | const CL_String & | type, | |
const CL_String & | section | |||
) | const |
std::vector<CL_String> CL_ResourceManager::get_section_names | ( | ) | const |
Returns all the resource sections available.
CL_String CL_ResourceManager::get_string_resource | ( | const CL_String & | resource_id, | |
const CL_StringRef & | default_value | |||
) |
Returns the value of an string resource. (using the value attribute).
void CL_ResourceManager::load | ( | const CL_String & | filename, | |
CL_VirtualDirectory | directory | |||
) |
Load.
filename | = the filename to save | |
directory | = Virtual Directory |
void CL_ResourceManager::load | ( | CL_IODevice | file, | |
CL_VirtualDirectory | directory = CL_VirtualDirectory() | |||
) |
Load.
file | = the file to load | |
directory | = Virtual Directory |
void CL_ResourceManager::load | ( | const CL_String & | filename | ) |
Load resource XML tree from file.
CL_ResourceManager& CL_ResourceManager::operator= | ( | const CL_ResourceManager & | copy | ) |
bool CL_ResourceManager::operator== | ( | const CL_ResourceManager & | manager | ) | const |
void CL_ResourceManager::remove_resources | ( | const CL_ResourceManager & | additional_resources | ) |
Remove resources from an other resource manager.
bool CL_ResourceManager::resource_exists | ( | const CL_String & | resource_id | ) | const |
Returns true if a resource exists.
void CL_ResourceManager::save | ( | const CL_String & | filename, | |
CL_VirtualDirectory | directory | |||
) |
Save.
filename | = the filename to save | |
directory | = Virtual Directory |
void CL_ResourceManager::save | ( | const CL_String & | filename | ) |
Save resource XML tree to file.
void CL_ResourceManager::save | ( | CL_IODevice | file | ) |
Save.
file | = IODevice |
void CL_ResourceManager::set_directory | ( | const CL_VirtualDirectory & | directory | ) |
Set the resource data directory.
friend class CL_Resource [friend] |