Fixed include diagram test cases

This commit is contained in:
Bartek Kryza
2022-08-03 01:05:01 +02:00
parent cd9d9cf5a7
commit 392be99055
19 changed files with 382 additions and 98 deletions

View File

@@ -357,6 +357,10 @@ tvl::value_t paths_filter::match(
return {};
}
// Matching source paths doesn't make sens if they are not absolute
if(!p.is_absolute())
return {};
auto pp = p.fs_path(root_);
for (const auto &path : paths_) {
if (util::starts_with(pp, path))

View File

@@ -238,8 +238,9 @@ private:
// of matching elements
for (const auto &template_root : roots_) {
auto template_ref = detail::get<ElementT>(cd, template_root);
if (template_ref.has_value())
if (template_ref.has_value()) {
matching_elements_.emplace(template_ref.value());
}
}
assert(roots_.empty() == matching_elements_.empty());

View File

@@ -17,6 +17,7 @@
*/
#pragma once
#include "common/clang_utils.h"
#include "common/model/diagram_element.h"
#include "common/model/nested_trait.h"
#include "common/model/path.h"
@@ -51,17 +52,20 @@ class source_file
public:
source_file() = default;
source_file(const std::filesystem::path &p)
explicit source_file(const std::filesystem::path &p)
{
set_path({p.parent_path().string()});
set_name(p.filename());
is_absolute_ = p.is_absolute();
set_id(common::to_id(p));
}
void set_path(const filesystem_path &p) { path_ = p; }
void set_absolute() { is_absolute_ = true; }
bool is_absolute() const { return is_absolute_; }
void set_type(source_file_t type) { type_ = type; }
source_file_t type() const { return type_; }
@@ -71,6 +75,12 @@ public:
source_file &operator=(const source_file &) = delete;
source_file &operator=(source_file &&) = delete;
bool operator==(const source_file &right) const
{
return (path_ == right.path_) && (name() == right.name()) &&
(type_ == right.type_);
}
const filesystem_path &path() const { return path_; }
std::string full_name(bool /*relative*/) const override