Fixed namespace exclusion filtering

This commit is contained in:
Bartek Kryza
2022-09-21 23:01:31 +02:00
parent 920388d84a
commit 4caf7308b2
11 changed files with 71 additions and 22 deletions

View File

@@ -96,7 +96,6 @@ void diagram_element::complete(bool completed) { complete_ = completed; }
bool operator==(const diagram_element &l, const diagram_element &r)
{
return l.id() == r.id();
// return l.full_name(false) == r.full_name(false);
}
std::ostream &operator<<(std::ostream &out, const diagram_element &rhs)

View File

@@ -173,11 +173,23 @@ tvl::value_t namespace_filter::match(
const diagram & /*d*/, const element &e) const
{
if (dynamic_cast<const package *>(&e) != nullptr) {
return tvl::any_of(
namespaces_.begin(), namespaces_.end(), [&e](const auto &nsit) {
return (e.get_namespace() | e.name()).starts_with(nsit) ||
nsit.starts_with(e.get_namespace() | e.name()) ||
return tvl::any_of(namespaces_.begin(), namespaces_.end(),
[&e, is_inclusive = is_inclusive()](const auto &nsit) {
auto element_full_name_starts_with_namespace =
(e.get_namespace() | e.name()).starts_with(nsit);
auto element_full_name_equals_pattern =
(e.get_namespace() | e.name()) == nsit;
auto namespace_starts_with_element_qualified_name =
nsit.starts_with(e.get_namespace());
auto result = element_full_name_starts_with_namespace |
element_full_name_equals_pattern;
if (is_inclusive)
result =
result | namespace_starts_with_element_qualified_name;
return result;
});
}
else {