File include/brisk/core/Resources.hpp
¶
EResources
class¶
EResources
Resources
class¶
Resources
ResourcesProvides utility functions for managing resource files.
This class allows checking for resource existence, enumerating available resources, and loading resources as raw bytes or text, with optional caching.
exists
function (Resources::exists
)¶
static bool exists(std::string_view name)
Checks if a resource exists.
Param name
The name of the resource to check.
Returns True if the resource exists, false otherwise.
enumerate
function (Resources::enumerate
)¶
static std::vector<std::string_view> enumerate()
Retrieves a list of all available resource names.
Returns A vector of resource names.
load
function (Resources::load
)¶
static Bytes load(std::string_view name,
bool emptyOk = false)
Loads a resource as raw bytes.
Param name
The name of the resource to load.
Param emptyOk
If true, allows returning an empty byte vector if the resource is missing.
Returns A byte vector containing the resource data.
Exceptions if the resource does not exist and emptyOk is false.
loadCached
function (Resources::loadCached
)¶
static const Bytes &loadCached(std::string name,
bool emptyOk = false)
Loads a resource as raw bytes with caching.
Param name
The name of the resource to load.
Param emptyOk
If true, allows returning an empty byte vector if the resource is missing.
Returns A reference to a cached byte vector containing the resource data.
Exceptions if the resource does not exist and emptyOk is false.
loadText
function (Resources::loadText
)¶
static std::string loadText(std::string_view name,
bool emptyOk = false)
Loads a resource as a text string.
Param name
The name of the resource to load.
Param emptyOk
If true, allows returning an empty string if the resource is missing.
Returns A string containing the resource data.
Exceptions if the resource does not exist and emptyOk is false.
loadTextCached
function (Resources::loadTextCached
)¶
static const std::string &
loadTextCached(std::string name, bool emptyOk = false)
Loads a resource as a text string with caching.
Param name
The name of the resource to load.
Param emptyOk
If true, allows returning an empty string if the resource is missing.
Returns A reference to a cached string containing the resource data.
Exceptions if the resource does not exist and emptyOk is false.
Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/