ResourceServer Class Reference
[Framework Module]

#include <resourceserver.h>

Inheritance diagram for ResourceServer:

RootServer< ResourceServer > Root Server< ResourceServer > Object TreeNode< Root > Referenced Counted Serialized List< Root > ListNode< Root >

List of all members.

Detailed Description

Central resource server. Creates and manages resource objects.

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 ()
ResourceFindResource (const string &path, Resource::Type type)
ResourceNewResource (const char *class_name, const string &path, Resource::Type type, const char *modifier=NULL)
ResourceNewResource (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 ()
RootGetResourceList (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< Rootresources [Resource::RES_COUNT]


class Resource

Constructor & Destructor Documentation

ResourceServer::ResourceServer ( const char *  id  ) 


ResourceServer::~ResourceServer (  )  [virtual]


Member Function Documentation

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
pointer to resource object, or 0 if not found

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.
Pointer to new resource object.

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  ) 

Unload sall resources matching the given resource type.

type Resource 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.
The root object.

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.
Text identifier.

ushort_t ResourceServer::GetResourcesCount ( Resource::Type  type  ) 

Counts the number of resources of a given type.

type Resource type.

uint_t ResourceServer::GetResourcesSize ( Resource::Type  type  ) 

Returns the number of bytes a resource type occupies in RAM.

type Resource type.

ushort_t ResourceServer::GetAllResourcesCount (  )  [inline]

uint_t ResourceServer::GetAllResourcesSize (  )  [inline]

Friends And Related Function Documentation

friend class Resource [friend]

Member Data Documentation

Ref<Root> ResourceServer::resources[Resource::RES_COUNT] [protected]

The documentation for this class was generated from the following files:
Generated on Sat Oct 20 14:47:35 2007 for Dark Oberon by  doxygen 1.5.3