ClanLib  2.3.7
List of all members
CL_ResourceManager Class Reference

Resource Manager. More...

#include <resource_manager.h>

Public Member Functions

Construction
 CL_ResourceManager ()
 Construct a resource manager. More...
 
 CL_ResourceManager (const CL_String &filename)
 Constructs a ResourceManager. More...
 
 CL_ResourceManager (const CL_String &filename, CL_VirtualDirectory directory)
 Constructs a ResourceManager. More...
 
 CL_ResourceManager (CL_IODevice file, CL_VirtualDirectory directory=CL_VirtualDirectory())
 Constructs a ResourceManager. More...
 
 CL_ResourceManager (const CL_ResourceManager &other)
 Constructs a ResourceManager. More...
 
 ~CL_ResourceManager ()
 
Attributes
bool resource_exists (const CL_String &resource_id) const
 Returns true if a resource exists. More...
 
std::vector< CL_Stringget_section_names () const
 Returns all the resource sections available. More...
 
std::vector< CL_Stringget_resource_names () const
 Returns a list of all resources available. More...
 
std::vector< CL_Stringget_resource_names (const CL_String &section) const
 
std::vector< CL_Stringget_resource_names_of_type (const CL_String &type) const
 Returns a list of all resources available matching a given type. More...
 
std::vector< CL_Stringget_resource_names_of_type (const CL_String &type, const CL_String &section) const
 
CL_Resource get_resource (const CL_String &resource_id, bool resolve_alias=true, int reserved=0)
 Returns CL_Resource representing the given resource. More...
 
CL_VirtualDirectory get_directory (const CL_Resource &resource) const
 Returns the directory to load resource data from. More...
 
bool get_boolean_resource (const CL_String &resource_id, bool default_value)
 Returns the value of a boolean resource. (using the value attribute) More...
 
int get_integer_resource (const CL_String &resource_id, int default_value)
 Returns the value of an integer resource. (using the value attribute) More...
 
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) More...
 
Operations
CL_ResourceManageroperator= (const CL_ResourceManager &copy)
 
bool operator== (const CL_ResourceManager &manager) const
 
void set_directory (const CL_VirtualDirectory &directory)
 Set the resource data directory. More...
 
void add_resources (const CL_ResourceManager &additional_resources)
 Add resources from an other resource manager. More...
 
void remove_resources (const CL_ResourceManager &additional_resources)
 Remove resources from an other resource manager. More...
 
CL_Resource create_resource (const CL_String &resource_id, const CL_String &type)
 Construct a new resource object. More...
 
void destroy_resource (const CL_String &resource_id)
 Destroy resource object. More...
 
void save (const CL_String &filename)
 Save resource XML tree to file. More...
 
void save (const CL_String &filename, CL_VirtualDirectory directory)
 Save. More...
 
void save (CL_IODevice file)
 Save. More...
 
void load (const CL_String &filename)
 Load resource XML tree from file. More...
 
void load (const CL_String &filename, CL_VirtualDirectory directory)
 Load. More...
 
void load (CL_IODevice file, CL_VirtualDirectory directory=CL_VirtualDirectory())
 Load. More...
 

Implementation

class CL_Resource
 

Detailed Description

Resource Manager.

Constructor & Destructor Documentation

CL_ResourceManager::CL_ResourceManager ( )

Construct a resource manager.

CL_ResourceManager::CL_ResourceManager ( const CL_String filename)

Constructs a ResourceManager.

Parameters
filename= String
CL_ResourceManager::CL_ResourceManager ( const CL_String filename,
CL_VirtualDirectory  directory 
)

Constructs a ResourceManager.

Parameters
filename= String
directory= Virtual Directory
CL_ResourceManager::CL_ResourceManager ( CL_IODevice  file,
CL_VirtualDirectory  directory = CL_VirtualDirectory() 
)

Constructs a ResourceManager.

Parameters
file= IODevice
directory= Virtual Directory
CL_ResourceManager::CL_ResourceManager ( const CL_ResourceManager other)

Constructs a ResourceManager.

Parameters
other= Resource Manager
CL_ResourceManager::~CL_ResourceManager ( )

Member Function Documentation

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 ( const CL_String section) const
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)

Load resource XML tree from file.

void CL_ResourceManager::load ( const CL_String filename,
CL_VirtualDirectory  directory 
)

Load.

Parameters
filename= the filename to save
directory= Virtual Directory
void CL_ResourceManager::load ( CL_IODevice  file,
CL_VirtualDirectory  directory = CL_VirtualDirectory() 
)

Load.

Parameters
file= the file to load
directory= Virtual Directory
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)

Save resource XML tree to file.

void CL_ResourceManager::save ( const CL_String filename,
CL_VirtualDirectory  directory 
)

Save.

Parameters
filename= the filename to save
directory= Virtual Directory
void CL_ResourceManager::save ( CL_IODevice  file)

Save.

Parameters
file= IODevice
void CL_ResourceManager::set_directory ( const CL_VirtualDirectory directory)

Set the resource data directory.

Friends And Related Function Documentation

friend class CL_Resource
friend

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