Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
mermaid.h
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2026 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 MERMAID_H
17
#define MERMAID_H
18
19
#include <map>
20
#include <string>
21
#include <vector>
22
23
#include "
containers.h
"
24
#include "
qcstring.h
"
25
26
struct
MermaidContent
27
{
28
MermaidContent
(
const
QCString
&baseName_,
const
QCString
&content_,
29
const
QCString
&outDir_,
const
QCString
&srcFile_,
int
srcLine_)
30
:
baseName
(baseName_),
content
(content_),
outDir
(outDir_),
31
srcFile
(srcFile_),
srcLine
(srcLine_) {}
32
QCString
baseName
;
33
QCString
content
;
34
QCString
outDir
;
35
QCString
srcFile
;
36
int
srcLine
;
37
};
38
39
/** Singleton that manages Mermaid diagram rendering via the mmdc CLI tool. */
40
class
MermaidManager
41
{
42
public
:
43
/** Mermaid output image formats */
44
enum
OutputFormat
{
MERM_BITMAP
,
MERM_SVG
};
45
46
static
MermaidManager
&
instance
();
47
48
/** Run mmdc tool for all collected diagrams */
49
void
run
();
50
51
/** Write a Mermaid source file and register it for CLI rendering.
52
* @param[in] outDirArg the output directory to write the file to.
53
* @param[in] fileName the name of the file. If empty a name will be chosen automatically.
54
* @param[in] content the Mermaid diagram source.
55
* @param[in] format the image format to generate.
56
* @param[in] srcFile the source file resulting in the write command.
57
* @param[in] srcLine the line number resulting in the write command.
58
* @returns The base name of the generated file (without extension).
59
*/
60
QCString
writeMermaidSource
(
const
QCString
&outDirArg,
const
QCString
&fileName,
61
const
QCString
&content,
OutputFormat
format,
62
const
QCString
&srcFile,
int
srcLine);
63
64
/** Register a generated Mermaid image with the index.
65
* @param[in] baseName the name of the generated file (as returned by writeMermaidSource())
66
* @param[in] outDir the directory containing the resulting image.
67
* @param[in] format the image format that was generated.
68
*/
69
void
generateMermaidOutput
(
const
QCString
&baseName,
const
QCString
&outDir,
OutputFormat
format);
70
71
using
ContentList
= std::vector<MermaidContent>;
72
73
private
:
74
MermaidManager
();
75
76
static
QCString
imageExtension
(
OutputFormat
format);
77
78
ContentList
m_pngContent
;
79
ContentList
m_svgContent
;
80
};
81
82
#endif
MermaidManager
Singleton that manages Mermaid diagram rendering via the mmdc CLI tool.
Definition
mermaid.h:41
MermaidManager::run
void run()
Run mmdc tool for all collected diagrams.
Definition
mermaid.cpp:179
MermaidManager::OutputFormat
OutputFormat
Mermaid output image formats.
Definition
mermaid.h:44
MermaidManager::MERM_BITMAP
@ MERM_BITMAP
Definition
mermaid.h:44
MermaidManager::MERM_SVG
@ MERM_SVG
Definition
mermaid.h:44
MermaidManager::writeMermaidSource
QCString writeMermaidSource(const QCString &outDirArg, const QCString &fileName, const QCString &content, OutputFormat format, const QCString &srcFile, int srcLine)
Write a Mermaid source file and register it for CLI rendering.
Definition
mermaid.cpp:52
MermaidManager::generateMermaidOutput
void generateMermaidOutput(const QCString &baseName, const QCString &outDir, OutputFormat format)
Register a generated Mermaid image with the index.
Definition
mermaid.cpp:104
MermaidManager::MermaidManager
MermaidManager()
Definition
mermaid.cpp:38
MermaidManager::m_pngContent
ContentList m_pngContent
Definition
mermaid.h:78
MermaidManager::instance
static MermaidManager & instance()
Definition
mermaid.cpp:32
MermaidManager::m_svgContent
ContentList m_svgContent
Definition
mermaid.h:79
MermaidManager::imageExtension
static QCString imageExtension(OutputFormat format)
Definition
mermaid.cpp:42
MermaidManager::ContentList
std::vector< MermaidContent > ContentList
Definition
mermaid.h:71
QCString
This is an alternative implementation of QCString.
Definition
qcstring.h:101
containers.h
qcstring.h
MermaidContent::MermaidContent
MermaidContent(const QCString &baseName_, const QCString &content_, const QCString &outDir_, const QCString &srcFile_, int srcLine_)
Definition
mermaid.h:28
MermaidContent::srcFile
QCString srcFile
Definition
mermaid.h:35
MermaidContent::baseName
QCString baseName
Definition
mermaid.h:32
MermaidContent::content
QCString content
Definition
mermaid.h:33
MermaidContent::srcLine
int srcLine
Definition
mermaid.h:36
MermaidContent::outDir
QCString outDir
Definition
mermaid.h:34
src
mermaid.h
Generated by
1.17.0