Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
plantuml.h
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2015 by Dimitri van Heesch.
4
*
5
* Permission to use, copy, modify, and distribute this software and its
6
* documentation under the terms of the GNU General Public License is hereby
7
* granted. No representations are made about the suitability of this software
8
* for any purpose. It is provided "as is" without express or implied warranty.
9
* See the GNU General Public License for more details.
10
*
11
* Documents produced by Doxygen are derivative works derived from the
12
* input used in their production; they are not affected by this license.
13
*
14
*/
15
16
#ifndef PLANTUML_H
17
#define PLANTUML_H
18
19
#include <map>
20
#include <string>
21
22
#include "
containers.h
"
23
#include "
dstring.h
"
24
25
#define DIVIDE_COUNT 4
26
#define MIN_PLANTUML_COUNT 8
27
28
struct
PlantumlContent
29
{
30
PlantumlContent
(
const
DString
&content_,
const
DString
&outDir_,
const
DString
&srcFile_,
int
srcLine_)
31
:
content
(content_),
outDir
(outDir_),
srcFile
(srcFile_),
srcLine
(srcLine_) {}
32
DString
content
;
33
DString
outDir
;
34
DString
srcFile
;
35
int
srcLine
;
36
};
37
38
/** Singleton that manages plantuml relation actions */
39
class
PlantumlManager
40
{
41
public
:
42
/** Plant UML output image formats */
43
enum
OutputFormat
{
PUML_BITMAP
,
PUML_EPS
,
PUML_SVG
};
44
45
static
PlantumlManager
&
instance
();
46
47
/** Returns true if doxygen has been configured to run PlantUML, i.e. when
48
* PLANTUML_JAR_PATH or PLANTUML_TOOL has been set.
49
*/
50
static
bool
isEnabled
();
51
52
bool
needToRun
()
const
53
{
54
return
!
m_pngPlantumlContent
.empty() ||
55
!
m_svgPlantumlContent
.empty() ||
56
!
m_epsPlantumlContent
.empty();
57
}
58
59
/** Run plant UML tool for all images */
60
void
run
();
61
62
/** Write a PlantUML compatible file.
63
* @param[in] outDirArg the output directory to write the file to.
64
* @param[in] fileName the name of the file. If empty a name will be chosen automatically.
65
* @param[in] content the contents of the PlantUML file.
66
* @param[in] format the image format to generate.
67
* @param[in] engine the plantuml engine to use.
68
* @param[in] srcFile the source file resulting in the write command.
69
* @param[in] srcLine the line number resulting in the write command.
70
* @param[in] inlineCode the code is coming from the `\statuml ... \enduml` (`true`) command or
71
* from the `\planumlfile` command (`false`)
72
* @returns The names of the generated files.
73
*/
74
StringVector
writePlantUMLSource
(
const
DString
&outDirArg,
const
DString
&fileName,
75
const
DString
&content,
OutputFormat
format,
76
const
DString
&engine,
const
DString
&srcFile,
77
int
srcLine,
bool
inlineCode);
78
79
/** Convert a PlantUML file to an image.
80
* @param[in] baseName the name of the generated file (as returned by writePlantUMLSource())
81
* @param[in] outDir the directory to write the resulting image into.
82
* @param[in] format the image format to generate.
83
* @param[in] toIndex add the file to the index lists for htmlhelp / qhc etc.
84
*/
85
void
generatePlantUMLOutput
(
const
DString
&baseName,
const
DString
&outDir,
OutputFormat
format,
bool
toIndex);
86
87
using
FilesMap
= std::map< std::string, StringVector >;
88
using
ContentMap
= std::map< std::string, PlantumlContent >;
89
private
:
90
PlantumlManager
();
91
void
insert
(
const
std::string &key,
92
const
std::string &value,
93
const
DString
&outDir,
94
OutputFormat
format,
95
const
DString
&puContent,
96
const
DString
&srcFile,
97
int
srcLine);
98
void
generatePlantUmlFileNames
(
const
DString
&fileName,
OutputFormat
format,
const
DString
&outDir,
99
DString
&baseName,
DString
&puName,
DString
&imgName);
100
101
FilesMap
m_pngPlantumlFiles
;
102
FilesMap
m_svgPlantumlFiles
;
103
FilesMap
m_epsPlantumlFiles
;
104
ContentMap
m_pngPlantumlContent
;
// use circular queue for using multi-processor (multi threading)
105
ContentMap
m_svgPlantumlContent
;
106
ContentMap
m_epsPlantumlContent
;
107
};
108
109
#endif
110
DString
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition
dstring.h:88
PlantumlManager
Singleton that manages plantuml relation actions.
Definition
plantuml.h:40
PlantumlManager::m_pngPlantumlContent
ContentMap m_pngPlantumlContent
Definition
plantuml.h:104
PlantumlManager::generatePlantUMLOutput
void generatePlantUMLOutput(const DString &baseName, const DString &outDir, OutputFormat format, bool toIndex)
Convert a PlantUML file to an image.
Definition
plantuml.cpp:201
PlantumlManager::ContentMap
std::map< std::string, PlantumlContent > ContentMap
Definition
plantuml.h:88
PlantumlManager::insert
void insert(const std::string &key, const std::string &value, const DString &outDir, OutputFormat format, const DString &puContent, const DString &srcFile, int srcLine)
Definition
plantuml.cpp:484
PlantumlManager::OutputFormat
OutputFormat
Plant UML output image formats.
Definition
plantuml.h:43
PlantumlManager::PUML_BITMAP
@ PUML_BITMAP
Definition
plantuml.h:43
PlantumlManager::PUML_SVG
@ PUML_SVG
Definition
plantuml.h:43
PlantumlManager::PUML_EPS
@ PUML_EPS
Definition
plantuml.h:43
PlantumlManager::m_epsPlantumlContent
ContentMap m_epsPlantumlContent
Definition
plantuml.h:106
PlantumlManager::FilesMap
std::map< std::string, StringVector > FilesMap
Definition
plantuml.h:87
PlantumlManager::writePlantUMLSource
StringVector writePlantUMLSource(const DString &outDirArg, const DString &fileName, const DString &content, OutputFormat format, const DString &engine, const DString &srcFile, int srcLine, bool inlineCode)
Write a PlantUML compatible file.
Definition
plantuml.cpp:31
PlantumlManager::generatePlantUmlFileNames
void generatePlantUmlFileNames(const DString &fileName, OutputFormat format, const DString &outDir, DString &baseName, DString &puName, DString &imgName)
Definition
plantuml.cpp:168
PlantumlManager::isEnabled
static bool isEnabled()
Returns true if doxygen has been configured to run PlantUML, i.e.
Definition
plantuml.cpp:240
PlantumlManager::m_svgPlantumlContent
ContentMap m_svgPlantumlContent
Definition
plantuml.h:105
PlantumlManager::m_pngPlantumlFiles
FilesMap m_pngPlantumlFiles
Definition
plantuml.h:101
PlantumlManager::instance
static PlantumlManager & instance()
Definition
plantuml.cpp:230
PlantumlManager::PlantumlManager
PlantumlManager()
Definition
plantuml.cpp:236
PlantumlManager::needToRun
bool needToRun() const
Definition
plantuml.h:52
PlantumlManager::m_svgPlantumlFiles
FilesMap m_svgPlantumlFiles
Definition
plantuml.h:102
PlantumlManager::run
void run()
Run plant UML tool for all images.
Definition
plantuml.cpp:426
PlantumlManager::m_epsPlantumlFiles
FilesMap m_epsPlantumlFiles
Definition
plantuml.h:103
containers.h
StringVector
std::vector< std::string > StringVector
Definition
containers.h:33
dstring.h
PlantumlContent::content
DString content
Definition
plantuml.h:32
PlantumlContent::srcLine
int srcLine
Definition
plantuml.h:35
PlantumlContent::outDir
DString outDir
Definition
plantuml.h:33
PlantumlContent::srcFile
DString srcFile
Definition
plantuml.h:34
PlantumlContent::PlantumlContent
PlantumlContent(const DString &content_, const DString &outDir_, const DString &srcFile_, int srcLine_)
Definition
plantuml.h:30
src
plantuml.h
Generated by
1.19.0