NDEVR
API Documentation
ResourceResolverabstract

Resolves resource identifiers to absolute file paths, supporting online, packed, and local sources. More...

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

Static Public Member Functions

static void AddResolver (ResourceResolver *resolver)
 Registers a new ResourceResolver instance to the global list of resolvers.
static bool CheckAndUnzipNDEVRResource (const StringView &resource, const std::function< void(bool, const StringView &)> &on_finished=nullptr)
 Same as ResolveNDEVRResource(xx, xx, true).
static bool CheckAndUnzipResource (const StringView &resource, const std::function< void(bool, const StringView &)> &on_finished=nullptr)
 Same as ResolveResource(xx,xx, true).
static bool ResolveNDEVRResource (const StringView &resource, const std::function< void(bool, const StringView &)> &on_finished=nullptr, bool ensure_unzipped=false)
 Attempts to resolved an NDEVR resource.
static bool ResolveResource (const StringView &resource, const std::function< void(bool, const StringView &)> &on_finished=nullptr, bool ensure_unzipped=false)
 Attempts to resolved a resource.

Protected Member Functions

virtual bool resolveNDEVRResource (const StringView &resource, const std::function< void(bool, const StringView &)> &on_finished=nullptr, bool ensure_unzipped=false)=0
 Subclass implementation for resolving an NDEVR shared resource.
virtual bool resolveResource (const StringView &resource, const std::function< void(bool, const StringView &)> &on_finished=nullptr, bool ensure_unzipped=false)=0
 Subclass implementation for resolving a resource.

Static Protected Attributes

static Buffer< ResourceResolver * > s_resolvers
 Global list of registered ResourceResolver instances used to attempt resource resolution.

Detailed Description

Resolves resource identifiers to absolute file paths, supporting online, packed, and local sources.


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

Definition at line 19 of file ResourceResolver.h.

Member Function Documentation

◆ AddResolver()

void ResourceResolver::AddResolver ( ResourceResolver * resolver)
static

Registers a new ResourceResolver instance to the global list of resolvers.

Parameters
[in]resolverThe resolver to add to the internal resolver list.

◆ CheckAndUnzipNDEVRResource()

bool ResourceResolver::CheckAndUnzipNDEVRResource ( const StringView & resource,
const std::function< void(bool, const StringView &)> & on_finished = nullptr )
static

Same as ResolveNDEVRResource(xx, xx, true).


Resolves an NDEVR resource and ensures it is unzipped to a shared path for direct file access.

Parameters
[in]resourceThe NDEVR resource to be resolved.
[in]on_finishedThe callback which will be called, likely asynchronously, 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.

◆ CheckAndUnzipResource()

bool ResourceResolver::CheckAndUnzipResource ( const StringView & resource,
const std::function< void(bool, const StringView &)> & 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

◆ ResolveNDEVRResource()

bool ResourceResolver::ResolveNDEVRResource ( const StringView & resource,
const std::function< void(bool, const StringView &)> & on_finished = nullptr,
bool ensure_unzipped = false )
static

Attempts to resolved an NDEVR resource.


Resource could be in an online or offline database, inside a resource or rcc file, or in a local file. Function 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 to NDEVR shared program folder.
[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 shared 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

◆ resolveNDEVRResource()

virtual bool ResourceResolver::resolveNDEVRResource ( const StringView & resource,
const std::function< void(bool, const StringView &)> & on_finished = nullptr,
bool ensure_unzipped = false )
protectedpure virtual

Subclass implementation for resolving an NDEVR shared resource.

Called by the static ResolveNDEVRResource method on each registered resolver until one succeeds.

Parameters
[in]resourceThe NDEVR resource identifier to resolve.
[in]on_finishedAsynchronous callback invoked with success status and the resolved path.
[in]ensure_unzippedIf true, ensures the resource is unzipped to a directly accessible file path.
Returns
true if this resolver may be able to resolve the resource, false otherwise.

◆ ResolveResource()

bool ResourceResolver::ResolveResource ( const StringView & resource,
const std::function< void(bool, const StringView &)> & 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. Function 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

Referenced by QtVulkanSession::readShader().

◆ resolveResource()

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

Subclass implementation for resolving a resource.

Called by the static ResolveResource method on each registered resolver until one succeeds.

Parameters
[in]resourceThe resource identifier to resolve.
[in]on_finishedAsynchronous callback invoked with success status and the resolved path.
[in]ensure_unzippedIf true, ensures the resource is unzipped to a directly accessible file path.
Returns
true if this resolver may be able to resolve the resource, false otherwise.

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