Doxygen
Loading...
Searching...
No Matches
xmlgen.h File Reference
#include "outputgen.h"
+ Include dependency graph for xmlgen.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  XMLCodeGenerator
 

Functions

void generateXML ()
 

Function Documentation

◆ generateXML()

void generateXML ( )

Definition at line 2178 of file xmlgen.cpp.

2179{
2180 // + classes
2181 // + concepts
2182 // + namespaces
2183 // + files
2184 // + groups
2185 // + related pages
2186 // - examples
2187
2188 QCString outputDirectory = Config_getString(XML_OUTPUT);
2189 Dir xmlDir(outputDirectory.str());
2190 createSubDirs(xmlDir);
2191
2192 ResourceMgr::instance().copyResource("xml.xsd",outputDirectory);
2193 ResourceMgr::instance().copyResource("index.xsd",outputDirectory);
2194
2195 QCString fileName=outputDirectory+"/compound.xsd";
2196 std::ofstream f = Portable::openOutputStream(fileName);
2197 if (!f.is_open())
2198 {
2199 err("Cannot open file %s for writing!\n",qPrint(fileName));
2200 return;
2201 }
2202 {
2203 TextStream t(&f);
2204
2205 // write compound.xsd, but replace special marker with the entities
2206 QCString compound_xsd = ResourceMgr::instance().getAsString("compound.xsd");
2207 const char *startLine = compound_xsd.data();
2208 while (*startLine)
2209 {
2210 // find end of the line
2211 const char *endLine = startLine+1;
2212 while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n
2213 int len=static_cast<int>(endLine-startLine);
2214 if (len>0)
2215 {
2216 QCString s(startLine,len);
2217 if (s.find("<!-- Automatically insert here the HTML entities -->")!=-1)
2218 {
2220 }
2221 else
2222 {
2223 t.write(startLine,len);
2224 }
2225 }
2226 startLine=endLine;
2227 }
2228 }
2229 f.close();
2230
2231 fileName=outputDirectory+"/doxyfile.xsd";
2232 f = Portable::openOutputStream(fileName);
2233 if (!f.is_open())
2234 {
2235 err("Cannot open file %s for writing!\n",qPrint(fileName));
2236 return;
2237 }
2238 {
2239 TextStream t(&f);
2240
2241 // write doxyfile.xsd, but replace special marker with the entities
2242 QCString doxyfile_xsd = ResourceMgr::instance().getAsString("doxyfile.xsd");
2243 const char *startLine = doxyfile_xsd.data();
2244 while (*startLine)
2245 {
2246 // find end of the line
2247 const char *endLine = startLine+1;
2248 while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n
2249 int len=static_cast<int>(endLine-startLine);
2250 if (len>0)
2251 {
2252 QCString s(startLine,len);
2253 if (s.find("<!-- Automatically insert here the configuration settings -->")!=-1)
2254 {
2256 }
2257 else
2258 {
2259 t.write(startLine,len);
2260 }
2261 }
2262 startLine=endLine;
2263 }
2264 }
2265 f.close();
2266
2267 fileName=outputDirectory+"/Doxyfile.xml";
2268 f = Portable::openOutputStream(fileName);
2269 if (!f.is_open())
2270 {
2271 err("Cannot open file %s for writing\n",fileName.data());
2272 return;
2273 }
2274 else
2275 {
2276 TextStream t(&f);
2278 }
2279 f.close();
2280
2281 fileName=outputDirectory+"/index.xml";
2282 f = Portable::openOutputStream(fileName);
2283 if (!f.is_open())
2284 {
2285 err("Cannot open file %s for writing!\n",qPrint(fileName));
2286 return;
2287 }
2288 else
2289 {
2290 TextStream t(&f);
2291
2292 // write index header
2293 t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";
2294 t << "<doxygenindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
2295 t << "xsi:noNamespaceSchemaLocation=\"index.xsd\" ";
2296 t << "version=\"" << getDoxygenVersion() << "\" ";
2297 t << "xml:lang=\"" << theTranslator->trISOLang() << "\"";
2298 t << ">\n";
2299
2300 for (const auto &cd : *Doxygen::classLinkedMap)
2301 {
2302 generateXMLForClass(cd.get(),t);
2303 }
2304 for (const auto &cd : *Doxygen::conceptLinkedMap)
2305 {
2306 msg("Generating XML output for concept %s\n",qPrint(cd->displayName()));
2307 generateXMLForConcept(cd.get(),t);
2308 }
2309 for (const auto &nd : *Doxygen::namespaceLinkedMap)
2310 {
2311 msg("Generating XML output for namespace %s\n",qPrint(nd->displayName()));
2312 generateXMLForNamespace(nd.get(),t);
2313 }
2314 for (const auto &fn : *Doxygen::inputNameLinkedMap)
2315 {
2316 for (const auto &fd : *fn)
2317 {
2318 msg("Generating XML output for file %s\n",qPrint(fd->name()));
2319 generateXMLForFile(fd.get(),t);
2320 }
2321 }
2322 for (const auto &gd : *Doxygen::groupLinkedMap)
2323 {
2324 msg("Generating XML output for group %s\n",qPrint(gd->name()));
2325 generateXMLForGroup(gd.get(),t);
2326 }
2327 for (const auto &pd : *Doxygen::pageLinkedMap)
2328 {
2329 msg("Generating XML output for page %s\n",qPrint(pd->name()));
2330 generateXMLForPage(pd.get(),t,FALSE);
2331 }
2332 for (const auto &dd : *Doxygen::dirLinkedMap)
2333 {
2334 msg("Generate XML output for dir %s\n",qPrint(dd->name()));
2335 generateXMLForDir(dd.get(),t);
2336 }
2337 for (const auto &mod : ModuleManager::instance().modules())
2338 {
2339 msg("Generating XML output for module %s\n",qPrint(mod->name()));
2340 generateXMLForModule(mod.get(),t);
2341 }
2342 for (const auto &pd : *Doxygen::exampleLinkedMap)
2343 {
2344 msg("Generating XML output for example %s\n",qPrint(pd->name()));
2345 generateXMLForPage(pd.get(),t,TRUE);
2346 }
2348 {
2349 msg("Generating XML output for the main page\n");
2351 }
2352
2353 //t << " </compoundlist>\n";
2354 t << "</doxygenindex>\n";
2355 }
2356
2358 clearSubDirs(xmlDir);
2359}
Class representing a directory in the file system.
Definition dir.h:75
static NamespaceLinkedMap * namespaceLinkedMap
Definition doxygen.h:115
static ConceptLinkedMap * conceptLinkedMap
Definition doxygen.h:98
static std::unique_ptr< PageDef > mainPage
Definition doxygen.h:101
static FileNameLinkedMap * inputNameLinkedMap
Definition doxygen.h:105
static ClassLinkedMap * classLinkedMap
Definition doxygen.h:96
static PageLinkedMap * exampleLinkedMap
Definition doxygen.h:99
static PageLinkedMap * pageLinkedMap
Definition doxygen.h:100
static DirLinkedMap * dirLinkedMap
Definition doxygen.h:129
static GroupLinkedMap * groupLinkedMap
Definition doxygen.h:114
void writeXMLSchema(TextStream &t)
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
static ModuleManager & instance()
This is an alternative implementation of QCString.
Definition qcstring.h:101
const std::string & str() const
Definition qcstring.h:537
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159
static ResourceMgr & instance()
Returns the one and only instance of this class.
bool copyResource(const QCString &name, const QCString &targetDir) const
Copies a registered resource to a given target directory.
QCString getAsString(const QCString &name) const
Gets the resource data as a C string.
Text streaming class that buffers data.
Definition textstream.h:36
#define Config_getString(name)
Definition config.h:32
Translator * theTranslator
Definition language.cpp:71
void msg(const char *fmt,...)
Definition message.cpp:98
#define err(fmt,...)
Definition message.h:84
void writeXMLDoxyfile(TextStream &t)
void writeXSDDoxyfile(TextStream &t)
std::ofstream openOutputStream(const QCString &name, bool append=false)
Definition portable.cpp:665
const char * qPrint(const char *s)
Definition qcstring.h:672
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
void clearSubDirs(const Dir &d)
Definition util.cpp:4021
void createSubDirs(const Dir &d)
Definition util.cpp:3994
static void generateXMLForGroup(const GroupDef *gd, TextStream &ti)
Definition xmlgen.cpp:1919
static void generateXMLForClass(const ClassDef *cd, TextStream &ti)
Definition xmlgen.cpp:1437
static void generateXMLForFile(FileDef *fd, TextStream &ti)
Definition xmlgen.cpp:1804
static void generateXMLForNamespace(const NamespaceDef *nd, TextStream &ti)
Definition xmlgen.cpp:1731
static void generateXMLForModule(const ModuleDef *mod, TextStream &ti)
Definition xmlgen.cpp:1676
static void generateXMLForConcept(const ConceptDef *cd, TextStream &ti)
Definition xmlgen.cpp:1630
static void generateXMLForDir(DirDef *dd, TextStream &ti)
Definition xmlgen.cpp:1988
static void generateXMLForPage(PageDef *pd, TextStream &ti, bool isExample)
Definition xmlgen.cpp:2026
static void writeCombineScript()
Definition xmlgen.cpp:128

References Doxygen::classLinkedMap, clearSubDirs(), Doxygen::conceptLinkedMap, Config_getString, ResourceMgr::copyResource(), createSubDirs(), QCString::data(), Doxygen::dirLinkedMap, err, Doxygen::exampleLinkedMap, FALSE, QCString::find(), generateXMLForClass(), generateXMLForConcept(), generateXMLForDir(), generateXMLForFile(), generateXMLForGroup(), generateXMLForModule(), generateXMLForNamespace(), generateXMLForPage(), ResourceMgr::getAsString(), Doxygen::groupLinkedMap, Doxygen::inputNameLinkedMap, HtmlEntityMapper::instance(), ModuleManager::instance(), ResourceMgr::instance(), Doxygen::mainPage, msg(), Doxygen::namespaceLinkedMap, Portable::openOutputStream(), Doxygen::pageLinkedMap, qPrint(), QCString::str(), theTranslator, TRUE, TextStream::write(), writeCombineScript(), Config::writeXMLDoxyfile(), HtmlEntityMapper::writeXMLSchema(), and Config::writeXSDDoxyfile().

Referenced by generateOutput().