This class resolves resources, or data identified by a string. The data absolute path is then passed on to an on_finished function. Resources may be online, in a packed file, or in a spot not easily accessable. static Class stores any number of resolvers who take in a resource, and try to find it.
More...
#include <ResourceResolver.h>
|
static bool | ResolveResource (const String &resource, const std::function< void(bool, const String &)> &on_finished=nullptr, bool ensure_unzipped=false) |
| Attempts to resolved a resource. Resource could be in an online or offline database, inside a resource or rcc file, or in a local file. Funciton is ascynchronous and resource may not be resolved on return. on_finished is used as a callback for when the resource is resolved, or fails to resolve.
|
|
static bool | CheckAndUnzipResource (const String &resource, const std::function< void(bool, const String &)> &on_finished=nullptr) |
| Same as ResolveResource(xx,xx, true)
|
|
static void | AddResolver (ResourceResolver *resolver) |
|
|
virtual bool | resolveResource (const String &resource, const std::function< void(bool, const String &)> &on_finished=nullptr, bool ensure_unzipped=false)=0 |
|
This class resolves resources, or data identified by a string. The data absolute path is then passed on to an on_finished function. Resources may be online, in a packed file, or in a spot not easily accessable. static Class stores any number of resolvers who take in a resource, and try to find it.
Class: ResourceResolver
Author: Tyler Parke
Date: 2024-11-15
◆ AddResolver()
◆ CheckAndUnzipResource()
bool CheckAndUnzipResource |
( |
const String & | resource, |
|
|
const std::function< void(bool, const String &)> & | on_finished = nullptr ) |
|
static |
◆ ResolveResource()
bool ResolveResource |
( |
const String & | resource, |
|
|
const std::function< void(bool, const String &)> & | on_finished = nullptr, |
|
|
bool | ensure_unzipped = false ) |
|
static |
Attempts to resolved a resource. Resource could be in an online or offline database, inside a resource or rcc file, or in a local file. Funciton is ascynchronous and resource may not be resolved on return. on_finished is used as a callback for when the resource is resolved, or fails to resolve.
Fn: ResourceResolver::resolveResource(const String& resource, const std::function<void(bool, const String&)>& on_finished, bool ensure_unzipped);
Parameters: resource - The resource to be resolved. on_finished - The callback which will be called, likely asyncronously, when the resource is resolved. The first parameter is a bool representing success, the second is a string with the absolute resource location. ensure_unzipped - If true, the resource will be unzipped and placed in a path where it can be instantly accessed. If true, the second parameter will be a file path.
Returns: true if the resource MAY be resolved, false if it will certainly not be resolved.
Date: 2024-11-15
◆ resolveResource()
virtual bool resolveResource |
( |
const String & | resource, |
|
|
const std::function< void(bool, const String &)> & | on_finished = nullptr, |
|
|
bool | ensure_unzipped = false ) |
|
protectedpure virtual |
◆ s_resolvers
The documentation for this class was generated from the following files: