Added diagram metadata to PlantUML and JSON generators

This commit is contained in:
Bartek Kryza
2023-04-07 00:21:50 +02:00
parent a682aab21d
commit 2a6f515b47
18 changed files with 76 additions and 5 deletions

View File

@@ -21,7 +21,9 @@
#include "config/config.h"
#include "util/error.h"
#include "util/util.h"
#include "version.h"
#include <clang/Basic/Version.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Tooling/CompilationDatabase.h>
#include <clang/Tooling/Tooling.h>
@@ -110,6 +112,13 @@ public:
void generate_notes(
std::ostream &ostr, const model::element &element) const;
/**
* @brief Generate comment with diagram metadata
*
* @param ostr Output stream
*/
void generate_metadata(std::ostream &ostr) const;
/**
* @brief Generate hyper link to element
*
@@ -375,6 +384,17 @@ void generator<C, D>::generate_notes(
}
}
template <typename C, typename D>
void generator<C, D>::generate_metadata(std::ostream &ostr) const
{
if (m_config.generate_metadata()) {
ostr << '\n'
<< "'Generated with clang-uml, version "
<< clanguml::version::CLANG_UML_VERSION << '\n'
<< "'LLVM version " << clang::getClangFullVersion() << '\n';
}
}
template <typename C, typename D>
template <typename E>
void generator<C, D>::generate_link(std::ostream &ostr, const E &e) const