Refactoring getID to a unique global ID for entities

This commit is contained in:
Bartek Kryza
2022-08-11 17:04:16 +02:00
parent d63426e574
commit e4289c4cab
15 changed files with 264 additions and 22 deletions

View File

@@ -87,8 +87,9 @@ std::string class_::base_template() const { return base_template_full_name_; }
bool operator==(const class_ &l, const class_ &r)
{
return (l.name_and_ns() == r.name_and_ns()) &&
(l.templates_ == r.templates_);
return l.id() == r.id();
//(l.name_and_ns() == r.name_and_ns()) &&
// (l.templates_ == r.templates_);
}
void class_::add_type_alias(type_alias &&ta)

View File

@@ -165,8 +165,11 @@ bool diagram::add_class(std::unique_ptr<class_> &&c)
auto name_with_ns = c->name_and_ns();
auto name_and_ns = ns | name;
auto &cc = *c;
auto id = cc.id();
if (!has_class(cc)) {
if (base_name == "cpp_function_parameter")
LOG_DBG("AAAAAAAAAAAAAAAAAAAAAAA");
if (add_element(ns, std::move(c)))
classes_.push_back(std::ref(cc));
@@ -176,10 +179,13 @@ bool diagram::add_class(std::unique_ptr<class_> &&c)
throw std::runtime_error(
"Invalid element stored in the diagram tree");
LOG_DBG("Added class {} ({} - [{}])", base_name, full_name, id);
return true;
}
LOG_DBG("Class {} ({}) already in the model", base_name, full_name);
LOG_DBG(
"Class {} ({} - [{}]) already in the model", base_name, full_name, id);
return false;
}