Doxygen
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
29{
30 PlantumlContent(const DString &content_, const DString &outDir_, const DString &srcFile_, int srcLine_)
31 : content(content_), outDir(outDir_), srcFile(srcFile_), srcLine(srcLine_) {}
36};
37
38/** Singleton that manages plantuml relation actions */
40{
41 public:
42 /** Plant UML output image formats */
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:
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
104 ContentMap m_pngPlantumlContent; // use circular queue for using multi-processor (multi threading)
107};
108
109#endif
110
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:88
Singleton that manages plantuml relation actions.
Definition plantuml.h:40
ContentMap m_pngPlantumlContent
Definition plantuml.h:104
void generatePlantUMLOutput(const DString &baseName, const DString &outDir, OutputFormat format, bool toIndex)
Convert a PlantUML file to an image.
Definition plantuml.cpp:201
std::map< std::string, PlantumlContent > ContentMap
Definition plantuml.h:88
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
OutputFormat
Plant UML output image formats.
Definition plantuml.h:43
ContentMap m_epsPlantumlContent
Definition plantuml.h:106
std::map< std::string, StringVector > FilesMap
Definition plantuml.h:87
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
void generatePlantUmlFileNames(const DString &fileName, OutputFormat format, const DString &outDir, DString &baseName, DString &puName, DString &imgName)
Definition plantuml.cpp:168
static bool isEnabled()
Returns true if doxygen has been configured to run PlantUML, i.e.
Definition plantuml.cpp:240
ContentMap m_svgPlantumlContent
Definition plantuml.h:105
FilesMap m_pngPlantumlFiles
Definition plantuml.h:101
static PlantumlManager & instance()
Definition plantuml.cpp:230
bool needToRun() const
Definition plantuml.h:52
FilesMap m_svgPlantumlFiles
Definition plantuml.h:102
void run()
Run plant UML tool for all images.
Definition plantuml.cpp:426
FilesMap m_epsPlantumlFiles
Definition plantuml.h:103
std::vector< std::string > StringVector
Definition containers.h:33
DString content
Definition plantuml.h:32
DString outDir
Definition plantuml.h:33
DString srcFile
Definition plantuml.h:34
PlantumlContent(const DString &content_, const DString &outDir_, const DString &srcFile_, int srcLine_)
Definition plantuml.h:30