Doxygen
dotrunner.cpp 文件参考
#include <cassert>
#include "dotrunner.h"
#include "util.h"
#include "portable.h"
#include "dot.h"
#include "message.h"
#include "config.h"
#include "dir.h"
+ dotrunner.cpp 的引用(Include)关系图:

浏览源代码.

宏定义

#define MAX_LATEX_GRAPH_INCH   150
 
#define MAX_LATEX_GRAPH_SIZE   (MAX_LATEX_GRAPH_INCH * 72)
 

函数

static void checkPngResult (const QCString &imgName)
 
static bool resetPDFSize (const int width, const int height, const QCString &base)
 
QCString getBaseNameOfOutput (const QCString &output)
 

宏定义说明

◆ MAX_LATEX_GRAPH_INCH

#define MAX_LATEX_GRAPH_INCH   150

在文件 dotrunner.cpp29 行定义.

◆ MAX_LATEX_GRAPH_SIZE

#define MAX_LATEX_GRAPH_SIZE   (MAX_LATEX_GRAPH_INCH * 72)

在文件 dotrunner.cpp30 行定义.

函数说明

◆ checkPngResult()

static void checkPngResult ( const QCString imgName)
static

在文件 dotrunner.cpp36 行定义.

37 {
38  FILE *f = Portable::fopen(imgName,"rb");
39  if (f)
40  {
41  char data[4];
42  if (fread(data,1,4,f)==4)
43  {
44  if (!(data[1]=='P' && data[2]=='N' && data[3]=='G'))
45  {
46  err("Image '%s' produced by dot is not a valid PNG!\n"
47  "You should either select a different format "
48  "(DOT_IMAGE_FORMAT in the config file) or install a more "
49  "recent version of graphviz (1.7+)\n",qPrint(imgName)
50  );
51  }
52  }
53  else
54  {
55  err("Could not read image '%s' generated by dot!\n",qPrint(imgName));
56  }
57  fclose(f);
58  }
59  else
60  {
61  err("Could not open image '%s' generated by dot!\n",qPrint(imgName));
62  }
63 }

引用了 err(), Portable::fclose(), Portable::fopen() , 以及 qPrint().

被这些函数引用 DotRunner::run().

◆ getBaseNameOfOutput()

QCString getBaseNameOfOutput ( const QCString output)

在文件 dotrunner.cpp165 行定义.

166 {
167  int index = output.findRev('.');
168  if (index < 0) return output;
169  return output.left(index);
170 }

引用了 QCString::findRev() , 以及 QCString::left().

被这些函数引用 DotRunner::run().

◆ resetPDFSize()

static bool resetPDFSize ( const int  width,
const int  height,
const QCString base 
)
static

在文件 dotrunner.cpp65 行定义.

66 {
67  std::string tmpName = base.str()+".tmp";
68  std::string patchFile = base.str()+".dot";
69  Dir thisDir;
70  if (!thisDir.rename(patchFile,tmpName))
71  {
72  err("Failed to rename file %s to %s!\n",qPrint(patchFile),qPrint(tmpName));
73  return FALSE;
74  }
75  std::ifstream fi(tmpName,std::ifstream::in);
76  std::ofstream t(patchFile,std::ofstream::out | std::ofstream::binary);
77  if (!fi.is_open())
78  {
79  err("problem opening file %s for patching!\n",qPrint(tmpName));
80  thisDir.rename(tmpName,patchFile);
81  return FALSE;
82  }
83  if (!t.is_open())
84  {
85  err("problem opening file %s for patching!\n",qPrint(patchFile));
86  thisDir.rename(tmpName,patchFile);
87  return FALSE;
88  }
89  std::string line;
90  while (getline(fi,line)) // foreach line
91  {
92  if (line.find("LATEX_PDF_SIZE") != std::string::npos)
93  {
94  double scale = (width > height ? width : height)/double(MAX_LATEX_GRAPH_INCH);
95  t << " size=\""<<width/scale << "," <<height/scale << "\";\n";
96  }
97  else
98  t << line << "\n";
99  }
100  fi.close();
101  t.close();
102  // remove temporary file
103  thisDir.remove(tmpName);
104  return TRUE;
105 }

引用了 err(), FALSE, MAX_LATEX_GRAPH_INCH, qPrint(), Dir::remove(), Dir::rename(), QCString::str() , 以及 TRUE.

被这些函数引用 DotRunner::run().

Portable::fopen
FILE * fopen(const QCString &fileName, const QCString &mode)
Definition: portable.cpp:322
Dir::remove
bool remove(const std::string &path, bool acceptsAbsPath=true) const
Definition: dir.cpp:256
Dir
Class representing a directory in the file system
Definition: dir.h:68
QCString::findRev
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition: qcstring.cpp:86
QCString::str
std::string str() const
Definition: qcstring.h:442
err
void err(const char *fmt,...)
Definition: message.cpp:203
Dir::rename
bool rename(const std::string &orgName, const std::string &newName, bool acceptsAbsPath=true) const
Definition: dir.cpp:263
QCString::left
QCString left(size_t len) const
Definition: qcstring.h:212
Portable::fclose
int fclose(FILE *f)
Definition: portable.cpp:342
MAX_LATEX_GRAPH_INCH
#define MAX_LATEX_GRAPH_INCH
Definition: dotrunner.cpp:29
TRUE
#define TRUE
Definition: qcstring.h:36
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
FALSE
#define FALSE
Definition: qcstring.h:33