Skip to main content

The dot.cpp File Reference

Included Headers

#include <cstdlib> #include <cassert> #include <sstream> #include <algorithm> #include <mutex> #include "config.h" #include "dot.h" #include "dotrunner.h" #include "dotfilepatcher.h" #include "util.h" #include "portable.h" #include "message.h" #include "doxygen.h" #include "language.h" #include "indexlist.h" #include "dir.h"

Functions Index

static voidsetDotFontPath (const QCString &path)
static voidunsetDotFontPath ()
voidwriteDotGraphFromFile (const QCString &inFile, const QCString &outDir, const QCString &outFile, GraphOutputFormat format, const QCString &srcFile, int srcLine)
voidwriteDotImageMapFromFile (TextStream &t, const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context, int graphId, const QCString &srcFile, int srcLine)

Variables Index

static QCStringg_dotFontPath
static std::mutexg_dotManagerMutex

Macro Definitions Index

#defineMAP_CMD   "cmapx"

Functions

setDotFontPath()

void setDotFontPath (const QCString & path)
static

Definition at line 42 of file dot.cpp.

42static void setDotFontPath(const QCString &path)
43{
44 ASSERT(g_dotFontPath.isEmpty());
45 g_dotFontPath = Portable::getenv("DOTFONTPATH");
46 QCString newFontPath = Config_getString(DOT_FONTPATH);
47 if (!newFontPath.isEmpty() && !path.isEmpty())
48 {
49 newFontPath.prepend(path+Portable::pathListSeparator());
50 }
51 else if (newFontPath.isEmpty() && !path.isEmpty())
52 {
53 newFontPath=path;
54 }
55 else
56 {
57 Portable::unsetenv("DOTFONTPATH");
58 return;
59 }
60 Portable::setenv("DOTFONTPATH",newFontPath);
61}

References ASSERT, Config_getString, g_dotFontPath, Portable::getenv, QCString::isEmpty, Portable::pathListSeparator, QCString::prepend, Portable::setenv and Portable::unsetenv.

Referenced by DotManager::run.

unsetDotFontPath()

void unsetDotFontPath ()
static

Definition at line 63 of file dot.cpp.

63static void unsetDotFontPath()
64{
65 if (g_dotFontPath.isEmpty())
66 {
67 Portable::unsetenv("DOTFONTPATH");
68 }
69 else
70 {
71 Portable::setenv("DOTFONTPATH",g_dotFontPath);
72 }
74}

References g_dotFontPath, Portable::setenv and Portable::unsetenv.

Referenced by DotManager::run.

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.

230void writeDotGraphFromFile(const QCString &inFile,const QCString &outDir,
231 const QCString &outFile,GraphOutputFormat format,
232 const QCString &srcFile,int srcLine)
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 = QCString(outFile)+"."+imgExt;
242 QCString absImgName = QCString(d.absPath())+"/"+imgName;
243 QCString absOutFile = QCString(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}

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)

Writes user defined image map to the output.

Parameters
t

text stream to write to

inFile

just the basename part of the filename

outDir

output directory

relPath

relative path the to root of the output dir

baseName

the base name of the output files

context

the scope in which this graph is found (for resolving links)

graphId

a unique id for this graph, use for dynamic sections

srcFile

the source file

srcLine

the line number in the source file

Definition at line 283 of file dot.cpp.

284 const QCString &inFile, const QCString &outDir,
285 const QCString &relPath, const QCString &baseName,
286 const QCString &context,int graphId,
287 const QCString &srcFile,int srcLine)
288{
289
290 Dir d(outDir.str());
291 if (!d.exists())
292 {
293 term("Output dir {} does not exist!\n",outDir);
294 }
295
296 QCString mapName = baseName+".map";
298 QCString imgName = baseName+"."+imgExt;
299 QCString absOutFile = QCString(d.absPath())+"/"+mapName;
300
301 DotRunner dotRun(inFile);
302 dotRun.addJob(MAP_CMD,absOutFile,srcFile,srcLine);
303 dotRun.preventCleanUp();
304 if (!dotRun.run())
305 {
306 return;
307 }
308
309 if (imgExt=="svg") // vector graphics
310 {
311 QCString svgName = outDir+"/"+baseName+".svg";
312 DotFilePatcher::writeSVGFigureLink(t,relPath,baseName,svgName);
313 DotFilePatcher patcher(svgName);
314 patcher.addSVGConversion("",TRUE,context,TRUE,graphId);
315 patcher.run();
316 }
317 else // bitmap graphics
318 {
319 TextStream tt;
320 t << "<img src=\"" << relPath << imgName << "\" alt=\""
321 << imgName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>\n";
322 DotFilePatcher::convertMapFile(tt, absOutFile, relPath ,TRUE, context);
323 if (!tt.empty())
324 {
325 t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">";
326 t << tt.str();
327 t << "</map>\n";
328 }
329 }
330 d.remove(absOutFile.str());
331}

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.

Variables

g_dotFontPath

QCString g_dotFontPath
static

Definition at line 38 of file dot.cpp.

Referenced by setDotFontPath and unsetDotFontPath.

g_dotManagerMutex

std::mutex g_dotManagerMutex
static

Definition at line 40 of file dot.cpp.

40static std::mutex g_dotManagerMutex;

Referenced by DotManager::createFilePatcher and DotManager::createRunner.

Macro Definitions

MAP_CMD

#define MAP_CMD   "cmapx"

Definition at line 34 of file dot.cpp.

34#define MAP_CMD "cmapx"

Referenced by DotGraph::prepareDotFile and writeDotImageMapFromFile.


Generated via doxygen2docusaurus by Doxygen 1.14.0.