removed name member from restriction and changed attribute member to a reference

This commit is contained in:
Sascha Kühl
2025-12-11 09:26:35 +01:00
parent f842efb611
commit 571cfd52ae
4 changed files with 25 additions and 50 deletions
+5 -21
View File
@@ -4,32 +4,16 @@
#include "matador/object/object.hpp"
namespace matador::object {
restriction::restriction(std::string name)
: name_(std::move(name)) {}
restriction::restriction(const class attribute& attr)
: attr_(attr) {}
std::string restriction::name() const {
return type_string() + name_;
}
const class attribute* restriction::attribute() const {
if (std::holds_alternative<class attribute*>(attr_)) {
return std::get<class attribute*>(attr_);
}
return nullptr;
const class attribute& restriction::attribute() const {
return attr_;
}
std::string restriction::column_name() const {
if (std::holds_alternative<class attribute*>(attr_)) {
return std::get<class attribute*>(attr_)->name();
}
if (std::holds_alternative<std::string>(attr_)) {
return std::get<std::string>(attr_);
}
return "";
return attr_.name();
}
std::shared_ptr<object> restriction::owner() const {
return owner_;
}