Skip to main content

The PlantumlManager Class Reference

Singleton that manages plantuml relation actions. More...

Declaration

class PlantumlManager { ... }

Included Headers

#include <src/plantuml.h>

Public Member Typedefs Index

usingFilesMap = std::map< std::string, StringVector >
usingContentMap = std::map< std::string, PlantumlContent >

Enumerations Index

enumOutputFormat { ... }

Plant UML output image formats. More...

Private Constructors Index

PlantumlManager ()

Public Member Functions Index

voidrun ()

Run plant UML tool for all images. More...

QCStringwritePlantUMLSource (const QCString &outDirArg, const QCString &fileName, const QCString &content, OutputFormat format, const QCString &engine, const QCString &srcFile, int srcLine, bool inlineCode)

Write a PlantUML compatible file. More...

voidgeneratePlantUMLOutput (const QCString &baseName, const QCString &outDir, OutputFormat format)

Convert a PlantUML file to an image. More...

Private Member Functions Index

voidinsert (const std::string &key, const std::string &value, const QCString &outDir, OutputFormat format, const QCString &puContent, const QCString &srcFile, int srcLine)

Private Member Attributes Index

FilesMapm_pngPlantumlFiles
FilesMapm_svgPlantumlFiles
FilesMapm_epsPlantumlFiles
ContentMapm_pngPlantumlContent
ContentMapm_svgPlantumlContent
ContentMapm_epsPlantumlContent

Public Static Functions Index

static PlantumlManager &instance ()

Description

Singleton that manages plantuml relation actions.

Definition at line 40 of file plantuml.h.

Public Member Typedefs

ContentMap

using PlantumlManager::ContentMap = std::map< std::string, PlantumlContent >

Definition at line 76 of file plantuml.h.

76 using ContentMap = std::map< std::string, PlantumlContent >;

FilesMap

using PlantumlManager::FilesMap = std::map< std::string, StringVector >

Definition at line 75 of file plantuml.h.

75 using FilesMap = std::map< std::string, StringVector >;

Enumerations

OutputFormat

enum PlantumlManager::OutputFormat

Plant UML output image formats.

Enumeration values
PUML_BITMAP
PUML_EPS
PUML_SVG

Definition at line 44 of file plantuml.h.

Private Constructors

PlantumlManager()

PlantumlManager::PlantumlManager ()

Declaration at line 78 of file plantuml.h, definition at line 163 of file plantuml.cpp.

Referenced by instance.

Public Member Functions

generatePlantUMLOutput()

void PlantumlManager::generatePlantUMLOutput (const QCString & baseName, const QCString & outDir, OutputFormat format)

Convert a PlantUML file to an image.

Parameters
[in] baseName

the name of the generated file (as returned by writePlantUMLSource())

[in] outDir

the directory to write the resulting image into.

[in] format

the image format to generate.

Declaration at line 73 of file plantuml.h, definition at line 128 of file plantuml.cpp.

128void PlantumlManager::generatePlantUMLOutput(const QCString &baseName,const QCString &/* outDir */,OutputFormat format)
129{
130 QCString imgName = baseName;
131 // The basename contains path, we need to strip the path from the filename in order
132 // to create the image file name which should be included in the index.qhp (Qt help index file).
133 int i = imgName.findRev('/');
134 if (i!=-1) // strip path
135 {
136 imgName=imgName.mid(i+1);
137 }
138 switch (format)
139 {
140 case PUML_BITMAP:
141 imgName+=".png";
142 break;
143 case PUML_EPS:
144 imgName+=".eps";
145 break;
146 case PUML_SVG:
147 imgName+=".svg";
148 break;
149 }
150
151 Doxygen::indexList->addImageFile(imgName);
152}

References QCString::findRev, Doxygen::indexList, QCString::mid, PUML_BITMAP, PUML_EPS and PUML_SVG.

Referenced by FlowChart::printUmlTree, DocbookDocVisitor::startPlantUmlFile, LatexDocVisitor::startPlantUmlFile, DocbookDocVisitor::writePlantUMLFile, HtmlDocVisitor::writePlantUMLFile, LatexDocVisitor::writePlantUMLFile and RTFDocVisitor::writePlantUMLFile.

run()

writePlantUMLSource()

QCString PlantumlManager::writePlantUMLSource (const QCString & outDirArg, const QCString & fileName, const QCString & content, OutputFormat format, const QCString & engine, const QCString & srcFile, int srcLine, bool inlineCode)

Write a PlantUML compatible file.

Parameters
[in] outDirArg

the output directory to write the file to.

[in] fileName

the name of the file. If empty a name will be chosen automatically.

[in] content

the contents of the PlantUML file.

[in] format

the image format to generate.

[in] engine

the plantuml engine to use.

[in] srcFile

the source file resulting in the write command.

[in] srcLine

the line number resulting in the write command.

[in] inlineCode

the code is coming from the \statuml ... \enduml (true) command or from the \planumlfile command (false)

Returns

The name of the generated file.

Declaration at line 63 of file plantuml.h, definition at line 28 of file plantuml.cpp.

29 const QCString &content,OutputFormat format, const QCString &engine,
30 const QCString &srcFile,int srcLine,bool inlineCode)
31{
32 QCString baseName;
33 QCString puName;
34 QCString imgName;
35 QCString outDir(outDirArg);
36 static int umlindex=1;
37
38 Debug::print(Debug::Plantuml,0,"*** writePlantUMLSource fileName: {}\n",fileName);
39 Debug::print(Debug::Plantuml,0,"*** writePlantUMLSource outDir: {}\n",outDir);
40
41 // strip any trailing slashes and backslashes
42 size_t l = 0;
43 while ((l=outDir.length())>0 && (outDir.at(l-1)=='/' || outDir.at(l-1)=='\\'))
44 {
45 outDir = outDir.left(l-1);
46 }
47
48 if (fileName.isEmpty()) // generate name
49 {
50 puName = "inline_umlgraph_"+QCString().setNum(umlindex);
51 baseName = outDir+"/inline_umlgraph_"+QCString().setNum(umlindex++);
52 }
53 else // user specified name
54 {
55 baseName = fileName;
56 int i=baseName.findRev('.');
57 if (i!=-1) baseName = baseName.left(i);
58 puName = baseName;
59 baseName.prepend(outDir+"/");
60 }
61
62 switch (format)
63 {
64 case PUML_BITMAP:
65 imgName =puName+".png";
66 break;
67 case PUML_EPS:
68 imgName =puName+".eps";
69 break;
70 case PUML_SVG:
71 imgName =puName+".svg";
72 break;
73 }
74
75 Debug::print(Debug::Plantuml,0,"*** writePlantUMLSourcebaseName: {}\n",baseName);
76 Debug::print(Debug::Plantuml,0,"*** writePlantUMLSourcebaseName puName: {}\n",puName);
77 Debug::print(Debug::Plantuml,0,"*** writePlantUMLSourcebaseName imgName: {}\n",imgName);
78
79 QCString text;
80 if (inlineCode) text = "@start"+engine+" "+imgName+"\n";
81 text.reserve(text.length()+content.length()+100); // add room for image name and end marker
82 const char *p = content.data();
83 if (p)
84 {
85 char c = 0;
86 bool insideComment = false;
87 bool initial = true;
88 while ((c=*p++))
89 {
90 text+=c;
91 switch (c)
92 {
93 case '\'': insideComment=true; break;
94 case '\n': insideComment=false; break;
95 case '\t': break;
96 case ' ': break;
97 case '@':
98 if (initial && literal_at(p,"start")) // @start...
99 {
100 while ((c=*p++) && isId(c)) text+=c;
101 // insert the image name
102 text+=' ';
103 text+=imgName;
104 if (c) text+=c;
105 }
106 break;
107 default:
108 if (!insideComment) initial=false;
109 break;
110 }
111 }
112 text+='\n';
113 }
114 if (inlineCode) text +="@end"+engine+"\n";
115
116 //printf("content\n====\n%s\n=====\n->\n-----\n%s\n------\n",qPrint(content),qPrint(text));
117
118 QCString qcOutDir(substitute(outDir,"\\","/"));
119 uint32_t pos = qcOutDir.findRev("/");
120 QCString generateType(qcOutDir.right(qcOutDir.length() - (pos + 1)) );
121 Debug::print(Debug::Plantuml,0,"*** writePlantUMLSource generateType: {}\n",generateType);
122 PlantumlManager::instance().insert(generateType.str(),puName.str(),outDir,format,text,srcFile,srcLine);
123 Debug::print(Debug::Plantuml,0,"*** writePlantUMLSource generateType: {}\n",generateType);
124
125 return baseName;
126}

References QCString::at, QCString::data, QCString::findRev, insert, instance, QCString::isEmpty, isId, QCString::left, QCString::length, literal_at, Debug::Plantuml, QCString::prepend, Debug::print, PUML_BITMAP, PUML_EPS, PUML_SVG, QCString::reserve, QCString::right, QCString::setNum, QCString::str and substitute.

Referenced by DocbookDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), LatexDocVisitor::operator(), RTFDocVisitor::operator(), RTFDocVisitor::operator(), FlowChart::printUmlTree, DocbookDocVisitor::startPlantUmlFile and LatexDocVisitor::startPlantUmlFile.

Private Member Functions

insert()

void PlantumlManager::insert (const std::string & key, const std::string & value, const QCString & outDir, OutputFormat format, const QCString & puContent, const QCString & srcFile, int srcLine)

Declaration at line 79 of file plantuml.h, definition at line 373 of file plantuml.cpp.

373void PlantumlManager::insert(const std::string &key, const std::string &value,
374 const QCString &outDir,OutputFormat format,const QCString &puContent,
375 const QCString &srcFile,int srcLine)
376{
377 Debug::print(Debug::Plantuml,0,"*** PlantumlManager::insert key:{} ,value:{}\n",key,value);
378
379 switch (format)
380 {
381 case PUML_BITMAP:
384 addPlantumlContent(m_pngPlantumlContent,key,outDir,puContent,srcFile,srcLine);
386 break;
387 case PUML_EPS:
390 addPlantumlContent(m_epsPlantumlContent,key,outDir,puContent,srcFile,srcLine);
392 break;
393 case PUML_SVG:
396 addPlantumlContent(m_svgPlantumlContent,key,outDir,puContent,srcFile,srcLine);
398 break;
399 }
400}

References addPlantumlContent, addPlantumlFiles, m_epsPlantumlContent, m_epsPlantumlFiles, m_pngPlantumlContent, m_pngPlantumlFiles, m_svgPlantumlContent, m_svgPlantumlFiles, Debug::Plantuml, Debug::print, print, PUML_BITMAP, PUML_EPS and PUML_SVG.

Referenced by writePlantUMLSource.

Private Member Attributes

m_epsPlantumlContent

ContentMap PlantumlManager::m_epsPlantumlContent

Definition at line 92 of file plantuml.h.

Referenced by insert and run.

m_epsPlantumlFiles

FilesMap PlantumlManager::m_epsPlantumlFiles

Definition at line 89 of file plantuml.h.

Referenced by insert and run.

m_pngPlantumlContent

ContentMap PlantumlManager::m_pngPlantumlContent

Definition at line 90 of file plantuml.h.

90 ContentMap m_pngPlantumlContent; // use circular queue for using multi-processor (multi threading)

Referenced by insert and run.

m_pngPlantumlFiles

FilesMap PlantumlManager::m_pngPlantumlFiles

Definition at line 87 of file plantuml.h.

Referenced by insert and run.

m_svgPlantumlContent

ContentMap PlantumlManager::m_svgPlantumlContent

Definition at line 91 of file plantuml.h.

Referenced by insert and run.

m_svgPlantumlFiles

FilesMap PlantumlManager::m_svgPlantumlFiles

Definition at line 88 of file plantuml.h.

Referenced by insert and run.


The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus by Doxygen 1.14.0.