Factory for resource loader tasks. More...
#include <kanzi/core.ui/resource/resource_loader_factory.hpp>
Public Types | |
typedef ResourceSharedPtr(* | LoaderCallback) (Domain *, string_view, KzbFile *, unique_ptr< ReadOnlyMemoryFile >) |
typedef map< const Metaclass *, LoaderCallback > | LoaderCallbackDictionary |
typedef ResourceManager::LoadTaskSharedPtr(* | LoadTaskFactoryFunction) (string_view, KzbFile *, unique_ptr< ReadOnlyMemoryFile >) |
typedef map< const Metaclass *, LoadTaskFactoryFunction > | LoadTaskFactoryDictionary |
Public Member Functions | |
ResourceLoaderFactory () | |
Constructor. More... | |
LoaderCallback | tryGetLoaderCallback (const Metaclass *metaclass) const |
Get loader callback for given metaclass. More... | |
LoaderCallback | getLoaderCallback (const Metaclass *metaclass) const |
Get loader callback for given metaclass. More... | |
bool | hasLoaderCallback (const Metaclass *metaclass) const |
Check if loader callback has been registered. More... | |
void | registerLoaderCallback (const Metaclass *metaclass, LoaderCallback callback) |
Register loader callback for a metaclass. More... | |
template<typename T > | |
void | registerLoaderCallback () |
Shorthand for registering loader callback for given type. More... | |
LoadTaskFactoryFunction | tryGetLoadTaskFactoryFunction (const Metaclass *metaclass) const |
Get load task factory function for given metaclass. More... | |
LoadTaskFactoryFunction | getLoadTaskFactoryFunction (const Metaclass *metaclass) const |
Get load task factory function for given metaclass. More... | |
bool | hasLoadTaskFactoryFunction (const Metaclass *metaclass) const |
Check if load task factory function has been registered. More... | |
void | registerLoadTaskFactoryFunction (const Metaclass *metaclass, LoadTaskFactoryFunction func) |
Register load task factory function for given metaclass. More... | |
template<typename T > | |
void | registerLoadTask () |
Shorthand for registering a generic load task factory function. More... | |
template<typename T > | |
void | registerResourceLoadTask () |
Shorthand for registering load task factory function for a resource. More... | |
Factory for resource loader tasks.
Tasks for resource loading are registered to the factory, that creates them as needed.
Existing resources may use default tasks and potentially override #loadFromKZB() method. New types of resources with new base classes require a new load task.
typedef ResourceSharedPtr(* kanzi::ResourceLoaderFactory::LoaderCallback) (Domain *, string_view, KzbFile *, unique_ptr< ReadOnlyMemoryFile >) |
typedef map<const Metaclass*, LoaderCallback> kanzi::ResourceLoaderFactory::LoaderCallbackDictionary |
typedef ResourceManager::LoadTaskSharedPtr(* kanzi::ResourceLoaderFactory::LoadTaskFactoryFunction) (string_view, KzbFile *, unique_ptr< ReadOnlyMemoryFile >) |
typedef map<const Metaclass*, LoadTaskFactoryFunction> kanzi::ResourceLoaderFactory::LoadTaskFactoryDictionary |
|
explicit |
Constructor.
|
inline |
Get loader callback for given metaclass.
Returns empty function pointer (0) if metaclass has not been registered.
metaclass | Metaclass to get callback for. |
|
inline |
Get loader callback for given metaclass.
Throws an error if metaclass has not been registered.
metaclass | Metaclass to get callback for. |
|
inline |
Check if loader callback has been registered.
metaclass | Metaclass to check. |
|
inline |
Register loader callback for a metaclass.
metaclass | Metaclass to register for. |
callback | Loader callback. |
|
inline |
Shorthand for registering loader callback for given type.
|
inline |
Get load task factory function for given metaclass.
Returns empty function pointer (0) if metaclass has not been registered.
Metaclass | to get load task factory function for. |
|
inline |
Get load task factory function for given metaclass.
Throws an error if metaclass has not been registered.
Metaclass | to get load task factory function for. |
|
inline |
Check if load task factory function has been registered.
metaclass | Metaclass to check. |
|
inline |
Register load task factory function for given metaclass.
metaclass | Metaclass to register for. |
func | Load task factory function. |
|
inline |
Shorthand for registering a generic load task factory function.
|
inline |
Shorthand for registering load task factory function for a resource.