Fixed package diagram dependency discovery
This commit is contained in:
@@ -46,26 +46,6 @@ using clanguml::common::model::relationship_t;
|
||||
using clanguml::package_diagram::model::diagram;
|
||||
|
||||
namespace detail {
|
||||
access_t cpp_access_specifier_to_access(
|
||||
cppast::cpp_access_specifier_kind access_specifier)
|
||||
{
|
||||
access_t access = access_t::kPublic;
|
||||
switch (access_specifier) {
|
||||
case cppast::cpp_access_specifier_kind::cpp_public:
|
||||
access = access_t::kPublic;
|
||||
break;
|
||||
case cppast::cpp_access_specifier_kind::cpp_private:
|
||||
access = access_t::kPrivate;
|
||||
break;
|
||||
case cppast::cpp_access_specifier_kind::cpp_protected:
|
||||
access = access_t::kProtected;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return access;
|
||||
}
|
||||
|
||||
bool is_constructor(const cppast::cpp_entity &e)
|
||||
{
|
||||
@@ -354,17 +334,16 @@ void translation_unit_visitor::process_function(
|
||||
if (!skip_return_type) {
|
||||
find_relationships(
|
||||
f.return_type(), relationships, relationship_t::kDependency);
|
||||
}
|
||||
|
||||
for (const auto &dependency : relationships) {
|
||||
auto destination =
|
||||
common::model::namespace_{std::get<0>(dependency)};
|
||||
for (const auto &dependency : relationships) {
|
||||
auto destination = common::model::namespace_{std::get<0>(dependency)};
|
||||
|
||||
if (!ctx.get_namespace().starts_with(destination) &&
|
||||
!destination.starts_with(ctx.get_namespace())) {
|
||||
relationship r{
|
||||
relationship_t::kDependency, std::get<0>(dependency)};
|
||||
current_package.value().add_relationship(std::move(r));
|
||||
}
|
||||
if (!ctx.get_namespace().starts_with(destination) &&
|
||||
!destination.starts_with(ctx.get_namespace())) {
|
||||
relationship r{
|
||||
relationship_t::kDependency, std::get<0>(dependency)};
|
||||
current_package.value().add_relationship(std::move(r));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -57,16 +58,28 @@ namespace A13 {
|
||||
struct CM {
|
||||
};
|
||||
}
|
||||
namespace A14 {
|
||||
struct CN {
|
||||
};
|
||||
}
|
||||
namespace A15 {
|
||||
struct CO {
|
||||
};
|
||||
}
|
||||
}
|
||||
namespace B::BB::BBB {
|
||||
struct CBA : public A::AA::A6::CF {
|
||||
class CBA : public A::AA::A6::CF {
|
||||
public:
|
||||
A::AA::A1::CA *ca_;
|
||||
A::AA::A2::CB cb_;
|
||||
std::shared_ptr<A::AA::A3::CC> cc_;
|
||||
std::map<std::string, std::unique_ptr<A::AA::A4::CD>> cd_;
|
||||
std::map<std::string, std::unique_ptr<A::AA::A4::CD>> *cd_;
|
||||
std::array<A::AA::A15::CO, 5> co_;
|
||||
|
||||
CBA() = default;
|
||||
|
||||
CBA(A::AA::A14::CN *cn) { }
|
||||
|
||||
template <typename... Item> CBA(std::tuple<Item...> &items) { }
|
||||
|
||||
void ce(const std::vector<A::AA::A5::CE> /*ce_*/) { }
|
||||
@@ -78,7 +91,8 @@ struct CBA : public A::AA::A6::CF {
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T> std::map<T, std::shared_ptr<A::AA::A9::CI>> ci()
|
||||
template <typename T>
|
||||
std::map<T, std::shared_ptr<A::AA::A9::CI>> ci(T * /*t*/)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ TEST_CASE("t30002", "[test-case][package]")
|
||||
REQUIRE_THAT(puml, IsPackage("A11"));
|
||||
REQUIRE_THAT(puml, IsPackage("A12"));
|
||||
REQUIRE_THAT(puml, IsPackage("A13"));
|
||||
REQUIRE_THAT(puml, IsPackage("A14"));
|
||||
REQUIRE_THAT(puml, IsPackage("A15"));
|
||||
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A1")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A2")));
|
||||
@@ -60,6 +62,8 @@ TEST_CASE("t30002", "[test-case][package]")
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A11")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A12")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A13")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A14")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A15")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
|
||||
Reference in New Issue
Block a user