change clang-format
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
0496ea7259
commit
910f337d02
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,
|
||||
|
|
|
|||
|
|
@ -16,24 +16,23 @@ public:
|
|||
|
||||
public:
|
||||
/// \brief Helper to fetch a type for a property that isn't yet wrapped in an object
|
||||
[[nodiscard]] static cppbase::Result<IkarusPropertyType, sqlitecpp::SingleQueryError> get_property_type(
|
||||
struct IkarusProject * project, IkarusId id
|
||||
);
|
||||
[[nodiscard]] static cppbase::Result<IkarusPropertyType, sqlitecpp::SingleQueryError>
|
||||
get_property_type(struct IkarusProject * project, IkarusId id);
|
||||
|
||||
public:
|
||||
IkarusProperty(struct IkarusProject * project, IkarusId id, Data data);
|
||||
|
||||
IkarusProperty(IkarusProperty const&) = default;
|
||||
IkarusProperty(IkarusProperty&&) = default;
|
||||
IkarusProperty(IkarusProperty const &) = default;
|
||||
IkarusProperty(IkarusProperty &&) = default;
|
||||
|
||||
IkarusProperty& operator=(IkarusProperty const&) = default;
|
||||
IkarusProperty& operator=(IkarusProperty&&) = default;
|
||||
IkarusProperty & operator=(IkarusProperty const &) = default;
|
||||
IkarusProperty & operator=(IkarusProperty &&) = default;
|
||||
|
||||
~IkarusProperty() override = default;
|
||||
|
||||
public:
|
||||
[[nodiscard]] Data& get_data();
|
||||
[[nodiscard]] Data const& get_data() const;
|
||||
[[nodiscard]] Data & get_data();
|
||||
[[nodiscard]] Data const & get_data() const;
|
||||
|
||||
private:
|
||||
Data _data;
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ public:
|
|||
public:
|
||||
explicit IkarusPropertySource(Data data);
|
||||
|
||||
IkarusPropertySource(IkarusPropertySource const&) = default;
|
||||
IkarusPropertySource(IkarusPropertySource&&) = default;
|
||||
IkarusPropertySource(IkarusPropertySource const &) = default;
|
||||
IkarusPropertySource(IkarusPropertySource &&) = default;
|
||||
|
||||
IkarusPropertySource& operator=(IkarusPropertySource const&) = default;
|
||||
IkarusPropertySource& operator=(IkarusPropertySource&&) = default;
|
||||
IkarusPropertySource & operator=(IkarusPropertySource const &) = default;
|
||||
IkarusPropertySource & operator=(IkarusPropertySource &&) = default;
|
||||
|
||||
virtual ~IkarusPropertySource() = default;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,5 @@
|
|||
IkarusToggleProperty::IkarusToggleProperty(IkarusProject * project, IkarusId id):
|
||||
IkarusProperty{project, id, this} {}
|
||||
|
||||
IkarusToggleProperty * ikarus_toggle_property_create(
|
||||
struct IkarusProject * project, char const * name, struct IkarusPropertySource * property_source
|
||||
) {
|
||||
|
||||
}
|
||||
IkarusToggleProperty *
|
||||
ikarus_toggle_property_create(struct IkarusProject * project, char const * name, struct IkarusPropertySource * property_source) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue