summaryrefslogtreecommitdiffstats
path: root/src/plantuml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plantuml.cpp')
-rw-r--r--src/plantuml.cpp113
1 files changed, 67 insertions, 46 deletions
diff --git a/src/plantuml.cpp b/src/plantuml.cpp
index 9b47b93..6966100 100644
--- a/src/plantuml.cpp
+++ b/src/plantuml.cpp
@@ -26,13 +26,12 @@
#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(4096);
- QCString puName(4096);
- QCString imgName(4096);
+ QCString baseName;
+ QCString puName;
+ QCString imgName;
static int umlindex=1;
Debug::print(Debug::Plantuml,0,"*** %s fileName: %s\n","writePlantUMLSource",qPrint(fileName));
@@ -64,6 +63,7 @@ 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));
@@ -82,7 +82,7 @@ QCString writePlantUMLSource(const QCString &outDir,const QCString &fileName,con
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);
@@ -123,9 +123,12 @@ PlantumlManager *PlantumlManager::instance()
m_theInstance = new PlantumlManager;
QCString outputFilename = Config_getString(OUTPUT_DIRECTORY) + "/" + CACHE_FILENAME;
QFileInfo fi(outputFilename);
- if (fi.exists()) {
+ if (fi.exists())
+ {
m_theInstance->m_cachedPlantumlAllContent = fileToString(outputFilename);
- } else {
+ }
+ else
+ {
m_theInstance->m_cachedPlantumlAllContent = "";
}
Debug::print(Debug::Plantuml,0,"*** instance() : m_cachedPlantumlAllContent = [%s]\n",qPrint(m_theInstance->m_cachedPlantumlAllContent));
@@ -174,9 +177,18 @@ PlantumlManager::~PlantumlManager()
}
}
-void PlantumlManager::runPlantumlContent(QDict< QList <QCString> > &PlantumlFiles,QDict< QCString > &PlantumlContent,PlantUMLOutputFormat format )
+static void runPlantumlContent(const QDict< QList <QCString> > &plantumlFiles,
+ const QDict< QCString > &plantumlContent,
+ 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);
@@ -220,27 +232,24 @@ void PlantumlManager::runPlantumlContent(QDict< QList <QCString> > &PlantumlFile
}
switch (format)
{
- case PUML_BITMAP:
+ case PlantumlManager::PUML_BITMAP:
pumlType="png";
break;
- case PUML_EPS:
+ case PlantumlManager::PUML_EPS:
pumlType="eps";
break;
- case PUML_SVG:
+ case PlantumlManager::PUML_SVG:
pumlType="svg";
break;
}
{
- QDictIterator< QCString > it( PlantumlContent); // See QDictIterator
+ QDictIterator< QCString > it( plantumlContent); // See QDictIterator
QCString *nb;
for (it.toFirst();(nb=it.current());++it)
{
QCString pumlArguments(pumlArgs);
msg("Generating PlantUML %s Files in %s\n",qPrint(pumlType),qPrint(it.currentKey()));
- QList<QCString> *list = PlantumlFiles[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);
pumlArguments+="-o \"";
pumlArguments+=Config_getString(OUTPUT_DIRECTORY);
pumlArguments+="/";
@@ -282,32 +291,35 @@ void PlantumlManager::runPlantumlContent(QDict< QList <QCString> > &PlantumlFile
}
else if (Config_getBool(DOT_CLEANUP))
{
- Debug::print(Debug::Plantuml,0,"*** %s Remove %s file\n","PlantumlManager::runPlantumlContent",qPrint(puFileName));
- file.remove();
+ Debug::print(Debug::Plantuml,0,"*** %s Remove %s file\n","PlantumlManager::runPlantumlContent",qPrint(puFileName));
+ file.remove();
}
portable_sysTimerStop();
- if ( (format==PUML_EPS) && (Config_getBool(USE_PDFLATEX)) )
+ if ( (format==PlantumlManager::PUML_EPS) && (Config_getBool(USE_PDFLATEX)) )
{
Debug::print(Debug::Plantuml,0,"*** %s Running epstopdf\n","PlantumlManager::runPlantumlContent");
- QList<QCString> *list = PlantumlFiles[it.currentKey()];
- QListIterator<QCString> li(*list);
- QCString *nb;
- for (li.toFirst();(nb=li.current());++li)
+ QList<QCString> *list = plantumlFiles[it.currentKey()];
+ if (list)
{
- 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)
+ QListIterator<QCString> li(*list);
+ QCString *nb;
+ for (li.toFirst();(nb=li.current());++li)
{
- err("Problems running epstopdf. Check your TeX installation! Exit code: %d\n",exitCode);
+ 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();
}
- portable_sysTimerStop();
}
}
}
}
-
}
void PlantumlManager::run()
@@ -326,10 +338,11 @@ void PlantumlManager::run()
file.close();
}
-void PlantumlManager::print(QDict< QList <QCString> > &PlantumlFiles)
+static void print(const QDict< QList <QCString> > &plantumlFiles)
{
- if (Debug::isFlagSet(Debug::Plantuml)){
- QDictIterator< QList<QCString> > it( PlantumlFiles); // See QDictIterator
+ if (Debug::isFlagSet(Debug::Plantuml))
+ {
+ QDictIterator< QList<QCString> > it( plantumlFiles); // See QDictIterator
QList<QCString> *list;
for (it.toFirst();(list=it.current());++it)
{
@@ -344,10 +357,11 @@ void PlantumlManager::print(QDict< QList <QCString> > &PlantumlFiles)
}
}
-void PlantumlManager::print(QDict<QCString> &PlantumlContent)
+static void print(const QDict<QCString> &plantumlContent)
{
- if (Debug::isFlagSet(Debug::Plantuml)){
- QDictIterator< QCString > it( PlantumlContent); // See QDictIterator
+ if (Debug::isFlagSet(Debug::Plantuml))
+ {
+ QDictIterator< QCString > it( plantumlContent); // See QDictIterator
QCString *nb;
for (it.toFirst();(nb=it.current());++it)
{
@@ -357,28 +371,34 @@ void PlantumlManager::print(QDict<QCString> &PlantumlContent)
}
}
-void PlantumlManager::addPlantumlFiles(QDict< QList <QCString> > &PlantumlFiles,const QCString key , const QCString value)
+static void addPlantumlFiles(QDict< QList<QCString> > &plantumlFiles,
+ const QCString &key , const QCString &value)
{
- QList<QCString> *list = PlantumlFiles.find(key);
+ QList<QCString> *list = plantumlFiles.find(key);
if (list==0)
{
list = new QList<QCString>;
- PlantumlFiles.insert(key,list);
+ plantumlFiles.insert(key,list);
}
list->append(new QCString(value));
}
-void PlantumlManager::addPlantumlContent(QDict< QCString > &PlantumlContent,const QCString key , const QCString &puContent)
+static void addPlantumlContent(QDict< QCString > &plantumlContent,
+ const QCString &key, const QCString &puContent)
{
- QCString* content = PlantumlContent.find(key);
- if(content == 0){
+ QCString* content = plantumlContent.find(key);
+ if (content == 0)
+ {
content = new QCString("");
- PlantumlContent.insert(key,content);
+ plantumlContent.insert(key,content);
}
(*content)+=puContent;
}
-void PlantumlManager::insert(const QCString key , const QCString value, PlantUMLOutputFormat format,const QCString &puContent)
+
+
+void PlantumlManager::insert(const QCString &key, const QCString &value,
+ OutputFormat format,const QCString &puContent)
{
int find;
@@ -388,7 +408,8 @@ void PlantumlManager::insert(const QCString key , const QCString value, PlantUML
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
+ if (find >=0)
+ { // matched in cache. so we skip to run java for this plantuml
return ;
}