Fixed duplicate dependency relationships

This commit is contained in:
Bartek Kryza
2021-03-18 23:21:06 +01:00
parent 2322833897
commit ce1d94984d
3 changed files with 17 additions and 1 deletions

View File

@@ -117,6 +117,13 @@ struct class_relationship {
std::string cardinality_source;
std::string cardinality_destination;
std::string label;
friend bool operator==(
const class_relationship &l, const class_relationship &r)
{
return l.type == r.type && l.destination == r.destination &&
l.label == r.label;
}
};
struct class_template {
@@ -140,6 +147,13 @@ public:
std::vector<class_template> templates;
std::string base_template_usr;
void add_relationship(class_relationship &&cr)
{
auto it = std::find(relationships.begin(), relationships.end(), cr);
if (it == relationships.end())
relationships.emplace_back(std::move(cr));
}
std::string full_name(
const std::vector<std::string> &using_namespaces) const
{