diff --git a/api/sixtyfps-cpp/include/sixtyfps.h b/api/sixtyfps-cpp/include/sixtyfps.h index 0f06a01c4..6d49fbf61 100644 --- a/api/sixtyfps-cpp/include/sixtyfps.h +++ b/api/sixtyfps-cpp/include/sixtyfps.h @@ -215,7 +215,7 @@ using cbindgen_private::MouseEvent; using cbindgen_private::sixtyfps_visit_item_tree; namespace private_api { -void dealloc(const ComponentVTable *, uint8_t *ptr, vtable::Layout layout) +inline void dealloc(const ComponentVTable *, uint8_t *ptr, vtable::Layout layout) { #ifdef __cpp_sized_deallocation ::operator delete(reinterpret_cast(ptr), layout.size, @@ -226,7 +226,7 @@ void dealloc(const ComponentVTable *, uint8_t *ptr, vtable::Layout layout) } template -vtable::Layout drop_in_place(ComponentRef component) +inline vtable::Layout drop_in_place(ComponentRef component) { reinterpret_cast(component.instance)->~T(); return vtable::Layout { sizeof(T), alignof(T) }; @@ -646,13 +646,13 @@ NativeStyleMetrics::NativeStyleMetrics() using cbindgen_private::StandardListViewItem; namespace cbindgen_private { -bool operator==(const StandardListViewItem &a, const StandardListViewItem &b) +inline bool operator==(const StandardListViewItem &a, const StandardListViewItem &b) { static_assert(sizeof(StandardListViewItem) == sizeof(std::tuple), "must update to cover all fields"); return a.text == b.text; } -bool operator!=(const StandardListViewItem &a, const StandardListViewItem &b) +inline bool operator!=(const StandardListViewItem &a, const StandardListViewItem &b) { return !(a == b); } @@ -665,12 +665,12 @@ struct VersionCheckHelper }; } -void run_event_loop() +inline void run_event_loop() { cbindgen_private::sixtyfps_run_event_loop(); } -void quit_event_loop() +inline void quit_event_loop() { cbindgen_private::sixtyfps_quit_event_loop(); } @@ -678,7 +678,7 @@ void quit_event_loop() /// Registers a font by the specified path. The path must refer to an existing /// TrueType font font. /// \returns an empty optional on success, otherwise an error string -std::optional register_font_from_path(const SharedString &path) +inline std::optional register_font_from_path(const SharedString &path) { SharedString maybe_err; cbindgen_private::sixtyfps_register_font_from_path(&path, &maybe_err); diff --git a/api/sixtyfps-cpp/include/sixtyfps_color.h b/api/sixtyfps-cpp/include/sixtyfps_color.h index e32234605..7da0e04fb 100644 --- a/api/sixtyfps-cpp/include/sixtyfps_color.h +++ b/api/sixtyfps-cpp/include/sixtyfps_color.h @@ -182,7 +182,7 @@ inline Color Color::darker(float factor) const } template<> -RgbaColor::RgbaColor(const Color &color) +inline RgbaColor::RgbaColor(const Color &color) { red = color.red(); green = color.green(); @@ -191,7 +191,7 @@ RgbaColor::RgbaColor(const Color &color) } template<> -RgbaColor::RgbaColor(const Color &color) +inline RgbaColor::RgbaColor(const Color &color) { red = float(color.red()) / 255.; green = float(color.green()) / 255.; @@ -210,8 +210,9 @@ RgbaColor Color::to_argb_float() const } template<> -void Property::set_animated_value( - const Color &new_value, const cbindgen_private::PropertyAnimation &animation_data) const +inline void +Property::set_animated_value(const Color &new_value, + const cbindgen_private::PropertyAnimation &animation_data) const { cbindgen_private::sixtyfps_property_set_animated_value_color(&inner, value, new_value, &animation_data); diff --git a/api/sixtyfps-cpp/include/sixtyfps_properties.h b/api/sixtyfps-cpp/include/sixtyfps_properties.h index 8e276e7a6..a716a4d2d 100644 --- a/api/sixtyfps-cpp/include/sixtyfps_properties.h +++ b/api/sixtyfps-cpp/include/sixtyfps_properties.h @@ -25,7 +25,7 @@ using cbindgen_private::StateInfo; namespace private_api { -void sixtyfps_property_set_animated_binding_helper( +inline void sixtyfps_property_set_animated_binding_helper( const cbindgen_private::PropertyHandleOpaque *handle, void (*binding)(void *, int32_t *), void *user_data, void (*drop_user_data)(void *), const cbindgen_private::PropertyAnimation *animation_data, @@ -35,7 +35,7 @@ void sixtyfps_property_set_animated_binding_helper( handle, binding, user_data, drop_user_data, animation_data, transition_data); } -void sixtyfps_property_set_animated_binding_helper( +inline void sixtyfps_property_set_animated_binding_helper( const cbindgen_private::PropertyHandleOpaque *handle, void (*binding)(void *, float *), void *user_data, void (*drop_user_data)(void *), const cbindgen_private::PropertyAnimation *animation_data, @@ -45,7 +45,7 @@ void sixtyfps_property_set_animated_binding_helper( handle, binding, user_data, drop_user_data, animation_data, transition_data); } -void sixtyfps_property_set_animated_binding_helper( +inline void sixtyfps_property_set_animated_binding_helper( const cbindgen_private::PropertyHandleOpaque *handle, void (*binding)(void *, Color *), void *user_data, void (*drop_user_data)(void *), const cbindgen_private::PropertyAnimation *animation_data, @@ -55,7 +55,7 @@ void sixtyfps_property_set_animated_binding_helper( handle, binding, user_data, drop_user_data, animation_data, transition_data); } -void sixtyfps_property_set_animated_binding_helper( +inline void sixtyfps_property_set_animated_binding_helper( const cbindgen_private::PropertyHandleOpaque *handle, void (*binding)(void *, Brush *), void *user_data, void (*drop_user_data)(void *), const cbindgen_private::PropertyAnimation *animation_data, @@ -198,7 +198,7 @@ private: }; template<> -void Property::set_animated_value( +inline void Property::set_animated_value( const int32_t &new_value, const cbindgen_private::PropertyAnimation &animation_data) const { cbindgen_private::sixtyfps_property_set_animated_value_int(&inner, value, new_value, @@ -206,8 +206,9 @@ void Property::set_animated_value( } template<> -void Property::set_animated_value( - const float &new_value, const cbindgen_private::PropertyAnimation &animation_data) const +inline void +Property::set_animated_value(const float &new_value, + const cbindgen_private::PropertyAnimation &animation_data) const { cbindgen_private::sixtyfps_property_set_animated_value_float(&inner, value, new_value, &animation_data); diff --git a/api/sixtyfps-cpp/include/sixtyfps_string.h b/api/sixtyfps-cpp/include/sixtyfps_string.h index 26f37f14e..8a7cab004 100644 --- a/api/sixtyfps-cpp/include/sixtyfps_string.h +++ b/api/sixtyfps-cpp/include/sixtyfps_string.h @@ -176,7 +176,7 @@ private: }; namespace private_api { -cbindgen_private::Slice string_to_slice(std::string_view str) +inline cbindgen_private::Slice string_to_slice(std::string_view str) { return cbindgen_private::Slice { const_cast(reinterpret_cast(str.data())), str.size()