Bromeon
Namespaces | Classes | Functions | Defines
Resources

Provides a resource manager for various resource types as well as the possibility to access them safely. More...

Namespaces

namespace  thor::Resources
 Namespace for resource-specific functionality.

Classes

class  thor::ResourceManager< Resource, ResourceKey >
 Class that is responsible for the management of resources like images, fonts or music. More...
class  thor::ResourcePtr< Resource >
 Reference-counted smart pointer allowing safe access to resources. More...

Functions

template<class Resource >
void thor::swap (ResourcePtr< Resource > &lhs, ResourcePtr< Resource > &rhs)
 Swaps both ResourcePtr objects.
template<class Resource1 , class Resource2 >
bool thor::operator== (const ResourcePtr< Resource1 > &lhs, const ResourcePtr< Resource2 > &rhs)
 Equality comparison operator.
template<class Resource1 , class Resource2 >
bool thor::operator!= (const ResourcePtr< Resource1 > &lhs, const ResourcePtr< Resource2 > &rhs)
 Inequality comparison operator.
template<class Resource >
ResourcePtr< Resource > thor::NoDeletePtr (Resource *pointer)
 Returns a ResourcePtr that doesn't own the resource.

Defines

#define THOR_MAP_RESOURCEKEY(Resource, ResourceKey)
 Macro that maps resources to their default resource key.

Detailed Description

Provides a resource manager for various resource types as well as the possibility to access them safely.


Function Documentation

template<class Resource >
ResourcePtr< Resource > NoDeletePtr ( Resource *  pointer) [related]

Returns a ResourcePtr that doesn't own the resource.

The returned smart pointer will not call the delete operator, so do not pass objects allocated with new. The caller must make sure that the passed pointer is valid as long as it is referenced in the ResourcePtr. This allows to store local and static objects in ResourcePtr instances.

Returns:
This function returns ResourcePtr <Resource>(pointer, nullDeleter) where nullDeleter is a functor without any effect.
template<class Resource1 , class Resource2 >
bool operator!= ( const ResourcePtr< Resource1 > &  lhs,
const ResourcePtr< Resource2 > &  rhs 
) [related]

Inequality comparison operator.

Returns false when lhs and rhs share the same resource or are both NULL, and true otherwise. Resource1 and Resource2 may only differ in const-qualification, apart from that the types must be the same.

template<class Resource1 , class Resource2 >
bool operator== ( const ResourcePtr< Resource1 > &  lhs,
const ResourcePtr< Resource2 > &  rhs 
) [related]

Equality comparison operator.

Returns true when lhs and rhs share the same resource or are both NULL, and false otherwise. Resource1 and Resource2 may only differ in const-qualification, apart from that the types must be the same.


Define Documentation

#define THOR_MAP_RESOURCEKEY (   Resource,
  ResourceKey 
)

Macro that maps resources to their default resource key.

This macro creates a specialization of thor::Resources::KeyTraits. You can use the macro in the global namespace to define a default ResourceKey for a given Resource class. Then, you don't have to specify the thor::ResourceManager's second template parameter anymore.