27#include <clang/Basic/Version.h>
28#include <clang/Frontend/CompilerInstance.h>
29#include <clang/Tooling/CompilationDatabase.h>
30#include <clang/Tooling/Tooling.h>
31#include <glob/glob.hpp>
32#include <inja/inja.hpp>
47std::string
indent(
unsigned level);
49std::string
escape_name(std::string name,
bool round_brackets =
true);
57template <
typename ConfigType,
typename DiagramType>
85 void generate(std::ostream &ostr)
const override;
108 std::ostream &ostr,
const std::vector<std::string> &directives)
const;
160 template <
typename E>
176template <
typename C,
typename D>
182 if (!config.allow_empty_diagrams() && model.is_empty() &&
183 config.mermaid().before.empty() && config.mermaid().after.empty()) {
185 "Diagram configuration resulted in empty diagram."};
190 generate_title(ostr);
192 generate_diagram_type(ostr);
194 generate_mermaid_directives(ostr, config.mermaid().before);
198 generate_mermaid_directives(ostr, config.mermaid().after);
200 generate_metadata(ostr);
203template <
typename C,
typename D>
210 if (!maybe_link && !maybe_tooltip)
214 ostr <<
indent(1) <<
"click " << e.alias() <<
" href \"";
216 if (!maybe_link || maybe_link->empty())
224 if (maybe_tooltip && !maybe_tooltip->empty()) {
225 auto tooltip = *maybe_tooltip;
237template <
typename C,
typename D>
239 std::ostream &ostr,
const std::vector<std::string> &directives)
const
243 for (
const auto &d : directives) {
246 if (rendered_directive)
247 ostr <<
indent(1) << *rendered_directive <<
'\n';
251template <
typename C,
typename D>
257 for (
const auto &decorator : e.
decorators()) {
258 auto note = std::dynamic_pointer_cast<decorators::note>(decorator);
259 if (note && note->applies_to_diagram(config.name)) {
260 ostr <<
indent(1) <<
"note for " << e.
alias() <<
" \"" << note->text
266template <
typename C,
typename D>
271 if (config.generate_metadata()) {
273 <<
"%% Generated with clang-uml, version "
275 <<
"%% LLVM version " << clang::getClangFullVersion() <<
'\n';
279template <
typename C,
typename D>
286 ostr <<
"title: " << config.title() <<
'\n';
291template <
typename C,
typename D>
297 if (config.debug_mode()) {
301 else if (!e.
file().empty()) {
302 ostr <<
"%% " << e.
file() <<
":" << e.
line() <<
'\n';
307template <
typename DiagramModel,
typename DiagramConfig>