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 '%s' to directory '%s'\n",res.name,
qPrint(targetDir));
81 QCString pathName = targetDir+
"/"+targetName;
82 const Resource *res =
get(name);
93 f.write(
reinterpret_cast<const char *
>(res->
data),res->
size);
106 const uint8_t *data = res->
data;
107 uint16_t width = (data[0]<<8)+data[1];
108 uint16_t height = (data[2]<<8)+data[3];
109 ColoredImgDataItem images[2];
111 images[0].
width = width;
112 images[0].
height = height;
114 images[0].
alpha =
nullptr;
115 images[1].
name =
nullptr;
124 const uint8_t *data = res->
data;
125 uint16_t width = (data[0]<<8)+data[1];
126 uint16_t height = (data[2]<<8)+data[3];
127 ColoredImgDataItem images[2];
129 images[0].
width = width;
130 images[0].
height = height;
132 images[0].
alpha = &data[4+width*height];
133 images[1].
name =
nullptr;
146 if (name==
"navtree.css")
152 t <<
substitute(buf,
"$doxygenversion",getDoxygenVersion());
173 err(
"requested resource '%s' not compiled in!\n",
qPrint(name));
185 auto it =
p->resources.find(name.
str());
186 if (it!=
p->resources.end())
return &it->second;
192 const Resource *res =
get(name);
This is an alternative implementation of QCString.
size_t length() const
Returns the length of the string, not counting the 0-terminator.
char * rawData()
Returns a writable pointer to the data.
const std::string & str() const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
QCString left(size_t len) 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.
#define Config_getInt(name)
std::ofstream openOutputStream(const QCString &name, bool append=false)
Portable versions of functions that are platform dependent.
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
const char * qPrint(const char *s)
const unsigned char * content
const unsigned char * alpha
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,...
void writeColoredImgData(const QCString &dir, ColoredImgDataItem data[])
Writes the intensity only bitmap represented by data as an image to directory dir using the colors de...
A bunch of utility functions.