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