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]

Friends

class Resource


Constructor & Destructor Documentation

ResourceServer::ResourceServer ( const char *  id  ) 

Constructor.

ResourceServer::~ResourceServer (  )  [virtual]

Destructor.


Member Function Documentation

Resource * ResourceServer::FindResource ( const string &  path,
Resource::Type  type 
)

Finds a resource object by resource type and path.

Parameters:
path the res name
type resource type
Returns:
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.

Parameters:
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.
Returns:
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.

Parameters:
type Resource type.
Returns:
True if all resources loaded correctly.

bool ResourceServer::LoadAllResources (  )  [inline]

void ResourceServer::UnloadResources ( Resource::Type  type  ) 

Unload sall resources matching the given resource type.

Parameters:
type Resource type.

void ResourceServer::UnloadAllResources (  )  [inline]

Root * ResourceServer::GetResourceList ( Resource::Type  type  ) 

Returns the right resource root object for a given resource type.

Parameters:
type The resource type.
Returns:
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.

Parameters:
path Pointer to a resource name (usually a file path), or 0.
Returns:
Text identifier.

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

Counts the number of resources of a given type.

Parameters:
type Resource type.

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

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

Parameters:
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