class Resource
Defined in:
The C4Resources.h
Resource
class encapsulates an individual data resource.
Definition
template <class type> class Resource : public ResourceBase
Member Functions
Resource::GetResource |
Returns a pointer to a resource object. |
Resource::Release |
Releases a resource object. |
Resource::GetResourceName |
Returns the name of a resource. |
Resource::GetResourceSize |
Returns the size of a resource. |
Resource::GetResourceData |
Returns a pointer to the data contained in a resource object. |
Resource::OpenLoader |
Opens a loader object for a particular resource. |
Resource::CloseLoader |
Closes a loader object. |
Resource::LoadResource |
Loads the data for a resource object. |
Template Parameters
type |
The type of the Resource subclass. This parameter should be the type of the class that inherits directly from the Resource class.
|
Constructor
Resource(const char *name, ResourceCatalog *catalog);
Parameters
name |
The resource name. |
catalog |
The catalog through which the resource is loaded. |
Description
The Resource
class template encapsulates an individual data resource of the type specified by the type
template parameter. Each type of resource is represented by an object of a class type derived from the Resource
class template, where the type
template parameter is the same as the type of the subclass.A new resource is created by calling the
Resource::GetResource
function. A resource is released by calling the Resource::Release
function. Resources are reference counted, so it is possible to acquire a pointer to the same resource object multiple times through calls to the GetResource
function. Each such call must be balanced by a matching call to the Release
function.
Base Classes
ResourceBase |
Used internally to encapsulate common functionality for all resource types. |
See Also