Added relationship exclusion to context filter
This commit is contained in:
@@ -301,6 +301,8 @@ tvl::value_t context_filter::match(const diagram &d, const element &e) const
|
||||
if (d.type() != diagram_t::kClass)
|
||||
return {};
|
||||
|
||||
// Running this filter makes sense only after the entire diagram is
|
||||
// generated - i.e. during diagram generation
|
||||
if (!d.complete())
|
||||
return {};
|
||||
|
||||
@@ -319,11 +321,13 @@ tvl::value_t context_filter::match(const diagram &d, const element &e) const
|
||||
// relationship with any of the context_root's
|
||||
for (const relationship &rel :
|
||||
context_root.value().relationships()) {
|
||||
if (rel.destination() == e.id())
|
||||
if (d.should_include(rel.type()) &&
|
||||
rel.destination() == e.id())
|
||||
return true;
|
||||
}
|
||||
for (const relationship &rel : e.relationships()) {
|
||||
if (rel.destination() == context_root.value().id())
|
||||
if (d.should_include(rel.type()) &&
|
||||
rel.destination() == context_root.value().id())
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,4 +17,6 @@ diagrams:
|
||||
- clanguml::t00041::ns1::N
|
||||
exclude:
|
||||
namespaces:
|
||||
- clanguml::t00041::detail
|
||||
- clanguml::t00041::detail
|
||||
relationships:
|
||||
- dependency
|
||||
@@ -22,10 +22,14 @@ namespace detail {
|
||||
struct G { };
|
||||
} // namespace detail
|
||||
|
||||
struct H { };
|
||||
|
||||
struct RR : public R {
|
||||
E *e;
|
||||
F *f;
|
||||
detail::G *g;
|
||||
|
||||
void foo(H *h) { }
|
||||
};
|
||||
|
||||
struct RRR : public RR { };
|
||||
|
||||
@@ -48,6 +48,7 @@ TEST_CASE("t00041", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClass(_A("RR")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("RRR")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("detail::G")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("H")));
|
||||
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("R"), _A("RR")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("RR"), _A("RRR")));
|
||||
@@ -55,6 +56,7 @@ TEST_CASE("t00041", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("RR"), "+rr"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("E"), "+e"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("F"), "+f"));
|
||||
REQUIRE_THAT(puml, !IsDependency(_A("RR"), _A("H")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::N")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::NN")));
|
||||
|
||||
Reference in New Issue
Block a user