Fixed class inner class and enum relationship generation
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
#include "uml/class_diagram_visitor.h"
|
||||
#include "util/util.h"
|
||||
|
||||
#include <cppast/libclang_parser.hpp>
|
||||
#include <cppast/cpp_entity_index.hpp>
|
||||
#include <cppast/libclang_parser.hpp>
|
||||
#include <glob/glob.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
case relationship_t::kAggregation:
|
||||
return "o--";
|
||||
case relationship_t::kContainment:
|
||||
return "+--";
|
||||
return "--+";
|
||||
case relationship_t::kAssociation:
|
||||
return "-->";
|
||||
case relationship_t::kInstantiation:
|
||||
@@ -224,6 +224,33 @@ public:
|
||||
}
|
||||
|
||||
ostr << "}" << std::endl;
|
||||
|
||||
for (const auto &r : e.relationships) {
|
||||
std::string destination;
|
||||
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);
|
||||
if (destination.empty()) {
|
||||
ostr << "' ";
|
||||
destination = r.destination;
|
||||
}
|
||||
}
|
||||
else {
|
||||
destination = r.destination;
|
||||
}
|
||||
|
||||
ostr << m_model.to_alias(m_config.using_namespace,
|
||||
ns_relative(m_config.using_namespace, e.name))
|
||||
<< " " << to_string(r.type) << " "
|
||||
<< m_model.to_alias(m_config.using_namespace,
|
||||
ns_relative(m_config.using_namespace, destination));
|
||||
|
||||
if (!r.label.empty())
|
||||
ostr << " : " << r.label;
|
||||
|
||||
ostr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void generate(std::ostream &ostr) const
|
||||
@@ -287,7 +314,8 @@ clanguml::model::class_diagram::diagram generate(
|
||||
}
|
||||
|
||||
cppast::cpp_entity_index idx;
|
||||
cppast::simple_file_parser<cppast::libclang_parser> parser{type_safe::ref(idx)};
|
||||
cppast::simple_file_parser<cppast::libclang_parser> parser{
|
||||
type_safe::ref(idx)};
|
||||
|
||||
// Process all matching translation units
|
||||
clanguml::visitor::class_diagram::tu_visitor ctx(d, diagram);
|
||||
|
||||
Reference in New Issue
Block a user