Doxygen
plantuml.cpp 文件参考
#include "plantuml.h"
#include "util.h"
#include "portable.h"
#include "config.h"
#include "doxygen.h"
#include "message.h"
#include "debug.h"
#include "fileinfo.h"
#include "dir.h"
+ plantuml.cpp 的引用(Include)关系图:

浏览源代码.

函数

static void runPlantumlContent (const PlantumlManager::FilesMap &plantumlFiles, const PlantumlManager::ContentMap &plantumlContent, PlantumlManager::OutputFormat format)
 
static void print (const PlantumlManager::FilesMap &plantumlFiles)
 
static void print (const PlantumlManager::ContentMap &plantumlContent)
 
static void addPlantumlFiles (PlantumlManager::FilesMap &plantumlFiles, const std::string &key, const std::string &value)
 
static void addPlantumlContent (PlantumlManager::ContentMap &plantumlContent, const std::string &key, const QCString &outDir, const QCString &puContent, const QCString &srcFile, int srcLine)
 

函数说明

◆ addPlantumlContent()

static void addPlantumlContent ( PlantumlManager::ContentMap plantumlContent,
const std::string &  key,
const QCString outDir,
const QCString puContent,
const QCString srcFile,
int  srcLine 
)
static

在文件 plantuml.cpp328 行定义.

331 {
332  auto kv = plantumlContent.find(key);
333  if (kv==plantumlContent.end())
334  {
335  kv = plantumlContent.insert(std::make_pair(key,PlantumlContent("",outDir,srcFile,srcLine))).first;
336  }
337  kv->second.content+=puContent;
338 }

被这些函数引用 PlantumlManager::insert().

◆ addPlantumlFiles()

static void addPlantumlFiles ( PlantumlManager::FilesMap plantumlFiles,
const std::string &  key,
const std::string &  value 
)
static

在文件 plantuml.cpp317 行定义.

319 {
320  auto kv = plantumlFiles.find(key);
321  if (kv==plantumlFiles.end())
322  {
323  kv = plantumlFiles.insert(std::make_pair(key,StringVector())).first;
324  }
325  kv->second.push_back(value);
326 }

被这些函数引用 PlantumlManager::insert().

◆ print() [1/2]

static void print ( const PlantumlManager::ContentMap plantumlContent)
static

在文件 plantuml.cpp305 行定义.

306 {
308  {
309  for (const auto &kv : plantumlContent)
310  {
311  Debug::print(Debug::Plantuml,0,"*** %s PlantumlContent key: %s\n","PlantumlManager::print Content",kv.first.c_str());
312  Debug::print(Debug::Plantuml,0,"*** %s Content:\n%s\n","PlantumlManager::print",kv.second.content.data());
313  }
314  }
315 }

引用了 Debug::isFlagSet(), Debug::Plantuml , 以及 Debug::print().

◆ print() [2/2]

static void print ( const PlantumlManager::FilesMap plantumlFiles)
static

在文件 plantuml.cpp290 行定义.

291 {
293  {
294  for (const auto &kv : plantumlFiles)
295  {
296  Debug::print(Debug::Plantuml,0,"*** %s PlantumlFiles key:%s size:%zu\n","PlantumlManager::print Files",kv.first.c_str(),kv.second.size());
297  for (const auto &s : kv.second)
298  {
299  Debug::print(Debug::Plantuml,0,"*** %s list:%s\n","PlantumlManager::print",s.c_str());
300  }
301  }
302  }
303 }

引用了 Debug::isFlagSet(), Debug::Plantuml , 以及 Debug::print().

被这些函数引用 PlantumlManager::insert().

◆ runPlantumlContent()

static void runPlantumlContent ( const PlantumlManager::FilesMap plantumlFiles,
const PlantumlManager::ContentMap plantumlContent,
PlantumlManager::OutputFormat  format 
)
static

在文件 plantuml.cpp134 行定义.

137 {
138  /* example : running: java -Djava.awt.headless=true
139  -jar "/usr/local/bin/plantuml.jar"
140  -o "test_doxygen/DOXYGEN_OUTPUT/html"
141  -tpng
142  "test_doxygen/DOXYGEN_OUTPUT/html/A.pu"
143  -charset UTF-8
144  outDir:test_doxygen/DOXYGEN_OUTPUT/html
145  test_doxygen/DOXYGEN_OUTPUT/html/A
146  */
147  int exitCode;
148  QCString plantumlJarPath = Config_getString(PLANTUML_JAR_PATH);
149  QCString plantumlConfigFile = Config_getString(PLANTUML_CFG_FILE);
150  QCString dotPath = Config_getString(DOT_PATH);
151 
152  QCString pumlExe = "java";
153  QCString pumlArgs = "";
154  QCString pumlType = "";
155  QCString pumlOutDir = "";
156 
157  const StringVector &pumlIncludePathList = Config_getList(PLANTUML_INCLUDE_PATH);
158  {
159  auto it = pumlIncludePathList.begin();
160  if (it!=pumlIncludePathList.end())
161  {
162  pumlArgs += "-Dplantuml.include.path=\"";
163  pumlArgs += it->c_str();
164  ++it;
165  }
166  while (it!=pumlIncludePathList.end())
167  {
168  pumlArgs += Portable::pathListSeparator();
169  pumlArgs += it->c_str();
170  ++it;
171  }
172  }
173  if (!pumlIncludePathList.empty()) pumlArgs += "\" ";
174  pumlArgs += "-Djava.awt.headless=true -jar \""+plantumlJarPath+"plantuml.jar\" ";
175  if (!plantumlConfigFile.isEmpty())
176  {
177  pumlArgs += "-config \"";
178  pumlArgs += plantumlConfigFile;
179  pumlArgs += "\" ";
180  }
181  if (Config_getBool(HAVE_DOT) && !dotPath.isEmpty())
182  {
183  pumlArgs += "-graphvizdot \"";
184  pumlArgs += dotPath;
185  pumlArgs += "dot";
186  pumlArgs += Portable::commandExtension();
187  pumlArgs += "\" ";
188  }
189  switch (format)
190  {
192  pumlType="png";
193  break;
195  pumlType="eps";
196  break;
198  pumlType="svg";
199  break;
200  }
201 
202  {
203  for (const auto &kv : plantumlContent)
204  {
205  const PlantumlContent &nb = kv.second;
206  if (nb.content.isEmpty()) continue;
207 
208  QCString pumlArguments = pumlArgs;
209  msg("Generating PlantUML %s Files in %s\n",qPrint(pumlType),kv.first.c_str());
210  pumlArguments+="-o \"";
211  pumlArguments+=nb.outDir;
212  pumlArguments+="\" ";
213  pumlArguments+="-charset UTF-8 -t";
214  pumlArguments+=pumlType;
215  pumlArguments+=" ";
216 
217  QCString puFileName("");
218  puFileName+=nb.outDir;
219  puFileName+="/";
220  pumlOutDir=puFileName;
221  puFileName+="inline_umlgraph_";
222  puFileName+=pumlType;
223  puFileName+=kv.first.c_str();
224  puFileName+=".pu";
225 
226  pumlArguments+="\"";
227  pumlArguments+=puFileName;
228  pumlArguments+="\" ";
229 
230 
231  QCString cachedContent;
232  FileInfo fi(puFileName.str());
233  if (fi.exists())
234  {
235  cachedContent = fileToString(puFileName);
236  }
237 
238  std::ofstream file(puFileName.str(),std::ofstream::out | std::ofstream::binary);
239  if (!file.is_open())
240  {
241  err_full(nb.srcFile,nb.srcLine,"Could not open file %s for writing\n",puFileName.data());
242  }
243  file.write( nb.content.data(), nb.content.length() );
244  file.close();
245  Debug::print(Debug::Plantuml,0,"*** %s Running Plantuml arguments:%s\n","PlantumlManager::runPlantumlContent",qPrint(pumlArguments));
246 
247  if (cachedContent == nb.content) continue;
248 
250  if ((exitCode=Portable::system(pumlExe.data(),pumlArguments.data(),TRUE))!=0)
251  {
252  err_full(nb.srcFile,nb.srcLine,"Problems running PlantUML. Verify that the command 'java -jar \"%splantuml.jar\" -h' works from the command line. Exit code: %d\n",
253  plantumlJarPath.data(),exitCode);
254  }
256 
257  if ( (format==PlantumlManager::PUML_EPS) && (Config_getBool(USE_PDFLATEX)) )
258  {
259  Debug::print(Debug::Plantuml,0,"*** %s Running epstopdf\n","PlantumlManager::runPlantumlContent");
260  auto files_kv = plantumlFiles.find(kv.first);
261  if (files_kv!=plantumlFiles.end())
262  {
263  for (const auto &str : files_kv->second)
264  {
265  const int maxCmdLine = 40960;
266  QCString epstopdfArgs(maxCmdLine);
267  epstopdfArgs.sprintf("\"%s%s.eps\" --outfile=\"%s%s.pdf\"",
268  pumlOutDir.data(),str.c_str(), pumlOutDir.data(),str.c_str());
270  if ((exitCode=Portable::system("epstopdf",epstopdfArgs.data()))!=0)
271  {
272  err_full(nb.srcFile,nb.srcLine,"Problems running epstopdf. Check your TeX installation! Exit code: %d\n",exitCode);
273  }
275  }
276  }
277  }
278  }
279  }
280 }

引用了 Portable::commandExtension(), Config_getBool, Config_getList, Config_getString, PlantumlContent::content, QCString::data(), err_full(), FileInfo::exists(), fileToString(), QCString::isEmpty(), QCString::length(), maxCmdLine, msg(), PlantumlContent::outDir, Portable::pathListSeparator(), Debug::Plantuml, Debug::print(), PlantumlManager::PUML_BITMAP, PlantumlManager::PUML_EPS, PlantumlManager::PUML_SVG, qPrint(), QCString::sprintf(), PlantumlContent::srcFile, PlantumlContent::srcLine, QCString::str(), Portable::system(), Portable::sysTimerStart(), Portable::sysTimerStop() , 以及 TRUE.

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

StringVector
std::vector< std::string > StringVector
Definition: containers.h:32
maxCmdLine
static const int maxCmdLine
Definition: dia.cpp:24
QCString::length
uint length() const
Returns the length of the string, not counting the 0-terminator.
Definition: qcstring.h:147
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
Debug::isFlagSet
static bool isFlagSet(DebugMask mask)
Definition: debug.cpp:99
PlantumlManager::PUML_BITMAP
@ PUML_BITMAP
Definition: plantuml.h:44
Portable::sysTimerStart
void sysTimerStart()
Definition: portable.cpp:470
PlantumlContent::outDir
QCString outDir
Definition: plantuml.h:34
Debug::print
static void print(DebugMask mask, int prio, const char *fmt,...)
Definition: debug.cpp:57
fileToString
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
Definition: util.cpp:1394
TRUE
#define TRUE
Definition: qcstring.h:36
Portable::system
int system(const QCString &command, const QCString &args, bool commandHasConsole=true)
Definition: portable.cpp:42
Portable::pathListSeparator
QCString pathListSeparator()
Definition: portable.cpp:356
Config_getBool
#define Config_getBool(name)
Definition: config.h:33
msg
void msg(const char *fmt,...)
Definition: message.cpp:53
PlantumlManager::PUML_EPS
@ PUML_EPS
Definition: plantuml.h:44
FileInfo
Minimal replacement for QFileInfo.
Definition: fileinfo.h:22
PlantumlContent
Definition: plantuml.h:29
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
PlantumlContent::srcFile
QCString srcFile
Definition: plantuml.h:35
Config_getString
#define Config_getString(name)
Definition: config.h:32
PlantumlContent::srcLine
int srcLine
Definition: plantuml.h:36
err_full
void err_full(const QCString &file, int line, const char *fmt,...)
Definition: message.cpp:212
Portable::sysTimerStop
void sysTimerStop()
Definition: portable.cpp:475
PlantumlContent::content
QCString content
Definition: plantuml.h:33
QCString::data
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string
Definition: qcstring.h:153
PlantumlManager::PUML_SVG
@ PUML_SVG
Definition: plantuml.h:44
Portable::commandExtension
const char * commandExtension()
Definition: portable.cpp:434
Debug::Plantuml
@ Plantuml
Definition: debug.h:40
Config_getList
#define Config_getList(name)
Definition: config.h:37
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108