浏览该文件的文档.
34 static int umlindex=1;
41 while ((l=outDir.
length())>0 && (outDir.
at(l-1)==
'/' || outDir.
at(l-1)==
'\\'))
43 outDir = outDir.
left(l-1);
48 puName =
"inline_umlgraph_"+
QCString().setNum(umlindex);
49 baseName = outDir+
"/inline_umlgraph_"+
QCString().setNum(umlindex++);
55 if (i!=-1) baseName = baseName.
left(i);
63 imgName =puName+
".png";
66 imgName =puName+
".eps";
69 imgName =puName+
".svg";
77 QCString text =
"@start"+engine+
" "+imgName+
"\n";
79 text+=
"\n@end"+engine+
"\n";
101 if ((i=imgName.
findRev(
'/'))!=-1)
159 auto it = pumlIncludePathList.begin();
160 if (it!=pumlIncludePathList.end())
162 pumlArgs +=
"-Dplantuml.include.path=\"";
163 pumlArgs += it->c_str();
166 while (it!=pumlIncludePathList.end())
169 pumlArgs += it->c_str();
173 if (!pumlIncludePathList.empty()) pumlArgs +=
"\" ";
174 pumlArgs +=
"-Djava.awt.headless=true -jar \""+plantumlJarPath+
"plantuml.jar\" ";
175 if (!plantumlConfigFile.
isEmpty())
177 pumlArgs +=
"-config \"";
178 pumlArgs += plantumlConfigFile;
183 pumlArgs +=
"-graphvizdot \"";
203 for (
const auto &kv : plantumlContent)
209 msg(
"Generating PlantUML %s Files in %s\n",
qPrint(pumlType),kv.first.c_str());
210 pumlArguments+=
"-o \"";
212 pumlArguments+=
"\" ";
213 pumlArguments+=
"-charset UTF-8 -t";
214 pumlArguments+=pumlType;
220 pumlOutDir=puFileName;
221 puFileName+=
"inline_umlgraph_";
222 puFileName+=pumlType;
223 puFileName+=kv.first.c_str();
227 pumlArguments+=puFileName;
228 pumlArguments+=
"\" ";
238 std::ofstream file(puFileName.
str(),std::ofstream::out | std::ofstream::binary);
247 if (cachedContent == nb.
content)
continue;
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);
260 auto files_kv = plantumlFiles.find(kv.first);
261 if (files_kv!=plantumlFiles.end())
263 for (
const auto &
str : files_kv->second)
267 epstopdfArgs.
sprintf(
"\"%s%s.eps\" --outfile=\"%s%s.pdf\"",
272 err_full(nb.
srcFile,nb.
srcLine,
"Problems running epstopdf. Check your TeX installation! Exit code: %d\n",exitCode);
294 for (
const auto &kv : plantumlFiles)
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)
309 for (
const auto &kv : plantumlContent)
318 const std::string &key,
const std::string &value)
320 auto kv = plantumlFiles.find(key);
321 if (kv==plantumlFiles.end())
323 kv = plantumlFiles.insert(std::make_pair(key,
StringVector())).first;
325 kv->second.push_back(value);
330 const QCString &srcFile,
int srcLine)
332 auto kv = plantumlContent.find(key);
333 if (kv==plantumlContent.end())
335 kv = plantumlContent.insert(std::make_pair(key,
PlantumlContent(
"",outDir,srcFile,srcLine))).first;
337 kv->second.content+=puContent;
342 const QCString &srcFile,
int srcLine)
ContentMap m_epsPlantumlContent
QCString writePlantUMLSource(const QCString &outDir, const QCString &fileName, const QCString &content, OutputFormat format, const QCString &engine, const QCString &srcFile, int srcLine)
Write a PlantUML compatible file.
std::vector< std::string > StringVector
static void runPlantumlContent(const PlantumlManager::FilesMap &plantumlFiles, const PlantumlManager::ContentMap &plantumlContent, PlantumlManager::OutputFormat format)
static const int maxCmdLine
uint length() const
Returns the length of the string, not counting the 0-terminator.
FilesMap m_epsPlantumlFiles
OutputFormat
Plant UML output image formats
int findRev(char c, int index=-1, bool cs=TRUE) const
bool isEmpty() const
Returns TRUE iff the string is empty
FilesMap m_pngPlantumlFiles
static IndexList * indexList
std::map< std::string, PlantumlContent > ContentMap
static PlantumlManager & instance()
char & at(size_t i)
Returns a reference to the character at index i.
static void addPlantumlContent(PlantumlManager::ContentMap &plantumlContent, const std::string &key, const QCString &outDir, const QCString &puContent, const QCString &srcFile, int srcLine)
ContentMap m_pngPlantumlContent
static bool isFlagSet(DebugMask mask)
ContentMap m_svgPlantumlContent
FilesMap m_svgPlantumlFiles
QCString left(size_t len) const
void addImageFile(const QCString &name)
void insert(const std::string &key, const std::string &value, const QCString &outDir, OutputFormat format, const QCString &puContent, const QCString &srcFile, int srcLine)
static void addPlantumlFiles(PlantumlManager::FilesMap &plantumlFiles, const std::string &key, const std::string &value)
static void print(DebugMask mask, int prio, const char *fmt,...)
std::map< std::string, StringVector > FilesMap
Singleton that manages plantuml relation actions
void run()
Run plant UML tool for all images
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
static void print(const PlantumlManager::FilesMap &plantumlFiles)
int system(const QCString &command, const QCString &args, bool commandHasConsole=true)
QCString pathListSeparator()
#define Config_getBool(name)
void msg(const char *fmt,...)
Minimal replacement for QFileInfo.
const char * qPrint(const char *s)
#define Config_getString(name)
void err_full(const QCString &file, int line, const char *fmt,...)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string
const char * commandExtension()
Portable versions of functions that are platform dependent.
void generatePlantUMLOutput(const QCString &baseName, const QCString &outDir, OutputFormat format)
Convert a PlantUML file to an image.
A bunch of utility functions.
QCString right(size_t len) const
QCString & prepend(const char *s)
QCString & sprintf(const char *format,...)
#define Config_getList(name)
This is an alternative implementation of QCString.