Doxygen
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
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_) {}
37};
38
39/** Singleton that manages Mermaid diagram rendering via the mmdc CLI tool. */
41{
42 public:
43 /** Mermaid output image formats */
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:
75
77
80};
81
82#endif
Singleton that manages Mermaid diagram rendering via the mmdc CLI tool.
Definition mermaid.h:41
void run()
Run mmdc tool for all collected diagrams.
Definition mermaid.cpp:179
OutputFormat
Mermaid output image formats.
Definition mermaid.h:44
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
void generateMermaidOutput(const QCString &baseName, const QCString &outDir, OutputFormat format)
Register a generated Mermaid image with the index.
Definition mermaid.cpp:104
ContentList m_pngContent
Definition mermaid.h:78
static MermaidManager & instance()
Definition mermaid.cpp:32
ContentList m_svgContent
Definition mermaid.h:79
static QCString imageExtension(OutputFormat format)
Definition mermaid.cpp:42
std::vector< MermaidContent > ContentList
Definition mermaid.h:71
This is an alternative implementation of QCString.
Definition qcstring.h:101
MermaidContent(const QCString &baseName_, const QCString &content_, const QCString &outDir_, const QCString &srcFile_, int srcLine_)
Definition mermaid.h:28
QCString srcFile
Definition mermaid.h:35
QCString baseName
Definition mermaid.h:32
QCString content
Definition mermaid.h:33
QCString outDir
Definition mermaid.h:34