make values capable of being a list & add boost
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
08ad2c5c66
commit
733b52575b
16 changed files with 315 additions and 140 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include <persistence/function_context.hpp>
|
||||
#include <persistence/project.hpp>
|
||||
#include <sys/stat.h>
|
||||
#include <values/value.hpp>
|
||||
|
||||
IkarusProperty::IkarusProperty(IkarusProject * project, IkarusId id, Data data):
|
||||
IkarusObject{project, id},
|
||||
|
|
@ -121,6 +122,31 @@ IkarusPropertySource const * ikarus_property_get_source(IkarusProperty const * p
|
|||
}
|
||||
}
|
||||
|
||||
IkarusValue * ikarus_property_get_default_value(IkarusProperty const * property) {
|
||||
LOG_VERBOSE("fetching property default value");
|
||||
|
||||
LOG_VERBOSE("project={};property={}", property->get_project()->get_path().c_str(), property->get_id());
|
||||
|
||||
auto * ctx = property->get_project()->get_function_context();
|
||||
|
||||
VTRY(
|
||||
auto const value,
|
||||
property->get_project()
|
||||
->get_db()
|
||||
->query_one<int>("SELECT `default_value` FROM `properties` WHERE `id` = ?", property->get_id())
|
||||
.on_error([ctx](auto const& err) {
|
||||
ctx->set_error(
|
||||
fmt::format("failed to fetch property's default value: {}", err),
|
||||
true,
|
||||
IkarusErrorInfo_Source_SubSystem,
|
||||
IkarusErrorInfo_Type_SubSystem_Database
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
return new IkarusValue(property->get_project(), value);
|
||||
}
|
||||
|
||||
void ikarus_property_visit(
|
||||
IkarusProperty * property,
|
||||
void (*toggle_property_visitor)(struct IkarusToggleProperty *, void *),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue