List of all members | Public Types | Public Member Functions
thor::ResourceLoader< R > Class Template Reference

Class storing loading information for resources. More...

Public Types

typedef std::function< std::unique_ptr< R >) > Loader
 Function type to load a resource.
 

Public Member Functions

 ResourceLoader (std::function< std::unique_ptr< R >() > loader, std::string id)
 Constructor. More...
 
std::unique_ptr< R > load () const
 Loads a resource. More...
 
std::string getInfo () const
 Returns a string describing the resource loader.
 

Detailed Description

template<class R>
class thor::ResourceLoader< R >

Class storing loading information for resources.

Constructor & Destructor Documentation

template<class R>
thor::ResourceLoader< R >::ResourceLoader ( std::function< std::unique_ptr< R >() >  loader,
std::string  id 
)

Constructor.

Parameters
loaderFunction returning a unique_ptr<R>. Shall return a unique pointer to the resource if it has been loaded, and nullptr in case of loading failure. The function shall not throw any exceptions.
idIdentifier which is equal to another identifier if and only if the key refers to the same resource. Can also contain debug information in case of loading failures.

Member Function Documentation

template<class R>
std::unique_ptr<R> thor::ResourceLoader< R >::load ( ) const

Loads a resource.

Returns
Unique pointer to resource if loaded, nullptr in case of loading failure.

The documentation for this class was generated from the following file: