add src/ikarus subdir and make names unique for objects per scope
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
ced123b628
commit
9f943cc6a2
51 changed files with 590 additions and 735 deletions
57
src/ikarus/objects/properties/property_scope.cpp
Normal file
57
src/ikarus/objects/properties/property_scope.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#include "property_scope.hpp"
|
||||
|
||||
#include <cppbase/templates.hpp>
|
||||
|
||||
#include <ikarus/objects/blueprint.hpp>
|
||||
#include <ikarus/objects/entity.hpp>
|
||||
|
||||
IkarusPropertyScope::IkarusPropertyScope(Data data):
|
||||
data{data} {}
|
||||
|
||||
IkarusId IkarusPropertyScope::get_id() const {
|
||||
return std::visit(
|
||||
cppbase::overloaded{
|
||||
[](IkarusBlueprint const * blueprint) { return blueprint->id; },
|
||||
[](IkarusEntity const * entity) { return entity->id; }
|
||||
},
|
||||
data
|
||||
);
|
||||
}
|
||||
|
||||
IkarusPropertyScope * ikarus_property_source_create_blueprint(IkarusBlueprint * blueprint) {
|
||||
return new IkarusPropertyScope{blueprint};
|
||||
}
|
||||
|
||||
IkarusPropertyScope * ikarus_property_source_create_entity(IkarusEntity * entity) {
|
||||
return new IkarusPropertyScope{entity};
|
||||
}
|
||||
|
||||
void ikarus_property_source_visit(
|
||||
struct IkarusPropertyScope * property_source,
|
||||
void (*blueprint_visitor)(struct IkarusBlueprint *, void *),
|
||||
void (*entity_visitor)(struct IkarusEntity *, void *),
|
||||
void * user_data
|
||||
) {
|
||||
std::visit(
|
||||
cppbase::overloaded{
|
||||
[blueprint_visitor, user_data](IkarusBlueprint * blueprint) { blueprint_visitor(blueprint, user_data); },
|
||||
[entity_visitor, user_data](IkarusEntity * entity) { entity_visitor(entity, user_data); }
|
||||
},
|
||||
property_source->data
|
||||
);
|
||||
}
|
||||
|
||||
void ikarus_property_source_visit_const(
|
||||
struct IkarusPropertyScope const * property_source,
|
||||
void (*blueprint_visitor)(struct IkarusBlueprint const *, void *),
|
||||
void (*entity_visitor)(struct IkarusEntity const *, void *),
|
||||
void * user_data
|
||||
) {
|
||||
std::visit(
|
||||
cppbase::overloaded(
|
||||
[blueprint_visitor, user_data](IkarusBlueprint const * blueprint) { blueprint_visitor(blueprint, user_data); },
|
||||
[entity_visitor, user_data](IkarusEntity const * entity) { entity_visitor(entity, user_data); }
|
||||
),
|
||||
property_source->data
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue