Switched default composition for aggregation
This commit is contained in:
@@ -142,6 +142,9 @@ public:
|
||||
|
||||
void generate(const class_ &c, std::ostream &ostr) const
|
||||
{
|
||||
|
||||
const auto uns = m_config.using_namespace;
|
||||
|
||||
std::string class_type{"class"};
|
||||
if (c.is_abstract())
|
||||
class_type = "abstract";
|
||||
@@ -187,7 +190,7 @@ public:
|
||||
if (m.is_defaulted)
|
||||
ostr << " = default";
|
||||
|
||||
ostr << " : " << ns_relative(m_config.using_namespace, type);
|
||||
ostr << " : " << ns_relative(uns, type);
|
||||
|
||||
ostr << std::endl;
|
||||
}
|
||||
@@ -203,7 +206,7 @@ public:
|
||||
ostr << "{static} ";
|
||||
|
||||
ostr << to_string(m.scope) << m.name << " : "
|
||||
<< ns_relative(m_config.using_namespace, m.type) << std::endl;
|
||||
<< ns_relative(uns, m.type) << std::endl;
|
||||
}
|
||||
|
||||
ostr << "}" << std::endl;
|
||||
@@ -212,11 +215,9 @@ public:
|
||||
for (const auto &b : c.bases) {
|
||||
std::stringstream relstr;
|
||||
try {
|
||||
relstr << m_model.to_alias(m_config.using_namespace,
|
||||
ns_relative(m_config.using_namespace, b.name))
|
||||
relstr << m_model.to_alias(uns, ns_relative(uns, b.name))
|
||||
<< " <|-- "
|
||||
<< m_model.to_alias(m_config.using_namespace,
|
||||
ns_relative(m_config.using_namespace, c.name))
|
||||
<< m_model.to_alias(uns, ns_relative(uns, c.name))
|
||||
<< std::endl;
|
||||
ostr << relstr.str();
|
||||
}
|
||||
@@ -237,8 +238,7 @@ public:
|
||||
try {
|
||||
if (r.destination.find("#") != std::string::npos ||
|
||||
r.destination.find("@") != std::string::npos) {
|
||||
destination = m_model.usr_to_name(
|
||||
m_config.using_namespace, r.destination);
|
||||
destination = m_model.usr_to_name(uns, r.destination);
|
||||
|
||||
// If something went wrong and we have an empty destination
|
||||
// generate the relationship but comment it out for
|
||||
@@ -252,13 +252,10 @@ public:
|
||||
destination = r.destination;
|
||||
}
|
||||
|
||||
relstr << m_model.to_alias(m_config.using_namespace,
|
||||
ns_relative(m_config.using_namespace,
|
||||
c.full_name(m_config.using_namespace)))
|
||||
relstr << m_model.to_alias(
|
||||
uns, ns_relative(uns, c.full_name(uns)))
|
||||
<< " " << to_string(r.type) << " "
|
||||
<< m_model.to_alias(m_config.using_namespace,
|
||||
ns_relative(
|
||||
m_config.using_namespace, destination));
|
||||
<< m_model.to_alias(uns, ns_relative(uns, destination));
|
||||
|
||||
if (!r.label.empty())
|
||||
relstr << " : " << r.label;
|
||||
@@ -269,8 +266,7 @@ public:
|
||||
catch (error::uml_alias_missing &e) {
|
||||
LOG_ERROR("Skipping {} relation from {} to {} due "
|
||||
"to: {}",
|
||||
to_string(r.type), c.full_name(m_config.using_namespace),
|
||||
destination, e.what());
|
||||
to_string(r.type), c.full_name(uns), destination, e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ void tu_visitor::process_field_with_template_instantiation(
|
||||
mv.type().kind() == cppast::cpp_type_kind::reference_t)
|
||||
rr.type = relationship_t::kAssociation;
|
||||
else
|
||||
rr.type = relationship_t::kComposition;
|
||||
rr.type = relationship_t::kAggregation;
|
||||
rr.label = mv.name();
|
||||
LOG_DBG("Adding field instantiation relationship {} {} {} : {}",
|
||||
rr.destination, model::class_diagram::to_string(rr.type), c.usr,
|
||||
@@ -956,7 +956,7 @@ void tu_visitor::find_relationships(const cppast::cpp_type &t_,
|
||||
if (t.kind() == cppast::cpp_type_kind::array_t) {
|
||||
auto &a = static_cast<const cppast::cpp_array_type &>(t);
|
||||
find_relationships(
|
||||
a.value_type(), relationships, relationship_t::kComposition);
|
||||
a.value_type(), relationships, relationship_t::kAggregation);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -981,7 +981,7 @@ void tu_visitor::find_relationships(const cppast::cpp_type &t_,
|
||||
// container list
|
||||
if (name.find("std::unique_ptr") == 0) {
|
||||
find_relationships(args[0u].type().value(), relationships,
|
||||
relationship_t::kComposition);
|
||||
relationship_t::kAggregation);
|
||||
}
|
||||
else if (name.find("std::shared_ptr") == 0) {
|
||||
find_relationships(args[0u].type().value(), relationships,
|
||||
@@ -993,7 +993,7 @@ void tu_visitor::find_relationships(const cppast::cpp_type &t_,
|
||||
}
|
||||
else if (name.find("std::vector") == 0) {
|
||||
find_relationships(args[0u].type().value(), relationships,
|
||||
relationship_t::kComposition);
|
||||
relationship_t::kAggregation);
|
||||
}
|
||||
else {
|
||||
for (const auto &arg : args) {
|
||||
@@ -1014,7 +1014,7 @@ void tu_visitor::find_relationships(const cppast::cpp_type &t_,
|
||||
auto &r = static_cast<const cppast::cpp_reference_type &>(t_);
|
||||
auto rt = relationship_t::kAssociation;
|
||||
if (r.reference_kind() == cppast::cpp_reference::cpp_ref_rvalue) {
|
||||
rt = relationship_t::kComposition;
|
||||
rt = relationship_t::kAggregation;
|
||||
}
|
||||
if (relationship_hint == relationship_t::kDependency)
|
||||
rt = relationship_hint;
|
||||
@@ -1030,7 +1030,7 @@ void tu_visitor::find_relationships(const cppast::cpp_type &t_,
|
||||
cppast::to_string(t), relationship_type);
|
||||
else
|
||||
relationships.emplace_back(
|
||||
cppast::to_string(t), relationship_t::kComposition);
|
||||
cppast::to_string(t), relationship_t::kAggregation);
|
||||
}
|
||||
|
||||
// Check if t_ has an alias in the alias index
|
||||
|
||||
Reference in New Issue
Block a user