object generator progress
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#include "matador/object/object.hpp"
|
||||
|
||||
namespace matador::object {
|
||||
object::object( std::string name, std::string alias )
|
||||
: name_(std::move(name))
|
||||
, alias_(std::move(alias)) {}
|
||||
|
||||
const attribute& object::create_attribute( std::string name, object& obj ) {
|
||||
attribute attr{std::move(name)};
|
||||
attr.owner_ = &obj;
|
||||
return obj.attributes_.emplace_back(std::move(attr));
|
||||
}
|
||||
|
||||
void object::add_attribute( attribute attr ) {
|
||||
auto &ref = attributes_.emplace_back(std::move(attr));
|
||||
ref.owner_ = this;
|
||||
}
|
||||
|
||||
void object::add_constraint( class constraint c ) {
|
||||
auto &ref = constraints_.emplace_back(std::move(c));
|
||||
ref.owner_ = this;
|
||||
}
|
||||
|
||||
const std::string& object::name() const {
|
||||
return name_;
|
||||
}
|
||||
|
||||
const std::string& object::alias() const {
|
||||
return alias_;
|
||||
}
|
||||
|
||||
bool object::has_attributes() const {
|
||||
return attributes_.empty();
|
||||
}
|
||||
|
||||
size_t object::attribute_count() const {
|
||||
return attributes_.size();
|
||||
}
|
||||
|
||||
const std::vector<attribute>& object::attributes() const {
|
||||
return attributes_;
|
||||
}
|
||||
|
||||
bool object::has_constraints() const {
|
||||
return constraints_.empty();
|
||||
}
|
||||
|
||||
size_t object::constraint_count() const {
|
||||
return constraints_.size();
|
||||
}
|
||||
|
||||
const std::vector<class constraint>& object::constraints() const {
|
||||
return constraints_;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user