Doxygen
Loading...
Searching...
No Matches
dot.h File Reference
#include <map>
#include "threadpool.h"
#include "qcstring.h"
#include "dotgraph.h"
#include "dotfilepatcher.h"
#include "dotrunner.h"
#include "doxygen.h"
#include "construct.h"
Include dependency graph for dot.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  DotManager
 Singleton that manages parallel dot invocations and patching files for embedding image maps. More...

Functions

void writeDotGraphFromFile (const QCString &inFile, const QCString &outDir, const QCString &outFile, GraphOutputFormat format, const QCString &srcFile, int srcLine)
void writeDotImageMapFromFile (TextStream &t, const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context, int graphId, const QCString &srcFile, int srcLine, bool newFile)

Function Documentation

◆ writeDotGraphFromFile()

void writeDotGraphFromFile ( const QCString & inFile,
const QCString & outDir,
const QCString & outFile,
GraphOutputFormat format,
const QCString & srcFile,
int srcLine )

Definition at line 230 of file dot.cpp.

233{
234 Dir d(outDir.str());
235 if (!d.exists())
236 {
237 term("Output dir {} does not exist!\n",outDir);
238 }
239
241 QCString imgName = outFile+"."+imgExt;
242 QCString absImgName = d.absPath()+"/"+imgName;
243 QCString absOutFile = d.absPath()+"/"+outFile;
244
245 DotRunner dotRun(inFile);
246 if (format==GraphOutputFormat::BITMAP)
247 {
248 dotRun.addJob(Config_getEnumAsString(DOT_IMAGE_FORMAT),absImgName,srcFile,srcLine);
249 }
250 else // format==GraphOutputFormat::EPS
251 {
252 if (Config_getBool(USE_PDFLATEX))
253 {
254 dotRun.addJob("pdf",absOutFile+".pdf",srcFile,srcLine);
255 }
256 else
257 {
258 dotRun.addJob("ps",absOutFile+".eps",srcFile,srcLine);
259 }
260 }
261
262 dotRun.preventCleanUp();
263 if (!dotRun.run())
264 {
265 return;
266 }
267
268 Doxygen::indexList->addImageFile(imgName);
269
270}
Class representing a directory in the file system.
Definition dir.h:75
Helper class to run dot from doxygen from multiple threads.
Definition dotrunner.h:31
static IndexList * indexList
Definition doxygen.h:133
This is an alternative implementation of QCString.
Definition qcstring.h:101
const std::string & str() const
Definition qcstring.h:552
#define Config_getEnumAsString(name)
Definition config.h:36
#define Config_getBool(name)
Definition config.h:33
#define term(fmt,...)
Definition message.h:137
QCString getDotImageExtension()
Definition util.cpp:6289

References Dir::absPath(), DotRunner::addJob(), BITMAP, Config_getBool, Config_getEnumAsString, Dir::exists(), getDotImageExtension(), Doxygen::indexList, DotRunner::preventCleanUp(), DotRunner::run(), QCString::str(), and term.

Referenced by DocbookDocVisitor::startDotFile(), LatexDocVisitor::startDotFile(), DocbookDocVisitor::writeDotFile(), HtmlDocVisitor::writeDotFile(), and RTFDocVisitor::writeDotFile().

◆ writeDotImageMapFromFile()

void writeDotImageMapFromFile ( TextStream & t,
const QCString & inFile,
const QCString & outDir,
const QCString & relPath,
const QCString & baseName,
const QCString & context,
int graphId,
const QCString & srcFile,
int srcLine,
bool newFile )

Writes user defined image map to the output.

Parameters
ttext stream to write to
inFilejust the basename part of the filename
outDiroutput directory
relPathrelative path the to root of the output dir
baseNamethe base name of the output files
contextthe scope in which this graph is found (for resolving links)
graphIda unique id for this graph, use for dynamic sections
srcFilethe source file
srcLinethe line number in the source file
newFilesignal whether or not the file has been generated before (value false) or not.

Definition at line 284 of file dot.cpp.

289{
290
291 Dir d(outDir.str());
292 if (!d.exists())
293 {
294 term("Output dir {} does not exist!\n",outDir);
295 }
296
297 QCString mapName = baseName+".map";
299 QCString imgName = baseName+"."+imgExt;
300 QCString absOutFile = d.absPath()+"/"+mapName;
301
302 DotRunner dotRun(inFile);
303 dotRun.addJob(MAP_CMD,absOutFile,srcFile,srcLine);
304 dotRun.preventCleanUp();
305 if (!dotRun.run())
306 {
307 return;
308 }
309
310 if (imgExt=="svg") // vector graphics
311 {
312 QCString svgName = outDir+"/"+baseName+".svg";
313 DotFilePatcher::writeSVGFigureLink(t,relPath,baseName,svgName);
314 if (newFile)
315 {
316 DotFilePatcher patcher(svgName);
317 patcher.addSVGConversion("",TRUE,context,TRUE,graphId);
318 patcher.run();
319 }
320 }
321 else // bitmap graphics
322 {
323 TextStream tt;
324 t << "<img src=\"" << relPath << imgName << "\" alt=\""
325 << imgName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>\n";
326 DotFilePatcher::convertMapFile(tt, absOutFile, relPath ,TRUE, context);
327 if (!tt.empty())
328 {
329 t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">";
330 t << tt.str();
331 t << "</map>\n";
332 }
333 }
334 d.remove(absOutFile.str());
335}
Helper class to insert a set of map file into an output file.
static bool convertMapFile(TextStream &t, const QCString &mapName, const QCString &relPath, bool urlOnly=FALSE, const QCString &context=QCString())
static bool writeSVGFigureLink(TextStream &out, const QCString &relPath, const QCString &baseName, const QCString &absImgName)
Check if a reference to a SVG figure can be written and do so if possible.
Text streaming class that buffers data.
Definition textstream.h:36
bool empty() const
Returns true iff the buffer is empty.
Definition textstream.h:240
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:216
#define MAP_CMD
Definition dot.cpp:34
#define TRUE
Definition qcstring.h:37

References Dir::absPath(), DotRunner::addJob(), DotFilePatcher::addSVGConversion(), DotFilePatcher::convertMapFile(), TextStream::empty(), Dir::exists(), getDotImageExtension(), MAP_CMD, DotRunner::preventCleanUp(), Dir::remove(), DotFilePatcher::run(), DotRunner::run(), QCString::str(), TextStream::str(), term, TRUE, and DotFilePatcher::writeSVGFigureLink().

Referenced by HtmlDocVisitor::writeDotFile().