#include <resourceserver.h>

Resources are objects which provide several types of data (or data streams) to the application, and can unload and reload themselves on request.
Public Member Functions | |
| ResourceServer (const char *id) | |
| virtual | ~ResourceServer () |
| Resource * | FindResource (const string &path, Resource::Type type) |
| Resource * | NewResource (const char *class_name, const string &path, Resource::Type type, const char *modifier=NULL) |
| Resource * | NewResource (const char *class_name, DataFile *data_file, Resource::Type type, const char *modifier=NULL) |
| bool | LoadResources (Resource::Type type) |
| bool | LoadAllResources () |
| void | UnloadResources (Resource::Type type) |
| void | UnloadAllResources () |
| Root * | GetResourceList (Resource::Type type) |
| string | GetResourceId (const string &path) |
| ushort_t | GetResourcesCount (Resource::Type type) |
| uint_t | GetResourcesSize (Resource::Type type) |
| ushort_t | GetAllResourcesCount () |
| uint_t | GetAllResourcesSize () |
Protected Attributes | |
| Ref< Root > | resources [Resource::RES_COUNT] |
Friends | |
| class | Resource |
| ResourceServer::ResourceServer | ( | const char * | id | ) |
Constructor.
| ResourceServer::~ResourceServer | ( | ) | [virtual] |
Destructor.
| Resource * ResourceServer::FindResource | ( | const string & | path, | |
| Resource::Type | type | |||
| ) |
Finds a resource object by resource type and path.
| path | the res name | |
| type | resource type |
| Resource * ResourceServer::NewResource | ( | const char * | class_name, | |
| const string & | file_name, | |||
| Resource::Type | type, | |||
| const char * | modifier = NULL | |||
| ) |
Creates a new possible shared resource object. Bumps pointers count on an existing resource object. Pass a zero path if a (non-shared) resource should be created.
| class_name | Class name. | |
| file_name | The resource file_name (for resource sharing), can be empty. | |
| type | Resource type. | |
| modifier | Modifier is added at the end of resource identifier. |
| Resource * ResourceServer::NewResource | ( | const char * | class_name, | |
| DataFile * | data_file, | |||
| Resource::Type | type, | |||
| const char * | modifier = NULL | |||
| ) |
| bool ResourceServer::LoadResources | ( | Resource::Type | type | ) |
Loads all resources matching the given resource type. Returns false if any of the resources didn't load correctly.
| type | Resource type. |
True if all resources loaded correctly. | bool ResourceServer::LoadAllResources | ( | ) | [inline] |
| void ResourceServer::UnloadResources | ( | Resource::Type | type | ) |
| void ResourceServer::UnloadAllResources | ( | ) | [inline] |
| Root * ResourceServer::GetResourceList | ( | Resource::Type | type | ) |
Returns the right resource root object for a given resource type.
| type | The resource type. |
| string ResourceServer::GetResourceId | ( | const string & | path | ) |
Creates a resource id from a resource name. The resource name is usually just the filename of the resource file. The method strips off the last 32 characters from the resource name, and replaces any invalid characters with underscores. It is valid to provide a 0-path for unshared resources. A unique res identifier string will then be created.
| path | Pointer to a resource name (usually a file path), or 0. |
| ushort_t ResourceServer::GetResourcesCount | ( | Resource::Type | type | ) |
| uint_t ResourceServer::GetResourcesSize | ( | Resource::Type | type | ) |
| ushort_t ResourceServer::GetAllResourcesCount | ( | ) | [inline] |
| uint_t ResourceServer::GetAllResourcesSize | ( | ) | [inline] |
friend class Resource [friend] |
Ref<Root> ResourceServer::resources[Resource::RES_COUNT] [protected] |
1.5.3