16#include <egt/detail/meta.h>
55 void add(
const char* name,
const unsigned char* data,
size_t len);
60 void add(
const char* name,
const std::vector<unsigned char>& data);
80 size_t size(
const char* name);
85 const unsigned char*
data(
const char* name);
90 bool read(
const char* name,
unsigned char* data,
91 size_t length,
size_t offset = 0);
111 bool stream_read(
const char* name,
unsigned char* data,
size_t length);
119 using ResourceMap = std::map<std::string, ResourceItem>;
121 ResourceMap m_resources;
129cairo_status_t EGT_API read_resource_stream(
void* closure,
unsigned char* data,
130 unsigned int length);
Manages EGT resource data blobs.
Definition resource.h:37
bool stream_read(const char *name, unsigned char *data, size_t length)
Read starting from internal stream offset.
static ResourceManager & instance()
Get a reference to the ResourceManager instance.
std::vector< std::string > ItemArray
Item array type.
Definition resource.h:94
size_t size(const char *name)
Get the data length of a resource.
bool read(const char *name, unsigned char *data, size_t length, size_t offset=0)
Read data from a resource.
EGT_NODISCARD ItemArray list() const
Get a list of registered resource names.
void remove(const char *name)
Unregister a resource.
void stream_reset(const char *name)
Reset internal read stream offset.
void add(const char *name, const std::vector< unsigned char > &data)
Register a resource as raw data.
void clear(const char *name)
Clear the specified resource by name.
void clear()
Clear all registered resources.
const unsigned char * data(const char *name)
Get a pointer to the in-memory resource data.
bool exists(const char *name) const
void add(const char *name, const unsigned char *data, size_t len)
Register a resource as raw data.
EGT framework namespace.
Definition animation.h:24