Doxygen
Loading...
Searching...
No Matches
dot.h File Reference
#include <map>
#include <vector>
#include "construct.h"
#include "dotfilepatcher.h"
#include "dotgraph.h"
#include "dotjob.h"
#include "dotrunner.h"
#include "doxygen.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 dot invocations and patching files for embedding image maps. More...

Functions

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

Function Documentation

◆ writeDotGraphFromFile()

void writeDotGraphFromFile ( const DString & inFile,
const DString & outDir,
const DString & outFile,
GraphOutputFormat format,
const DString & srcFile,
int srcLine,
bool toIndex )

Definition at line 197 of file dot.cpp.

200{
201 Dir d(outDir.str());
202 if (!d.exists())
203 {
204 term("Output dir {} does not exist!\n",outDir);
205 }
206
207 DString imgExt = getDotImageExtension();
208 DString imgName = outFile+"."+imgExt;
209 DString absImgName = d.absPath()+"/"+imgName;
210 DString absOutFile = d.absPath()+"/"+outFile;
211
212 DString dotArgs;
213 if (format==GraphOutputFormat::BITMAP)
214 {
215 dotArgs = DString("-T") + Config_getEnumAsString(DOT_IMAGE_FORMAT) + " -o \"" + absImgName + "\" \"" + inFile + "\"";
216 }
217 else // format==GraphOutputFormat::EPS
218 {
219 if (Config_getBool(USE_PDFLATEX))
220 {
221 dotArgs = DString("-Tpdf -o \"") + absOutFile + ".pdf\" \"" + inFile + "\"";
222 }
223 else
224 {
225 dotArgs = DString("-Teps -o \"") + absOutFile + ".eps\" \"" + inFile + "\"";
226 }
227 }
228
229 if (Portable::system(Doxygen::verifiedDotPath, dotArgs, false) != 0)
230 {
231 return;
232 }
233
234 if (toIndex) Doxygen::indexList->addImageFile(imgName);
235
236}
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:88
const std::string & str() const
Definition dstring.h:649
Class representing a directory in the file system.
Definition dir.h:73
static DString verifiedDotPath
Definition doxygen.h:130
static IndexList * indexList
Definition doxygen.h:125
void addImageFile(const DString &name)
Definition indexlist.h:124
#define Config_getEnumAsString(name)
Definition config.h:36
#define Config_getBool(name)
Definition config.h:33
#define term(fmt,...)
Definition message.h:137
int system(const DString &command, const DString &args, bool commandHasConsole=true)
Definition portable.cpp:105
DString getDotImageExtension()
Definition util.cpp:4966

References Dir::absPath(), IndexList::addImageFile(), BITMAP, Config_getBool, Config_getEnumAsString, Dir::exists(), getDotImageExtension(), Doxygen::indexList, DString::str(), Portable::system(), term, and Doxygen::verifiedDotPath.

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

◆ writeDotImageMapFromFile()

void writeDotImageMapFromFile ( TextStream & t,
const DString & inFile,
const DString & outDir,
const DString & relPath,
const DString & baseName,
const DString & context,
int graphId,
const DString & 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 250 of file dot.cpp.

255{
256
257 Dir d(outDir.str());
258 if (!d.exists())
259 {
260 term("Output dir {} does not exist!\n",outDir);
261 }
262
263 DString mapName = baseName+".cmapx";
264 DString imgExt = getDotImageExtension();
265 DString imgName = baseName+"."+imgExt;
266 DString absOutFile = d.absPath()+"/"+mapName;
267
268 DString dotArgs = DString("-T" MAP_CMD " -o \"") + absOutFile + "\" \"" + inFile + "\"";
269 if (Portable::system(Doxygen::verifiedDotPath, dotArgs, false) != 0)
270 {
271 return;
272 }
273
274 if (imgExt=="svg") // vector graphics
275 {
276 DString svgName = outDir+"/"+baseName+".svg";
277 DotFilePatcher::writeSVGFigureLink(t,relPath,baseName,svgName);
278 if (newFile)
279 {
280 DotFilePatcher patcher(svgName);
281 patcher.addSVGConversion("",true,context,true,graphId);
282 patcher.run();
283 }
284 }
285 else // bitmap graphics
286 {
287 TextStream tt;
288 t << "<img src=\"" << relPath << imgName << "\" alt=\""
289 << imgName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>\n";
290 DotFilePatcher::convertMapFile(tt, absOutFile, relPath ,true, context);
291 if (!tt.empty())
292 {
293 t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">";
294 t << tt.str();
295 t << "</map>\n";
296 }
297 }
298 d.remove(absOutFile.str());
299}
DString & remove(size_t index, size_t len)
Definition dstring.h:539
Helper class to insert a set of map file into an output file.
static bool writeSVGFigureLink(TextStream &out, const DString &relPath, const DString &baseName, const DString &absImgName)
Check if a reference to a SVG figure can be written and do so if possible.
static bool convertMapFile(TextStream &t, const DString &mapName, const DString &relPath, bool urlOnly=false, const DString &context=DString())
Text streaming class that buffers data.
Definition textstream.h:36
bool empty() const
Returns true iff the buffer is empty.
Definition textstream.h:256
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:232
#define MAP_CMD
Definition dot.cpp:35

References Dir::absPath(), DotFilePatcher::addSVGConversion(), DotFilePatcher::convertMapFile(), TextStream::empty(), Dir::exists(), getDotImageExtension(), MAP_CMD, Dir::remove(), DotFilePatcher::run(), DString::str(), TextStream::str(), Portable::system(), term, Doxygen::verifiedDotPath, and DotFilePatcher::writeSVGFigureLink().

Referenced by HtmlDocVisitor::writeDotFile().