浏览该文件的文档.
48 for (
auto &res : resources)
50 p->resources.insert({res.name,res});
56 for (
auto &kv :
p->resources)
61 std::string pathName = targetDir.
str()+
"/"+res.
name;
62 std::ofstream f(pathName,std::ofstream::out | std::ofstream::binary);
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 std::string pathName = targetDir.
str()+
"/"+targetName.
str();
82 std::ios_base::openmode mode = std::ofstream::out | std::ofstream::binary;
83 if (append) mode |= std::ofstream::app;
91 std::ofstream f(pathName,mode);
95 f.write(
reinterpret_cast<const char *
>(res->
data),res->
size);
109 ushort width = (data[0]<<8)+data[1];
110 ushort height = (data[2]<<8)+data[3];
113 images[0].
width = width;
114 images[0].
height = height;
127 ushort width = (data[0]<<8)+data[1];
128 ushort height = (data[2]<<8)+data[3];
131 images[0].
width = width;
132 images[0].
height = height;
134 images[0].
alpha = &data[4+width*height];
142 std::ofstream t(pathName,mode);
148 if (name==
"navtree.css")
154 t <<
substitute(buf,
"$doxygenversion",getDoxygenVersion());
162 std::ofstream t(pathName,mode);
175 err(
"requested resource '%s' not compiled in!\n",
qPrint(name));
187 auto it =
p->resources.find(name.
str());
188 if (it!=
p->resources.end())
return &it->second;
bool copyResource(const QCString &name, const QCString &targetDir) const
Copies a registered resource to a given target directory
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...
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
static ResourceMgr & instance()
Returns the one and only instance of this class
bool writeCategory(const QCString &categoryName, const QCString &targetDir) const
Writes all resource belonging to a given category to a given target directory
char * rawData()
Returns a writable pointer to the data.
QCString getAsString(const QCString &name) const
Gets the resource data as a C string
Data associated with a HSV colored image.
QCString replaceColorMarkers(const QCString &str)
Replaces any markers of the form ##AA in input string str by new markers of the form #AABBCC,...
uint length() const
Returns the length of the string, not counting the 0-terminator.
void err(const char *fmt,...)
void registerResources(std::initializer_list< Resource > resources)
Registers an array of resources
const Resource * get(const QCString &name) const
Returns a pointer to the resource object with the given name.
#define Config_getInt(name)
QCString left(size_t len) const
std::unique_ptr< Private > p
std::map< std::string, Resource > resources
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Singleton for managing resources compiled into an executable
const char * qPrint(const char *s)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string
const unsigned char * data
A bunch of utility functions.
This is an alternative implementation of QCString.