summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.xml10
-rw-r--r--src/docbookvisitor.cpp4
-rw-r--r--src/doxygen.cpp9
-rw-r--r--src/htmldocvisitor.cpp16
-rw-r--r--src/latexdocvisitor.cpp4
-rw-r--r--src/plantuml.cpp237
-rw-r--r--src/plantuml.h57
-rw-r--r--src/rtfdocvisitor.cpp4
-rw-r--r--src/vhdldocgen.cpp4
9 files changed, 162 insertions, 183 deletions
diff --git a/src/config.xml b/src/config.xml
index 9720b78..00a972d 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -3545,16 +3545,6 @@ to be found in the default search path.
]]>
</docs>
</option>
- <option type='bool' id='PLANTUML_RUN_FAST' defval='0'>
- <docs>
-<![CDATA[
-If the \c PLANTUML_RUN_FAST tag is set to \c YES, doxygen will run java once for improving the performance.
-This will run once at the end of process like dot graphics processing.
-It will remove duplicated runs when you edit a little and it will support multiple thread for multi processor.
-Finally it will reduce the doxygen running time about plantuml.
-]]>
- </docs>
- </option>
<option type='int' id='DOT_GRAPH_MAX_NODES' minval='0' maxval='10000' defval='50' depends='HAVE_DOT'>
<docs>
<![CDATA[
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp
index d35e6ad..3988390 100644
--- a/src/docbookvisitor.cpp
+++ b/src/docbookvisitor.cpp
@@ -353,7 +353,7 @@ DB_VIS_C
case DocVerbatim::PlantUML:
{
static QCString docbookOutput = Config_getString(DOCBOOK_OUTPUT);
- QCString baseName = writePlantUMLSource(docbookOutput,s->exampleFile(),s->text(),PUML_BITMAP);
+ QCString baseName = PlantumlManager::instance()->writePlantUMLSource(docbookOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP);
QCString shortName = baseName;
int i;
if ((i=shortName.findRev('/'))!=-1)
@@ -1642,7 +1642,7 @@ DB_VIS_C
shortName=shortName.right(shortName.length()-i-1);
}
QCString outDir = Config_getString(DOCBOOK_OUTPUT);
- generatePlantUMLOutput(baseName,outDir,PUML_BITMAP);
+ PlantumlManager::instance()->generatePlantUMLOutput(baseName,outDir,PlantumlManager::PUML_BITMAP);
visitPreStart(m_t, s->children(), s->hasCaption(), s->relPath() + shortName + ".png", s->width(),s->height());
visitCaption(s->children());
visitPostEnd(m_t, s->hasCaption());
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index f3c09a8..26f7637 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -11925,12 +11925,9 @@ void generateOutput()
g_s.end();
}
- if (Config_getBool(PLANTUML_RUN_FAST))
- {
- g_s.begin("Running plantuml with JAVA...\n");
- PlantumlManager::instance()->run();
- g_s.end();
- }
+ g_s.begin("Running plantuml with JAVA...\n");
+ PlantumlManager::instance()->run();
+ g_s.end();
if (Config_getBool(HAVE_DOT))
{
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index 996b5c4..92fce37 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -588,12 +588,14 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
case DocVerbatim::PlantUML:
{
forceEndParagraph(s);
-
static QCString htmlOutput = Config_getString(HTML_OUTPUT);
- QCString imgExt = getDotImageExtension();
- PlantUMLOutputFormat format = PUML_BITMAP; // default : PUML_BITMAP
- if (imgExt=="svg"){ format = PUML_SVG; }
- QCString baseName = writePlantUMLSource(htmlOutput,s->exampleFile(),s->text(),format);
+ QCString imgExt = getDotImageExtension();
+ PlantumlManager::OutputFormat format = PlantumlManager::PUML_BITMAP; // default : PUML_BITMAP
+ if (imgExt=="svg")
+ {
+ format = PlantumlManager::PUML_SVG;
+ }
+ QCString baseName = PlantumlManager::instance()->writePlantUMLSource(htmlOutput,s->exampleFile(),s->text(),format);
m_t << "<div class=\"plantumlgraph\">" << endl;
writePlantUMLFile(baseName,s->relPath(),s->context());
visitPreCaption(m_t, s);
@@ -2282,7 +2284,7 @@ void HtmlDocVisitor::writePlantUMLFile(const QCString &fileName,
QCString imgExt = getDotImageExtension();
if (imgExt=="svg")
{
- generatePlantUMLOutput(fileName,outDir,PUML_SVG);
+ PlantumlManager::instance()->generatePlantUMLOutput(fileName,outDir,PlantumlManager::PUML_SVG);
//m_t << "<iframe scrolling=\"no\" frameborder=\"0\" src=\"" << relPath << baseName << ".svg" << "\" />" << endl;
//m_t << "<p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p>";
//m_t << "</iframe>" << endl;
@@ -2290,7 +2292,7 @@ void HtmlDocVisitor::writePlantUMLFile(const QCString &fileName,
}
else
{
- generatePlantUMLOutput(fileName,outDir,PUML_BITMAP);
+ PlantumlManager::instance()->generatePlantUMLOutput(fileName,outDir,PlantumlManager::PUML_BITMAP);
m_t << "<img src=\"" << relPath << baseName << ".png" << "\" />" << endl;
}
}
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp
index 4a5998e..33fb02b 100644
--- a/src/latexdocvisitor.cpp
+++ b/src/latexdocvisitor.cpp
@@ -428,7 +428,7 @@ void LatexDocVisitor::visit(DocVerbatim *s)
case DocVerbatim::PlantUML:
{
QCString latexOutput = Config_getString(LATEX_OUTPUT);
- QCString baseName = writePlantUMLSource(latexOutput,s->exampleFile(),s->text(),PUML_EPS);
+ QCString baseName = PlantumlManager::instance()->writePlantUMLSource(latexOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_EPS);
writePlantUMLFile(baseName, s);
}
@@ -1927,7 +1927,7 @@ void LatexDocVisitor::writePlantUMLFile(const QCString &baseName, DocVerbatim *s
shortName=shortName.right(shortName.length()-i-1);
}
QCString outDir = Config_getString(LATEX_OUTPUT);
- generatePlantUMLOutput(baseName,outDir,PUML_EPS);
+ PlantumlManager::instance()->generatePlantUMLOutput(baseName,outDir,PlantumlManager::PUML_EPS);
visitPreStart(m_t, s->hasCaption(), shortName, s->width(), s->height());
visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
diff --git a/src/plantuml.cpp b/src/plantuml.cpp
index 794cd8a..6966100 100644
--- a/src/plantuml.cpp
+++ b/src/plantuml.cpp
@@ -14,6 +14,7 @@
*/
#include "plantuml.h"
+#include "util.h"
#include "portable.h"
#include "config.h"
#include "doxygen.h"
@@ -25,9 +26,8 @@
#include <qdict.h>
#include <qlist.h>
-static const int maxCmdLine = 40960;
-QCString writePlantUMLSource(const QCString &outDir,const QCString &fileName,const QCString &content,PlantUMLOutputFormat format)
+QCString PlantumlManager::writePlantUMLSource(const QCString &outDir,const QCString &fileName,const QCString &content,OutputFormat format)
{
QCString baseName;
QCString puName;
@@ -63,77 +63,31 @@ QCString writePlantUMLSource(const QCString &outDir,const QCString &fileName,con
imgName =puName+".svg";
break;
}
+
Debug::print(Debug::Plantuml,0,"*** %s baseName: %s\n","writePlantUMLSource",qPrint(baseName));
Debug::print(Debug::Plantuml,0,"*** %s puName: %s\n","writePlantUMLSource",qPrint(puName));
Debug::print(Debug::Plantuml,0,"*** %s imgName: %s\n","writePlantUMLSource",qPrint(imgName));
- QFile file(baseName+".pu");
- if (!file.open(IO_WriteOnly))
- {
- err("Could not open file %s for writing\n",baseName.data());
- }
QCString text = "@startuml "+imgName+"\n";
text+=content;
text+="\n@enduml\n";
- file.writeBlock( text, text.length() );
- file.close();
- //Debug::print(Debug::Plantuml,0,"*** %s baseFileName text: %s\n","writePlantUMLSource",qPrint(text));
- if (Config_getBool(PLANTUML_RUN_FAST))
- {
- QCString qcOutDir(outDir);
- uint pos = qcOutDir.findRev("/");
- QCString generateType(qcOutDir.right(qcOutDir.length() - (pos + 1)) );
- Debug::print(Debug::Plantuml,0,"*** %s generateType: %s\n","writePlantUMLSource",qPrint(generateType));
- PlantumlManager::instance()->insert(generateType,puName,format,text);
- }
+ QCString qcOutDir(outDir);
+ uint pos = qcOutDir.findRev("/");
+ QCString generateType(qcOutDir.right(qcOutDir.length() - (pos + 1)) );
+ Debug::print(Debug::Plantuml,0,"*** %s generateType: %s\n","writePlantUMLSource",qPrint(generateType));
+ PlantumlManager::instance()->insert(generateType,puName,format,text);
+ Debug::print(Debug::Plantuml,0,"*** %s generateType: %s\n","writePlantUMLSource",qPrint(generateType));
return baseName;
}
-void generatePlantUMLOutput(const char *baseName,const char *outDir,PlantUMLOutputFormat format)
+void PlantumlManager::generatePlantUMLOutput(const char *baseName,const char *outDir,OutputFormat format)
{
QCString plantumlJarPath = Config_getString(PLANTUML_JAR_PATH);
QCString plantumlConfigFile = Config_getString(PLANTUML_CFG_FILE);
QCString dotPath = Config_getString(DOT_PATH);
- QCString pumlExe = "java";
- QCString pumlArgs = "";
-
- //printf("*** %s %s\n","generatePlantUMLOutput",baseName);
- QStrList &pumlIncludePathList = Config_getList(PLANTUML_INCLUDE_PATH);
- char *s=pumlIncludePathList.first();
- if (s)
- {
- pumlArgs += "-Dplantuml.include.path=\"";
- pumlArgs += s;
- s = pumlIncludePathList.next();
- }
- while (s)
- {
- pumlArgs += portable_pathListSeparator();
- pumlArgs += s;
- s = pumlIncludePathList.next();
- }
- if (pumlIncludePathList.first()) pumlArgs += "\" ";
- pumlArgs += "-Djava.awt.headless=true -jar \""+plantumlJarPath+"plantuml.jar\" ";
- if (!plantumlConfigFile.isEmpty())
- {
- pumlArgs += "-config \"";
- pumlArgs += plantumlConfigFile;
- pumlArgs += "\" ";
- }
- if (Config_getBool(HAVE_DOT) && !dotPath.isEmpty())
- {
- pumlArgs += "-graphvizdot \"";
- pumlArgs += dotPath;
- pumlArgs += "dot";
- pumlArgs += portable_commandExtension();
- pumlArgs += "\" ";
- }
- pumlArgs+="-o \"";
- pumlArgs+=outDir;
- pumlArgs+="\" ";
QCString imgName = baseName;
// The basename contains path, we need to strip the path from the filename in order
// to create the image file name which should be included in the index.qhp (Qt help index file).
@@ -145,50 +99,16 @@ void generatePlantUMLOutput(const char *baseName,const char *outDir,PlantUMLOutp
switch (format)
{
case PUML_BITMAP:
- pumlArgs+="-tpng";
imgName+=".png";
break;
case PUML_EPS:
- pumlArgs+="-teps";
imgName+=".eps";
break;
case PUML_SVG:
- pumlArgs+="-tsvg";
imgName+=".svg";
break;
}
- pumlArgs+=" \"";
- pumlArgs+=baseName;
- pumlArgs+=".pu\" ";
- pumlArgs+="-charset UTF-8 ";
- int exitCode;
- msg("Running PlantUML on generated file %s.pu\n",baseName);
- if (!Config_getBool(PLANTUML_RUN_FAST))
- {
- portable_sysTimerStart();
- Debug::print(Debug::Plantuml,0,"*** running: %s %s outDir:%s %s\n",qPrint(pumlExe),qPrint(pumlArgs),outDir,baseName);
- if ((exitCode=portable_system(pumlExe,pumlArgs,TRUE))!=0)
- {
- err("Problems running PlantUML. Verify that the command 'java -jar \"%splantuml.jar\" -h' works from the command line. Exit code: %d\n",
- plantumlJarPath.data(),exitCode);
- }
- else if (Config_getBool(DOT_CLEANUP))
- {
- QFile(QCString(baseName)+".pu").remove();
- }
- portable_sysTimerStop();
- if (format==PUML_EPS && Config_getBool(USE_PDFLATEX))
- {
- QCString epstopdfArgs(maxCmdLine);
- epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"",baseName,baseName);
- portable_sysTimerStart();
- if ((exitCode=portable_system("epstopdf",epstopdfArgs))!=0)
- {
- err("Problems running epstopdf. Check your TeX installation! Exit code: %d\n",exitCode);
- }
- portable_sysTimerStop();
- }
- }
+
Doxygen::indexList->addImageFile(imgName);
}
@@ -201,6 +121,20 @@ PlantumlManager *PlantumlManager::instance()
if (!m_theInstance)
{
m_theInstance = new PlantumlManager;
+ QCString outputFilename = Config_getString(OUTPUT_DIRECTORY) + "/" + CACHE_FILENAME;
+ QFileInfo fi(outputFilename);
+ if (fi.exists())
+ {
+ m_theInstance->m_cachedPlantumlAllContent = fileToString(outputFilename);
+ }
+ else
+ {
+ m_theInstance->m_cachedPlantumlAllContent = "";
+ }
+ Debug::print(Debug::Plantuml,0,"*** instance() : m_cachedPlantumlAllContent = [%s]\n",qPrint(m_theInstance->m_cachedPlantumlAllContent));
+ m_theInstance->m_pngPlantumlContent.clear();
+ m_theInstance->m_svgPlantumlContent.clear();
+ m_theInstance->m_epsPlantumlContent.clear();
}
return m_theInstance;
}
@@ -245,9 +179,16 @@ PlantumlManager::~PlantumlManager()
static void runPlantumlContent(const QDict< QList <QCString> > &plantumlFiles,
const QDict< QCString > &plantumlContent,
- const char *type)
+ PlantumlManager::OutputFormat format)
{
- /* example : running: java -Djava.awt.headless=true -jar "/Users/cheoljoo/code/common_telltale/GP/Apps/Src/MgrTelltale/tools/plantuml.jar" -o "/Users/cheoljoo/Code/LG/test_doxygen/DOXYGEN_OUTPUT/html" -tpng "/Users/cheoljoo/Code/LG/test_doxygen/DOXYGEN_OUTPUT/html/A.pu" -charset UTF-8 outDir:/Users/cheoljoo/Code/LG/test_doxygen/DOXYGEN_OUTPUT/html /Users/cheoljoo/Code/LG/test_doxygen/DOXYGEN_OUTPUT/html/A
+ /* example : running: java -Djava.awt.headless=true
+ -jar "/usr/local/bin/plantuml.jar"
+ -o "test_doxygen/DOXYGEN_OUTPUT/html"
+ -tpng
+ "test_doxygen/DOXYGEN_OUTPUT/html/A.pu"
+ -charset UTF-8
+ outDir:test_doxygen/DOXYGEN_OUTPUT/html
+ test_doxygen/DOXYGEN_OUTPUT/html/A
*/
int exitCode;
QCString plantumlJarPath = Config_getString(PLANTUML_JAR_PATH);
@@ -256,6 +197,8 @@ static void runPlantumlContent(const QDict< QList <QCString> > &plantumlFiles,
QCString pumlExe = "java";
QCString pumlArgs = "";
+ QCString pumlType = "";
+ QCString pumlOutDir = "";
QStrList &pumlIncludePathList = Config_getList(PLANTUML_INCLUDE_PATH);
char *s=pumlIncludePathList.first();
@@ -263,13 +206,13 @@ static void runPlantumlContent(const QDict< QList <QCString> > &plantumlFiles,
{
pumlArgs += "-Dplantuml.include.path=\"";
pumlArgs += s;
- s = pumlIncludePathList.next();
+ s = pumlIncludePathList.next();
}
while (s)
{
pumlArgs += portable_pathListSeparator();
pumlArgs += s;
- s = pumlIncludePathList.next();
+ s = pumlIncludePathList.next();
}
if (pumlIncludePathList.first()) pumlArgs += "\" ";
pumlArgs += "-Djava.awt.headless=true -jar \""+plantumlJarPath+"plantuml.jar\" ";
@@ -287,6 +230,18 @@ static void runPlantumlContent(const QDict< QList <QCString> > &plantumlFiles,
pumlArgs += portable_commandExtension();
pumlArgs += "\" ";
}
+ switch (format)
+ {
+ case PlantumlManager::PUML_BITMAP:
+ pumlType="png";
+ break;
+ case PlantumlManager::PUML_EPS:
+ pumlType="eps";
+ break;
+ case PlantumlManager::PUML_SVG:
+ pumlType="svg";
+ break;
+ }
{
QDictIterator< QCString > it( plantumlContent); // See QDictIterator
@@ -294,14 +249,14 @@ static void runPlantumlContent(const QDict< QList <QCString> > &plantumlFiles,
for (it.toFirst();(nb=it.current());++it)
{
QCString pumlArguments(pumlArgs);
- msg("Running PlantUML on png plantumlFiles in %s\n",qPrint(it.currentKey()));
+ msg("Generating PlantUML %s Files in %s\n",qPrint(pumlType),qPrint(it.currentKey()));
pumlArguments+="-o \"";
pumlArguments+=Config_getString(OUTPUT_DIRECTORY);
pumlArguments+="/";
pumlArguments+=it.currentKey();
pumlArguments+="\" ";
pumlArguments+="-charset UTF-8 -t";
- pumlArguments+=type;
+ pumlArguments+=pumlType;
pumlArguments+=" ";
QCString puFileName("");
@@ -309,8 +264,9 @@ static void runPlantumlContent(const QDict< QList <QCString> > &plantumlFiles,
puFileName+="/";
puFileName+=it.currentKey();
puFileName+="/";
+ pumlOutDir=puFileName;
puFileName+="inline_umlgraph_";
- puFileName+=type;
+ puFileName+=pumlType;
puFileName+=it.currentKey();
puFileName+=".pu";
@@ -326,6 +282,8 @@ static void runPlantumlContent(const QDict< QList <QCString> > &plantumlFiles,
file.writeBlock( *nb, nb->length() );
file.close();
Debug::print(Debug::Plantuml,0,"*** %s Running Plantuml arguments:%s\n","PlantumlManager::runPlantumlContent",qPrint(pumlArguments));
+
+ portable_sysTimerStart();
if ((exitCode=portable_system(pumlExe,pumlArguments,TRUE))!=0)
{
err("Problems running PlantUML. Verify that the command 'java -jar \"%splantuml.jar\" -h' works from the command line. Exit code: %d\n",
@@ -333,36 +291,53 @@ static void runPlantumlContent(const QDict< QList <QCString> > &plantumlFiles,
}
else if (Config_getBool(DOT_CLEANUP))
{
+ Debug::print(Debug::Plantuml,0,"*** %s Remove %s file\n","PlantumlManager::runPlantumlContent",qPrint(puFileName));
file.remove();
}
- }
- }
+ portable_sysTimerStop();
- {
- QDictIterator< QList<QCString> > it( plantumlFiles); // See QDictIterator
- QList<QCString> *list;
- for (it.toFirst();(list=it.current());++it)
- {
- QListIterator<QCString> li(*list);
- QCString *nb;
- if (Config_getBool(DOT_CLEANUP))
+ if ( (format==PlantumlManager::PUML_EPS) && (Config_getBool(USE_PDFLATEX)) )
{
- for (li.toFirst();(nb=li.current());++li)
+ Debug::print(Debug::Plantuml,0,"*** %s Running epstopdf\n","PlantumlManager::runPlantumlContent");
+ QList<QCString> *list = plantumlFiles[it.currentKey()];
+ if (list)
{
- QCString pumlName = "";
- pumlName+=Config_getString(OUTPUT_DIRECTORY);
- pumlName+="/";
- pumlName+=it.currentKey();
- pumlName+="/";
- pumlName+=*nb;
- pumlName+=".pu";
- QFile(pumlName).remove();
+ QListIterator<QCString> li(*list);
+ QCString *nb;
+ for (li.toFirst();(nb=li.current());++li)
+ {
+ const int maxCmdLine = 40960;
+ QCString epstopdfArgs(maxCmdLine);
+ epstopdfArgs.sprintf("\"%s%s.eps\" --outfile=\"%s%s.pdf\"",qPrint(pumlOutDir),qPrint(*nb),qPrint(pumlOutDir),qPrint(*nb));
+ portable_sysTimerStart();
+ if ((exitCode=portable_system("epstopdf",epstopdfArgs))!=0)
+ {
+ err("Problems running epstopdf. Check your TeX installation! Exit code: %d\n",exitCode);
+ }
+ portable_sysTimerStop();
+ }
}
}
}
}
}
+void PlantumlManager::run()
+{
+ Debug::print(Debug::Plantuml,0,"*** %s\n","PlantumlManager::run");
+ runPlantumlContent(m_pngPlantumlFiles, m_pngPlantumlContent, PUML_BITMAP);
+ runPlantumlContent(m_svgPlantumlFiles, m_svgPlantumlContent, PUML_SVG);
+ runPlantumlContent(m_epsPlantumlFiles, m_epsPlantumlContent, PUML_EPS);
+ QCString outputFilename = Config_getString(OUTPUT_DIRECTORY) + "/" + CACHE_FILENAME;
+ QFile file(outputFilename);
+ if (!file.open(IO_WriteOnly))
+ {
+ err("Could not open file %s for writing\n",CACHE_FILENAME);
+ }
+ file.writeBlock( m_currentPlantumlAllContent, m_currentPlantumlAllContent.length() );
+ file.close();
+}
+
static void print(const QDict< QList <QCString> > &plantumlFiles)
{
if (Debug::isFlagSet(Debug::Plantuml))
@@ -371,7 +346,7 @@ static void print(const QDict< QList <QCString> > &plantumlFiles)
QList<QCString> *list;
for (it.toFirst();(list=it.current());++it)
{
- Debug::print(Debug::Plantuml,0,"*** %s PlantumlFiles key:%s\n","PlantumlManager::print",qPrint(it.currentKey()));
+ Debug::print(Debug::Plantuml,0,"*** %s PlantumlFiles key:%s size:%d\n","PlantumlManager::print Files",qPrint(it.currentKey()),(*list).count());
QListIterator<QCString> li(*list);
QCString *nb;
for (li.toFirst();(nb=li.current());++li)
@@ -390,7 +365,7 @@ static void print(const QDict<QCString> &plantumlContent)
QCString *nb;
for (it.toFirst();(nb=it.current());++it)
{
- Debug::print(Debug::Plantuml,0,"*** %s PlantumlContent key:%s\n","PlantumlManager::print",qPrint(it.currentKey()));
+ Debug::print(Debug::Plantuml,0,"*** %s PlantumlContent key:%s\n","PlantumlManager::print Content",qPrint(it.currentKey()));
Debug::print(Debug::Plantuml,0,"*** %s Content :%s\n","PlantumlManager::print",qPrint(*nb));
}
}
@@ -409,7 +384,7 @@ static void addPlantumlFiles(QDict< QList<QCString> > &plantumlFiles,
}
static void addPlantumlContent(QDict< QCString > &plantumlContent,
- const QCString &key, const QCString &puContent)
+ const QCString &key, const QCString &puContent)
{
QCString* content = plantumlContent.find(key);
if (content == 0)
@@ -420,18 +395,24 @@ static void addPlantumlContent(QDict< QCString > &plantumlContent,
(*content)+=puContent;
}
-void PlantumlManager::run()
-{
- Debug::print(Debug::Plantuml,0,"*** %s\n","PlantumlManager::run");
- runPlantumlContent(m_pngPlantumlFiles, m_pngPlantumlContent, "png");
- runPlantumlContent(m_svgPlantumlFiles, m_svgPlantumlContent, "svg");
- runPlantumlContent(m_epsPlantumlFiles, m_epsPlantumlContent, "eps");
-}
+
void PlantumlManager::insert(const QCString &key, const QCString &value,
- PlantUMLOutputFormat format,const QCString &puContent)
+ OutputFormat format,const QCString &puContent)
{
+ int find;
+
Debug::print(Debug::Plantuml,0,"*** %s key:%s ,value:%s\n","PlantumlManager::insert",qPrint(key),qPrint(value));
+
+ m_currentPlantumlAllContent+=puContent;
+
+ find = m_cachedPlantumlAllContent.find(puContent);
+ Debug::print(Debug::Plantuml,0,"*** %s find: %d\n","PlantumlManager::addPlantumlContent",find);
+ if (find >=0)
+ { // matched in cache. so we skip to run java for this plantuml
+ return ;
+ }
+
switch (format)
{
case PUML_BITMAP:
diff --git a/src/plantuml.h b/src/plantuml.h
index b8f9f5a..6c99eba 100644
--- a/src/plantuml.h
+++ b/src/plantuml.h
@@ -19,47 +19,56 @@
#include <qdict.h>
#include <qlist.h>
-class QCString;
-
-/** Plant UML output image formats */
-enum PlantUMLOutputFormat { PUML_BITMAP, PUML_EPS, PUML_SVG };
-
-/** Write a PlantUML compatible file.
- * @param[in] outDir the output directory to write the file to.
- * @param[in] fileName the name of the file. If empty a name will be chosen automatically.
- * @param[in] content the contents of the PlantUML file.
- * @param[in] format the image format to generate.
- * @returns The name of the generated file.
- */
-QCString writePlantUMLSource(const QCString &outDir,const QCString &fileName,const QCString &content,PlantUMLOutputFormat format);
+#define CACHE_FILENAME "inline_umlgraph_cache_all.pu"
+#define DIVIDE_COUNT 4
+#define MIN_PLANTUML_COUNT 8
-/** Convert a PlantUML file to an image.
- * @param[in] baseName the name of the generated file (as returned by writePlantUMLSource())
- * @param[in] outDir the directory to write the resulting image into.
- * @param[in] format the image format to generate.
- */
-void generatePlantUMLOutput(const char *baseName,const char *outDir,PlantUMLOutputFormat format);
+class QCString;
/** Singleton that manages plantuml relation actions */
class PlantumlManager
{
public:
+ /** Plant UML output image formats */
+ enum OutputFormat { PUML_BITMAP, PUML_EPS, PUML_SVG };
+
static PlantumlManager *instance();
+
+ /** Run plant UML tool for all images */
void run();
+
+ /** Write a PlantUML compatible file.
+ * @param[in] outDir the output directory to write the file to.
+ * @param[in] fileName the name of the file. If empty a name will be chosen automatically.
+ * @param[in] content the contents of the PlantUML file.
+ * @param[in] format the image format to generate.
+ * @returns The name of the generated file.
+ */
+ QCString writePlantUMLSource(const QCString &outDir,const QCString &fileName,const QCString &content, OutputFormat format);
+
+ /** Convert a PlantUML file to an image.
+ * @param[in] baseName the name of the generated file (as returned by writePlantUMLSource())
+ * @param[in] outDir the directory to write the resulting image into.
+ * @param[in] format the image format to generate.
+ */
+ void generatePlantUMLOutput(const char *baseName,const char *outDir,OutputFormat format);
+
+ private:
+ PlantumlManager();
+ ~PlantumlManager();
void insert(const QCString &key,
const QCString &value,
- PlantUMLOutputFormat format,
+ OutputFormat format,
const QCString &puContent);
- private:
- PlantumlManager();
- virtual ~PlantumlManager();
static PlantumlManager *m_theInstance;
QDict< QList<QCString> > m_pngPlantumlFiles;
QDict< QList<QCString> > m_svgPlantumlFiles;
QDict< QList<QCString> > m_epsPlantumlFiles;
- QDict< QCString > m_pngPlantumlContent;
+ QDict< QCString > m_pngPlantumlContent; // use circular queue for using multi-proecessor (multi threading)
QDict< QCString > m_svgPlantumlContent;
QDict< QCString > m_epsPlantumlContent;
+ QCString m_cachedPlantumlAllContent; // read from CACHE_FILENAME file
+ QCString m_currentPlantumlAllContent; // processing plantuml then write it into CACHE_FILENAME to reuse the next time as cache information
};
#endif
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp
index b79af05..1e2bb89 100644
--- a/src/rtfdocvisitor.cpp
+++ b/src/rtfdocvisitor.cpp
@@ -383,7 +383,7 @@ void RTFDocVisitor::visit(DocVerbatim *s)
case DocVerbatim::PlantUML:
{
static QCString rtfOutput = Config_getString(RTF_OUTPUT);
- QCString baseName = writePlantUMLSource(rtfOutput,s->exampleFile(),s->text(),PUML_BITMAP);
+ QCString baseName = PlantumlManager::instance()->writePlantUMLSource(rtfOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP);
writePlantUMLFile(baseName, s->hasCaption());
visitCaption(this, s->children());
@@ -1868,6 +1868,6 @@ void RTFDocVisitor::writePlantUMLFile(const QCString &fileName, bool hasCaption)
baseName=baseName.right(baseName.length()-i-1);
}
QCString outDir = Config_getString(RTF_OUTPUT);
- generatePlantUMLOutput(fileName,outDir,PUML_BITMAP);
+ PlantumlManager::instance()->generatePlantUMLOutput(fileName,outDir,PlantumlManager::PUML_BITMAP);
includePicturePreRTF(baseName + ".png", true, hasCaption);
}
diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp
index c34f0b8..808b32b 100644
--- a/src/vhdldocgen.cpp
+++ b/src/vhdldocgen.cpp
@@ -3774,8 +3774,8 @@ void FlowChart::printUmlTree()
QCString n=convertNameToFileName();
QCString tmp=htmlOutDir;
- n=writePlantUMLSource(tmp,n,qcs,PUML_SVG);
- generatePlantUMLOutput(n.data(),tmp.data(),PUML_SVG);
+ n=PlantumlManager::instance()->writePlantUMLSource(tmp,n,qcs,PlantumlManager::PUML_SVG);
+ PlantumlManager::instance()->generatePlantUMLOutput(n.data(),tmp.data(),PlantumlManager::PUML_SVG);
}
QCString FlowChart::convertNameToFileName()