Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_Resource

Interface representing a resource in the resource manager.
Contained in: global
Derived from: none
Derived by: none
Group: Core (Resources)

#include <ClanLib/core.h>

### public function member index:

### Construction:

`` | `CL_Resource` | `(`const` `std::string`& `type`, `const` `std::string`& `name`, `const` `std::string`& `location`, `const` `CL_ResourceOptions`& `options`, `const` `CL_ResourceManager`& `manager`)`;
`` | `CL_Resource` | `(`const` `CL_Resource`& `copy`)`;
`` | `CL_Resource` | `()`;
``virtual`` | `~CL_Resource` | `()`;

### Attributes:

``const` `std::string`&` | `get_type` | `() `const``;
``const` `std::string`&` | `get_name` | `() `const``;
``const` `std::string`&` | `get_location` | `() `const``;
``std::string`` | `get_full_location` | `() `const``;
``CL_ResourceOptions`&` | `get_options` | `()`;
``CL_ResourceManager`` | `get_manager` | `()`;
``CL_ResourceData`*` | `get_data` | `(`const` `std::string`& `name`)`;
``int`` | `get_reference_count` | `() `const``;

### Signals:

``CL_Signal_v0`&` | `sig_load_file` | `()`;
``CL_Signal_v1`<`CL_InputSourceProvider`* >&` | `sig_load_datafile` | `()`;
``CL_Signal_v1`<`CL_OutputSourceProvider`* >&` | `sig_save_datafile` | `()`;
``CL_Signal_v0`&` | `sig_unload` | `()`;

### Operators:

``void`` | `operator``=` | `(`const` `CL_Resource`& `copy`)`;

### Operations:

``void`` | `attach_data` | `(`const` `std::string`& `name`, `CL_ResourceData`* `data`)`;
``void`` | `detach_data` | `(`CL_ResourceData`* `data`)`;
``void`` | `unload` | `()`;
``void`` | `load` | `()`;
``void`` | `load_file` | `()`;
``void`` | `load_datafile` | `(`CL_InputSourceProvider`* `input_provider`)`;
``void`` | `save_datafile` | `(`CL_OutputSourceProvider`* `output_provider`)`;

### Implementation:

`` | `CL_Resource` | `(`class` `CL_Resource_Generic`* `impl`)`;

## Description:

## Function Member Descriptions:

CL_Resource::CL_Resource - Resource Constructor
`` `CL_Resource` `(`const` `std::string`& `type`, `const` `std::string`& `name`, `const` `std::string`& `location`, `const` `CL_ResourceOptions`& `options`, `const` `CL_ResourceManager`& `manager`)`;

CL_Resource::CL_Resource - Resource Constructor
`` `CL_Resource` `(`const` `CL_Resource`& `copy`)`;

CL_Resource::CL_Resource - Resource Constructor
`` `CL_Resource` `()`;

CL_Resource::CL_Resource - Resource Constructor
`` `CL_Resource` `(`class` `CL_Resource_Generic`* `impl`)`;

CL_Resource::attach_data - Attach some data to the resource.
``void`` `attach_data` `(`const` `std::string`& `name`, `CL_ResourceData`* `data`)`;

CL_Resource::detach_data - Detach some data from the resource.
``void`` `detach_data` `(`CL_ResourceData`* `data`)`;

CL_Resource::get_data - Returns the data with the matching name.
``CL_ResourceData`*` `get_data` `(`const` `std::string`& `name`)`;

CL_Resource::get_full_location - Returns the full path location of the resource.
Use this function if file is to be opened without ClanLib input sources.
``std::string`` `get_full_location` `() `const``;

CL_Resource::get_location - Returns the location of the resource (relative to resource definition file).
Use this function if file is to be opened with CL_ResourceManager::get_resource_provider().
``const` `std::string`&` `get_location` `() `const``;

CL_Resource::get_manager - Returns the resource manager.
``CL_ResourceManager`` `get_manager` `()`;

CL_Resource::get_name - Returns the name of the resource.
``const` `std::string`&` `get_name` `() `const``;

CL_Resource::get_options - Returns the resource options.
``CL_ResourceOptions`&` `get_options` `()`;

CL_Resource::get_reference_count - Returns the current reference count.
``int`` `get_reference_count` `() `const``;

CL_Resource::get_type - Returns the type of the resource.
``const` `std::string`&` `get_type` `() `const``;

CL_Resource::load - Loads the resource, using the prefered source as specified by the resource manager.
``void`` `load` `()`;

CL_Resource::load_datafile - Loads the resource from the input source.
``void`` `load_datafile` `(`CL_InputSourceProvider`* `input_provider`)`;

CL_Resource::load_file - Loads the resource from file.
``void`` `load_file` `()`;

CL_Resource::operator = - Copy a resource.
``void`` `operator``=` `(`const` `CL_Resource`& `copy`)`;

CL_Resource::save_datafile - Saves the resource to the output source.
``void`` `save_datafile` `(`CL_OutputSourceProvider`* `output_provider`)`;

CL_Resource::sig_load_datafile - Signal invoked when a call to load_datafile is made.
``CL_Signal_v1`<`CL_InputSourceProvider`* >&` `sig_load_datafile` `()`;

CL_Resource::sig_load_file - Signal invoked when a call to load_file is made.
``CL_Signal_v0`&` `sig_load_file` `()`;

CL_Resource::sig_save_datafile - Signal invoked when a call to save_datafile is made.
``CL_Signal_v1`<`CL_OutputSourceProvider`* >&` `sig_save_datafile` `()`;

CL_Resource::sig_unload - Signal invoked when a call to unload is made.
``CL_Signal_v0`&` `sig_unload` `()`;

CL_Resource::unload - Unloads the resource from memory.
``void`` `unload` `()`;

CL_Resource::~CL_Resource - Resource Destructor
``virtual`` `~CL_Resource` `()`;

## Variable Member Descriptions:

CL_Resource::impl - Pointer to implementation
``CL_Resource_Generic` *` ``impl`;`