![]() |
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. | |
std::unique_ptr< R > | load () const |
Loads a resource. | |
std::string | getInfo () const |
Returns a string describing the resource loader. |
Class storing loading information for resources.
thor::ResourceLoader< R >::ResourceLoader | ( | std::function< std::unique_ptr< R >() > | loader, |
std::string | id | ||
) |
Constructor.
loader | Function 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. |
id | Identifier 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. |
std::unique_ptr<R> thor::ResourceLoader< R >::load | ( | ) | const |
Loads a resource.