Public Member Functions | Private Attributes | List of all members
DotDirDeps Class Reference

#include <dot.h>

Public Member Functions

 DotDirDeps (DirDef *dir)
 
 ~DotDirDeps ()
 
bool isTrivial () const
 
QCString writeGraph (FTextStream &out, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path, const char *fileName, const char *relPath, bool writeImageMap=TRUE, int graphId=-1, bool linkRelations=TRUE) const
 

Private Attributes

DirDefm_dir
 

Detailed Description

Representation of an directory dependency graph

Definition at line 252 of file dot.h.

Constructor & Destructor Documentation

DotDirDeps::DotDirDeps ( DirDef dir)

Definition at line 3969 of file dot.cpp.

3969  : m_dir(dir)
3970 {
3971 }
DirDef * m_dir
Definition: dot.h:268
DotDirDeps::~DotDirDeps ( )

Definition at line 3973 of file dot.cpp.

3974 {
3975 }

Member Function Documentation

bool DotDirDeps::isTrivial ( ) const

Definition at line 4120 of file dot.cpp.

4121 {
4122  return m_dir->depGraphIsTrivial();
4123 }
DirDef * m_dir
Definition: dot.h:268
bool depGraphIsTrivial() const
Definition: dirdef.cpp:613
QCString DotDirDeps::writeGraph ( FTextStream out,
GraphOutputFormat  gf,
EmbeddedOutputFormat  ef,
const char *  path,
const char *  fileName,
const char *  relPath,
bool  writeImageMap = TRUE,
int  graphId = -1,
bool  linkRelations = TRUE 
) const

Definition at line 3977 of file dot.cpp.

3986 {
3987  QDir d(path);
3988  // store the original directory
3989  if (!d.exists())
3990  {
3991  err("Output dir %s does not exist!\n",path); exit(1);
3992  }
3993  static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
3994 
3996  QCString mapName=escapeCharsInString(baseName,FALSE);
3997 
3998  QCString imgExt = getDotImageExtension();
3999  QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
4000  QCString absBaseName = d.absPath().utf8()+"/"+baseName;
4001  QCString absDotName = absBaseName+".dot";
4002  QCString absMapName = absBaseName+".map";
4003  QCString absPdfName = absBaseName+".pdf";
4004  QCString absEpsName = absBaseName+".eps";
4005  QCString absImgName = absBaseName+"."+imgExt;
4006 
4007  // compute md5 checksum of the graph were are about to generate
4008  QGString theGraph;
4009  FTextStream md5stream(&theGraph);
4010  //m_dir->writeDepGraph(md5stream);
4011  writeDotDirDepGraph(md5stream,m_dir,linkRelations);
4012  uchar md5_sig[16];
4013  QCString sigStr(33);
4014  MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
4015  MD5SigToString(md5_sig,sigStr.rawData(),33);
4016  bool regenerate=FALSE;
4017  if (checkAndUpdateMd5Signature(absBaseName,sigStr) ||
4018  !checkDeliverables(graphFormat==GOF_BITMAP ? absImgName :
4019  usePDFLatex ? absPdfName : absEpsName,
4020  graphFormat==GOF_BITMAP && generateImageMap ? absMapName : QCString())
4021  )
4022  {
4023  regenerate=TRUE;
4024 
4025  QFile f(absDotName);
4026  if (!f.open(IO_WriteOnly))
4027  {
4028  err("Cannot create file %s.dot for writing!\n",baseName.data());
4029  }
4030  FTextStream t(&f);
4031  t << theGraph.data();
4032  f.close();
4033 
4034  if (graphFormat==GOF_BITMAP)
4035  {
4036  // run dot to create a bitmap image
4037  DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),TRUE,absImgName);
4038  dotRun->addJob(imgFmt,absImgName);
4039  if (generateImageMap) dotRun->addJob(MAP_CMD,absMapName);
4040  DotManager::instance()->addRun(dotRun);
4041  }
4042  else if (graphFormat==GOF_EPS)
4043  {
4044  DotRunner *dotRun = new DotRunner(absDotName,d.absPath().data(),FALSE);
4045  if (usePDFLatex)
4046  {
4047  dotRun->addJob("pdf",absPdfName);
4048  }
4049  else
4050  {
4051  dotRun->addJob("ps",absEpsName);
4052  }
4053  DotManager::instance()->addRun(dotRun);
4054  }
4055  }
4056  Doxygen::indexList->addImageFile(baseName+"."+imgExt);
4057 
4058  if (graphFormat==GOF_BITMAP && textFormat==EOF_DocBook)
4059  {
4060  out << "<para>" << endl;
4061  out << " <figure>" << endl;
4062  out << " <title>Directory Dependency diagram";
4063  out << "</title>" << endl;
4064  out << " <mediaobject>" << endl;
4065  out << " <imageobject>" << endl;
4066  out << " <imagedata";
4067  out << " width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << relPath << baseName << "." << imgExt << "\">";
4068  out << "</imagedata>" << endl;
4069  out << " </imageobject>" << endl;
4070  out << " </mediaobject>" << endl;
4071  out << " </figure>" << endl;
4072  out << "</para>" << endl;
4073  }
4074  else if (graphFormat==GOF_BITMAP && generateImageMap)
4075  {
4076  if (imgExt=="svg") // Scalable vector graphics
4077  {
4078  out << "<div class=\"center\">";
4079  if (regenerate || !writeSVGFigureLink(out,relPath,baseName,absImgName)) // need to patch the links in the generated SVG file
4080  {
4081  if (regenerate)
4082  {
4083  DotManager::instance()->addSVGConversion(absImgName,relPath,FALSE,QCString(),TRUE,graphId);
4084  }
4085  int mapId = DotManager::instance()->addSVGObject(fileName,baseName,absImgName,relPath);
4086  out << "<!-- SVG " << mapId << " -->" << endl;
4087  }
4088  out << "</div>" << endl;
4089  }
4090  else // bitmap graphics
4091  {
4092  out << "<div class=\"center\"><img src=\"" << relPath << baseName << "."
4093  << imgExt << "\" border=\"0\" usemap=\"#"
4094  << mapName << "\" alt=\"";
4095  out << convertToXML(m_dir->displayName());
4096  out << "\"/>";
4097  out << "</div>" << endl;
4098 
4099  if (regenerate || !insertMapFile(out,absMapName,relPath,mapName))
4100  {
4101  int mapId = DotManager::instance()->addMap(fileName,absMapName,relPath,
4102  TRUE,QCString(),mapName);
4103  out << "<!-- MAP " << mapId << " -->" << endl;
4104  }
4105  }
4106  }
4107  else if (graphFormat==GOF_EPS)
4108  {
4109  if (regenerate || !writeVecGfxFigure(out,baseName,absBaseName))
4110  {
4111  int figId = DotManager::instance()->addFigure(fileName,baseName,absBaseName,FALSE);
4112  out << endl << "% FIG " << figId << endl;
4113  }
4114  }
4115  if (!regenerate) removeDotGraph(absDotName);
4116 
4117  return baseName;
4118 }
Traverses directory structures and contents in a platform-independent way.
Definition: qdir.h:52
QCString convertToXML(const char *s)
Definition: util.cpp:5717
int addSVGConversion(const QCString &file, const QCString &relPath, bool urlOnly, const QCString &context, bool zoomable, int graphId)
Definition: dot.cpp:1292
char * data() const
Definition: qgstring.h:42
QCString escapeCharsInString(const char *name, bool allowDots, bool allowUnderscore)
Definition: util.cpp:5242
static bool insertMapFile(FTextStream &out, const QCString &mapFile, const QCString &relPath, const QCString &mapLabel)
Definition: dot.cpp:694
static bool checkAndUpdateMd5Signature(const QCString &baseName, const QCString &md5)
Definition: dot.cpp:731
Definition: dot.h:356
uint length() const
Definition: qgstring.h:40
static bool checkDeliverables(const QCString &file1, const QCString &file2=QCString())
Definition: dot.cpp:758
#define IO_WriteOnly
Definition: qiodevice.h:62
DirDef * m_dir
Definition: dot.h:268
static DotManager * instance()
Definition: dot.cpp:1221
const bool FALSE
Definition: qglobal.h:370
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
int addMap(const QCString &file, const QCString &mapFile, const QCString &relPath, bool urlOnly, const QCString &context, const QCString &label)
Definition: dot.cpp:1267
unsigned char uchar
Definition: nybbler.cc:11
QCString displayName(bool=TRUE) const
Definition: dirdef.h:56
#define Config_getEnum(val)
Definition: config.cpp:663
static void removeDotGraph(const QCString &dotName)
Definition: dot.cpp:714
static void writeDotDirDepGraph(FTextStream &t, DirDef *dd, bool linkRelations)
Definition: dot.cpp:4769
fileName
Definition: dumpTree.py:9
void MD5Buffer(const unsigned char *buf, unsigned int len, unsigned char sig[16])
Definition: md5.c:275
static bool writeVecGfxFigure(FTextStream &out, const QCString &baseName, const QCString &figureName)
Definition: dot.cpp:518
int addFigure(const QCString &file, const QCString &baseName, const QCString &figureName, bool heightCheck)
Definition: dot.cpp:1280
const char * data() const
Definition: qcstring.h:207
void addImageFile(const char *name)
Definition: index.h:147
#define Config_getBool(val)
Definition: config.cpp:664
QCString getDotImageExtension(void)
Definition: util.cpp:8562
#define MAP_CMD
Definition: dot.cpp:51
Definition: dot.h:42
void err(const char *fmt,...)
Definition: message.cpp:226
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
int addSVGObject(const QCString &file, const QCString &baseName, const QCString &figureNAme, const QCString &relPath)
Definition: dot.cpp:1305
QCString getOutputFileBase() const
Definition: dirdef.cpp:113
void addJob(const char *format, const char *output)
Definition: dot.cpp:807
void MD5SigToString(unsigned char signature[16], char *str, int len)
Definition: md5.c:285
static bool writeSVGFigureLink(FTextStream &out, const QCString &relPath, const QCString &baseName, const QCString &absImgName)
Definition: dot.cpp:618
static QCString baseName
Definition: scanner.cpp:10890
Definition: dot.h:42
void addRun(DotRunner *run)
Definition: dot.cpp:1262
const bool TRUE
Definition: qglobal.h:371
static IndexList * indexList
Definition: doxygen.h:149
QTextStream & endl(QTextStream &s)

Member Data Documentation

DirDef* DotDirDeps::m_dir
private

Definition at line 268 of file dot.h.


The documentation for this class was generated from the following files: