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

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>

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

Static Public Member Functions

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)
 

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, 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

Member Function Documentation

◆ AddResolver()

void AddResolver ( ResourceResolver * resolver)
static

◆ CheckAndUnzipResource()

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

Same as ResolveResource(xx,xx, true)


Fn: ResourceResolver::CheckAndUnzipResource(const String& resource, const std::function<void(bool, const String&)>& on_finished);

Parameters: resource - The resource to be resolved. on_finished - he 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()

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

Member Data Documentation

◆ s_resolvers

Buffer< ResourceResolver * > s_resolvers
staticprotected

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