Added include diagram hyperlink generation

This commit is contained in:
Bartek Kryza
2022-04-10 21:24:59 +02:00
parent 1c7edea9ad
commit 49874df533
5 changed files with 23 additions and 9 deletions
@@ -1,5 +1,5 @@
/**
* src/package_diagram/generators/plantuml/package_diagram_generator.cc
* src/include_diagram/generators/plantuml/include_diagram_generator.cc
*
* Copyright (c) 2021-2022 Bartek Kryza <bkryza@gmail.com>
*
@@ -57,14 +57,21 @@ void generator::generate(const source_file &f, std::ostream &ostr) const
if (f.type() == common::model::source_file_t::kDirectory) {
ostr << "folder " << f.name();
ostr << " as " << f.alias() << " {\n";
ostr << " as " << f.alias();
ostr << " {\n";
for (const auto &file : f) {
generate(dynamic_cast<const source_file &>(*file), ostr);
}
ostr << "}" << '\n';
}
else {
ostr << "file " << f.name() << " as " << f.alias() << '\n';
ostr << "file " << f.name() << " as " << f.alias();
if (m_config.generate_links) {
generate_link(ostr, f);
}
ostr << '\n';
}
}
@@ -77,6 +77,7 @@ void translation_unit_visitor::process_file(const std::string &file,
include_path = include_path.lexically_normal();
std::string full_file_path = include_path;
auto f_abs = std::make_unique<common::model::source_file>();
if (include_path.is_absolute())
@@ -138,6 +139,10 @@ void translation_unit_visitor::process_file(const std::string &file,
ctx.get_current_file().value().add_relationship(
common::model::relationship{relationship_type, f->alias()});
auto fp = std::filesystem::absolute(file).lexically_normal();
f->set_file(fp.string());
f->set_line(0);
}
if (!ctx.diagram().get_element(f->path() | f->name()).has_value()) {