API Documentation
Loading...
Searching...
No Matches
ResourceResolver Class Referenceabstract

This class resolves resources data identified by a string. The data absolute path is then passed on to an on_finished function. More...

#include <ResourceResolver.h>

Inheritance diagram for ResourceResolver:
[legend]
Collaboration diagram for ResourceResolver:
[legend]

Static Public Member Functions

static void AddResolver (ResourceResolver *resolver)
 
static bool CheckAndUnzipResource (const String &resource, const std::function< void(bool, const String &)> &on_finished=nullptr)
 Same as ResolveResource(xx,xx, true)
 
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.
 

Protected Member Functions

virtual bool resolveResource (const String &resource, const std::function< void(bool, const String &)> &on_finished=nullptr, bool ensure_unzipped=false)=0
 

Static Protected Attributes

static Buffer< ResourceResolver * > s_resolvers
 

Detailed Description

This class resolves resources 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.

Author: Tyler Parke

Date: 2024-11-15

Member Function Documentation

◆ AddResolver()

static void AddResolver ( ResourceResolver * resolver)
static

◆ CheckAndUnzipResource()

static bool CheckAndUnzipResource ( const String & resource,
const std::function< void(bool, const String &)> & on_finished = nullptr )
static

Same as ResolveResource(xx,xx, true)


Parameters
[in]resource- The resource to be resolved.
[in]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.
Returns
true if the resource MAY be resolved, false if it will certainly not be resolved. Date: 2024-11-15

◆ ResolveResource()

static 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.


Parameters:

Parameters
[in]resource- The resource to be resolved.
[in]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.
[in]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

Member Data Documentation

◆ s_resolvers

Buffer<ResourceResolver*> s_resolvers
staticprotected

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