change clang-format
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
f63d2b2fe2
commit
eab9bafe7b
33 changed files with 217 additions and 254 deletions
|
|
@ -14,17 +14,15 @@ IkarusProperty::IkarusProperty(IkarusProject * project, IkarusId id, Data data):
|
|||
IkarusObject{project, id},
|
||||
_data{data} {}
|
||||
|
||||
IkarusProperty::Data& IkarusProperty::get_data() {
|
||||
IkarusProperty::Data & IkarusProperty::get_data() {
|
||||
return _data;
|
||||
}
|
||||
|
||||
IkarusProperty::Data const& IkarusProperty::get_data() const {
|
||||
IkarusProperty::Data const & IkarusProperty::get_data() const {
|
||||
return _data;
|
||||
}
|
||||
|
||||
cppbase::Result<IkarusPropertyType, sqlitecpp::SingleQueryError> IkarusProperty::get_property_type(
|
||||
IkarusProject * project, IkarusId id
|
||||
) {
|
||||
cppbase::Result<IkarusPropertyType, sqlitecpp::SingleQueryError> IkarusProperty::get_property_type(IkarusProject * project, IkarusId id) {
|
||||
LOG_DEBUG("fetching unboxed property type");
|
||||
|
||||
LOG_VERBOSE("project={};property={}", project->get_path().c_str(), id);
|
||||
|
|
@ -33,16 +31,14 @@ cppbase::Result<IkarusPropertyType, sqlitecpp::SingleQueryError> IkarusProperty:
|
|||
|
||||
VTRY(
|
||||
auto const type,
|
||||
project->get_db()
|
||||
->query_one<int>("SELECT `type` FROM `properties` WHERE `id` = ?", id)
|
||||
.on_error([ctx](auto const& err) {
|
||||
ctx->set_error(
|
||||
fmt::format("failed to fetch unboxed property type: {}", err),
|
||||
true,
|
||||
IkarusErrorInfo_Source_SubSystem,
|
||||
IkarusErrorInfo_Type_SubSystem_Database
|
||||
);
|
||||
})
|
||||
project->get_db()->query_one<int>("SELECT `type` FROM `properties` WHERE `id` = ?", id).on_error([ctx](auto const & err) {
|
||||
ctx->set_error(
|
||||
fmt::format("failed to fetch unboxed property type: {}", err),
|
||||
true,
|
||||
IkarusErrorInfo_Source_SubSystem,
|
||||
IkarusErrorInfo_Type_SubSystem_Database
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
return cppbase::ok(static_cast<IkarusPropertyType>(type));
|
||||
|
|
@ -55,20 +51,14 @@ IKA_API void ikarus_property_delete(IkarusProperty * property) {
|
|||
|
||||
auto * ctx = property->project->get_function_context();
|
||||
|
||||
TRYRV(
|
||||
,
|
||||
property->project
|
||||
->get_db()
|
||||
->execute("DELETE FROM `objects` WHERE `id` = ?", property->id)
|
||||
.on_error([ctx](auto const& err) {
|
||||
ctx->set_error(
|
||||
fmt::format("failed to delete property from objects table: {}", err),
|
||||
true,
|
||||
IkarusErrorInfo_Source_SubSystem,
|
||||
IkarusErrorInfo_Type_SubSystem_Database
|
||||
);
|
||||
})
|
||||
);
|
||||
TRYRV(, property->project->get_db()->execute("DELETE FROM `objects` WHERE `id` = ?", property->id).on_error([ctx](auto const & err) {
|
||||
ctx->set_error(
|
||||
fmt::format("failed to delete property from objects table: {}", err),
|
||||
true,
|
||||
IkarusErrorInfo_Source_SubSystem,
|
||||
IkarusErrorInfo_Type_SubSystem_Database
|
||||
);
|
||||
}));
|
||||
|
||||
LOG_VERBOSE("property was successfully deleted from database, freeing");
|
||||
|
||||
|
|
@ -80,8 +70,7 @@ IKA_API void ikarus_property_delete(IkarusProperty * property) {
|
|||
IkarusPropertyType ikarus_property_get_type(IkarusProperty const * property) {
|
||||
LOG_VERBOSE("fetching property type");
|
||||
|
||||
return IkarusProperty::get_property_type(property->project, property->id)
|
||||
.unwrap_value_or(IkarusPropertyType_Toggle);
|
||||
return IkarusProperty::get_property_type(property->project, property->id).unwrap_value_or(IkarusPropertyType_Toggle);
|
||||
}
|
||||
|
||||
IkarusPropertySource const * ikarus_property_get_source(IkarusProperty const * property) {
|
||||
|
|
@ -94,10 +83,9 @@ IkarusPropertySource const * ikarus_property_get_source(IkarusProperty const * p
|
|||
VTRYRV(
|
||||
auto const source,
|
||||
nullptr,
|
||||
property->project
|
||||
->get_db()
|
||||
property->project->get_db()
|
||||
->query_one<int>("SELECT `source` FROM `properties` WHERE `id` = ?", property->id)
|
||||
.on_error([ctx](auto const& err) {
|
||||
.on_error([ctx](auto const & err) {
|
||||
ctx->set_error(
|
||||
fmt::format("failed to fetch property's source: {}", err),
|
||||
true,
|
||||
|
|
@ -133,10 +121,9 @@ IkarusValue * ikarus_property_get_default_value(IkarusProperty const * property)
|
|||
VTRYRV(
|
||||
auto const value,
|
||||
nullptr,
|
||||
property->project
|
||||
->get_db()
|
||||
property->project->get_db()
|
||||
->query_one<int>("SELECT `default_value` FROM `properties` WHERE `id` = ?", property->id)
|
||||
.on_error([ctx](auto const& err) {
|
||||
.on_error([ctx](auto const & err) {
|
||||
ctx->set_error(
|
||||
fmt::format("failed to fetch property's default value: {}", err),
|
||||
true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue