Added alias resolution in include diagrams

This commit is contained in:
Bartek Kryza
2022-04-10 16:18:04 +02:00
parent 7c8e41a714
commit 1c7edea9ad
2 changed files with 17 additions and 2 deletions

View File

@@ -61,7 +61,19 @@ std::string diagram::to_alias(const std::string &full_name) const
{
LOG_DBG("Looking for alias for {}", full_name);
return full_name;
auto path = common::model::filesystem_path{full_name};
if (path.is_empty())
throw error::uml_alias_missing(
fmt::format("Missing alias for '{}'", path.to_string()));
auto source_file = get_element<common::model::source_file>(path);
if (!source_file)
throw error::uml_alias_missing(
fmt::format("Missing alias for '{}'", path.to_string()));
return source_file.value().alias();
}
}

View File

@@ -16,4 +16,7 @@ diagrams:
- ../../tests/t40001
plantuml:
before:
- "' t40001 test include diagram"
- "' t40001 test include diagram"
after:
- 'note right of {{ alias("include/lib1") }}: This is a lib1 include dir'
- 'note right of {{ alias("include/t40001_include1.h") }}: This is a t40001_include1.h include file'