49 for (
auto &res : resources)
51 p->resources.emplace(res.name,res);
57 for (
auto &[name,res] :
p->resources)
59 if (res.category==categoryName)
61 QCString pathName = targetDir+
"/"+res.name;
66 f.write(
reinterpret_cast<const char *
>(res.data),res.size);
71 err(
"Failed to write resource '{}' to directory '{}'\n",res.name,targetDir);
81 QCString pathName = targetDir+
"/"+targetName;
93 f.write(
reinterpret_cast<const char *
>(res->
data),res->
size);
117 err(
"requested resource '{}' not compiled in!\n",name);
129 auto it =
p->resources.find(name.
str());
130 if (it!=
p->resources.end())
return &it->second;
This is an alternative implementation of QCString.
char * rawData()
Returns a writable pointer to the data.
const std::string & str() const
std::map< std::string, Resource > resources
static ResourceMgr & instance()
Returns the one and only instance of this class.
const Resource * get(const QCString &name) const
Returns a pointer to the resource object with the given name.
bool copyResource(const QCString &name, const QCString &targetDir) const
Copies a registered resource to a given target directory.
bool writeCategory(const QCString &categoryName, const QCString &targetDir) const
Writes all resource belonging to a given category to a given target directory.
QCString getAsString(const QCString &name) const
Gets the resource data as a C string.
bool copyResourceAs(const QCString &name, const QCString &targetDir, const QCString &targetName, bool append=false) const
Copies a registered resource to a given target directory under a given target name.
std::unique_ptr< Private > p
void registerResources(std::initializer_list< Resource > resources)
Registers an array of resources.
std::ofstream openOutputStream(const QCString &name, bool append=false)
Portable versions of functions that are platform dependent.
const unsigned char * data
QCString replaceColorMarkers(const QCString &str)
Replaces any markers of the form ##AA in input string str by new markers of the form #AABBCC,...
A bunch of utility functions.