mirror of
https://github.com/slint-ui/slint.git
synced 2025-07-24 13:35:00 +00:00
Re-run clang-format with version 18
This commit is contained in:
parent
355a8ab62b
commit
650f19a33c
10 changed files with 70 additions and 135 deletions
|
@ -192,10 +192,7 @@ public:
|
|||
}
|
||||
/// Returns an iterator that when compared with an iterator returned by begin() can be
|
||||
/// used to detect when all fields have been visited.
|
||||
iterator end() const
|
||||
{
|
||||
return iterator();
|
||||
}
|
||||
iterator end() const { return iterator(); }
|
||||
|
||||
/// Returns the value of the field with the given \a name; Returns an std::optional without
|
||||
/// value if the field does not exist.
|
||||
|
@ -699,10 +696,11 @@ public:
|
|||
// clang-format on
|
||||
{
|
||||
using namespace cbindgen_private;
|
||||
auto actual_cb = [](void *data,
|
||||
cbindgen_private::Slice<cbindgen_private::Box<cbindgen_private::Value>>
|
||||
arg) {
|
||||
std::span<const Value> args_view { reinterpret_cast<const Value *>(arg.ptr), arg.len };
|
||||
auto actual_cb =
|
||||
[](void *data,
|
||||
cbindgen_private::Slice<cbindgen_private::Box<cbindgen_private::Value>> arg) {
|
||||
std::span<const Value> args_view { reinterpret_cast<const Value *>(arg.ptr),
|
||||
arg.len };
|
||||
Value r = (*reinterpret_cast<F *>(data))(args_view);
|
||||
auto inner = r.inner;
|
||||
r.inner = cbindgen_private::slint_interpreter_value_new();
|
||||
|
@ -773,10 +771,11 @@ public:
|
|||
bool set_global_callback(std::string_view global, std::string_view name, F callback) const
|
||||
{
|
||||
using namespace cbindgen_private;
|
||||
auto actual_cb = [](void *data,
|
||||
cbindgen_private::Slice<cbindgen_private::Box<cbindgen_private::Value>>
|
||||
arg) {
|
||||
std::span<const Value> args_view { reinterpret_cast<const Value *>(arg.ptr), arg.len };
|
||||
auto actual_cb =
|
||||
[](void *data,
|
||||
cbindgen_private::Slice<cbindgen_private::Box<cbindgen_private::Value>> arg) {
|
||||
std::span<const Value> args_view { reinterpret_cast<const Value *>(arg.ptr),
|
||||
arg.len };
|
||||
Value r = (*reinterpret_cast<F *>(data))(args_view);
|
||||
auto inner = r.inner;
|
||||
r.inner = cbindgen_private::slint_interpreter_value_new();
|
||||
|
|
|
@ -392,10 +392,7 @@ public:
|
|||
/// Returns a copy of text stored in the system clipboard, if any.
|
||||
///
|
||||
/// If the platform doesn't support the specified clipboard, the function should return nullopt
|
||||
virtual std::optional<SharedString> clipboard_text(Clipboard)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
virtual std::optional<SharedString> clipboard_text(Clipboard) { return {}; }
|
||||
|
||||
/// Spins an event loop and renders the visible windows.
|
||||
virtual void run_event_loop() { }
|
||||
|
@ -698,8 +695,7 @@ public:
|
|||
/// to fill it with pixels. After the line buffer is filled with pixels, your implementation is
|
||||
/// free to flush that line to the screen for display.
|
||||
template<typename Callback>
|
||||
requires requires(Callback callback)
|
||||
{
|
||||
requires requires(Callback callback) {
|
||||
callback(size_t(0), size_t(0), size_t(0), [&callback](std::span<Rgb565Pixel>) {});
|
||||
}
|
||||
PhysicalRegion render_by_line(Callback process_line_callback) const
|
||||
|
|
|
@ -345,18 +345,12 @@ public:
|
|||
|
||||
/// \private
|
||||
/// Internal function called by the view to register itself
|
||||
void attach_peer(private_api::ModelPeer p)
|
||||
{
|
||||
peers.push_back(std::move(p));
|
||||
}
|
||||
void attach_peer(private_api::ModelPeer p) { peers.push_back(std::move(p)); }
|
||||
|
||||
/// \private
|
||||
/// Internal function called from within bindings to register with the currently
|
||||
/// evaluating dependency and get notified when this model's row count changes.
|
||||
void track_row_count_changes() const
|
||||
{
|
||||
model_row_count_dirty_property.get();
|
||||
}
|
||||
void track_row_count_changes() const { model_row_count_dirty_property.get(); }
|
||||
|
||||
/// \private
|
||||
/// Internal function called from within bindings to register with the currently
|
||||
|
|
|
@ -211,10 +211,7 @@ public:
|
|||
|
||||
#if !defined(DOXYGEN)
|
||||
// FIXME: we need this to create GradientStop
|
||||
operator const cbindgen_private::types::Color &() const
|
||||
{
|
||||
return inner;
|
||||
}
|
||||
operator const cbindgen_private::types::Color &() const { return inner; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
|
@ -195,10 +195,7 @@ public:
|
|||
}
|
||||
|
||||
/// Returns the size of the Image in pixels.
|
||||
Size<uint32_t> size() const
|
||||
{
|
||||
return cbindgen_private::types::slint_image_size(&data);
|
||||
}
|
||||
Size<uint32_t> size() const { return cbindgen_private::types::slint_image_size(&data); }
|
||||
|
||||
/// Returns the path of the image on disk, if it was constructed via Image::load_from_path().
|
||||
std::optional<slint::SharedString> path() const
|
||||
|
@ -227,10 +224,7 @@ public:
|
|||
return cbindgen_private::types::slint_image_compare_equal(&a.data, &b.data);
|
||||
}
|
||||
/// Returns false if \a a refers to the same image as \a b; true otherwise.
|
||||
friend bool operator!=(const Image &a, const Image &b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
friend bool operator!=(const Image &a, const Image &b) { return !(a == b); }
|
||||
|
||||
/// \private
|
||||
explicit Image(cbindgen_private::types::Image inner) : data(inner) { }
|
||||
|
|
|
@ -49,10 +49,7 @@ struct SharedString
|
|||
}
|
||||
/// Destroys this SharedString and frees the memory if this is the last instance
|
||||
/// referencing it.
|
||||
~SharedString()
|
||||
{
|
||||
cbindgen_private::slint_shared_string_drop(this);
|
||||
}
|
||||
~SharedString() { cbindgen_private::slint_shared_string_drop(this); }
|
||||
/// Assigns \a other to this string and returns a reference to this string.
|
||||
SharedString &operator=(const SharedString &other)
|
||||
{
|
||||
|
@ -71,10 +68,7 @@ struct SharedString
|
|||
/// Assigns null-terminated string pointer \a s to this string and returns a reference
|
||||
/// to this string. The underlying string data is copied. It is assumed that the string
|
||||
/// is UTF-8 encoded.
|
||||
SharedString &operator=(const char *s)
|
||||
{
|
||||
return *this = std::string_view(s);
|
||||
}
|
||||
SharedString &operator=(const char *s) { return *this = std::string_view(s); }
|
||||
|
||||
/// Move-assigns \a other to this SharedString instance.
|
||||
SharedString &operator=(SharedString &&other)
|
||||
|
@ -85,23 +79,14 @@ struct SharedString
|
|||
|
||||
/// Provides a view to the string data. The returned view is only valid as long as at
|
||||
/// least this SharedString exists.
|
||||
operator std::string_view() const
|
||||
{
|
||||
return cbindgen_private::slint_shared_string_bytes(this);
|
||||
}
|
||||
operator std::string_view() const { return cbindgen_private::slint_shared_string_bytes(this); }
|
||||
/// Provides a raw pointer to the string data. The returned pointer is only valid as long as at
|
||||
/// least this SharedString exists.
|
||||
auto data() const -> const char *
|
||||
{
|
||||
return cbindgen_private::slint_shared_string_bytes(this);
|
||||
}
|
||||
auto data() const -> const char * { return cbindgen_private::slint_shared_string_bytes(this); }
|
||||
|
||||
/// Returns a pointer to the first character. It is only safe to dereference the pointer if the
|
||||
/// string contains at least one character.
|
||||
const char *begin() const
|
||||
{
|
||||
return data();
|
||||
}
|
||||
const char *begin() const { return data(); }
|
||||
/// Returns a point past the last character of the string. It is not safe to dereference the
|
||||
/// pointer, but it is suitable for comparison.
|
||||
const char *end() const
|
||||
|
@ -111,10 +96,7 @@ struct SharedString
|
|||
}
|
||||
|
||||
/// \return true if the string contains no characters; false otherwise.
|
||||
bool empty() const
|
||||
{
|
||||
return std::string_view(*this).empty();
|
||||
}
|
||||
bool empty() const { return std::string_view(*this).empty(); }
|
||||
|
||||
/// \return true if the string starts with the specified prefix string; false otherwise
|
||||
bool starts_with(std::string_view prefix) const
|
||||
|
@ -141,10 +123,7 @@ struct SharedString
|
|||
/// auto str = slint::SharedString::from_number(42); // creates "42"
|
||||
/// auto str2 = slint::SharedString::from_number(100.5) // creates "100.5"
|
||||
/// \endcode
|
||||
static SharedString from_number(double n)
|
||||
{
|
||||
return SharedString(n);
|
||||
}
|
||||
static SharedString from_number(double n) { return SharedString(n); }
|
||||
|
||||
/// Returns true if \a a is equal to \a b; otherwise returns false.
|
||||
friend bool operator==(const SharedString &a, const SharedString &b)
|
||||
|
@ -206,10 +185,7 @@ struct SharedString
|
|||
|
||||
private:
|
||||
/// Use SharedString::from_number
|
||||
explicit SharedString(double n)
|
||||
{
|
||||
cbindgen_private::slint_shared_string_from_number(this, n);
|
||||
}
|
||||
explicit SharedString(double n) { cbindgen_private::slint_shared_string_from_number(this, n); }
|
||||
void *inner; // opaque
|
||||
};
|
||||
|
||||
|
|
|
@ -134,45 +134,21 @@ public:
|
|||
return VRc(inner);
|
||||
}
|
||||
|
||||
const X *operator->() const
|
||||
{
|
||||
return &inner->data;
|
||||
}
|
||||
const X &operator*() const
|
||||
{
|
||||
return inner->data;
|
||||
}
|
||||
X *operator->()
|
||||
{
|
||||
return &inner->data;
|
||||
}
|
||||
X &operator*()
|
||||
{
|
||||
return inner->data;
|
||||
}
|
||||
const X *operator->() const { return &inner->data; }
|
||||
const X &operator*() const { return inner->data; }
|
||||
X *operator->() { return &inner->data; }
|
||||
X &operator*() { return inner->data; }
|
||||
|
||||
const VRc<VTable, Dyn> &into_dyn() const
|
||||
{
|
||||
return *reinterpret_cast<const VRc<VTable, Dyn> *>(this);
|
||||
}
|
||||
|
||||
VRef<VTable> borrow() const
|
||||
{
|
||||
return { inner->vtable, inner->data_ptr() };
|
||||
}
|
||||
VRef<VTable> borrow() const { return { inner->vtable, inner->data_ptr() }; }
|
||||
|
||||
friend bool operator==(const VRc &a, const VRc &b)
|
||||
{
|
||||
return a.inner == b.inner;
|
||||
}
|
||||
friend bool operator!=(const VRc &a, const VRc &b)
|
||||
{
|
||||
return a.inner != b.inner;
|
||||
}
|
||||
const VTable *vtable() const
|
||||
{
|
||||
return inner->vtable;
|
||||
}
|
||||
friend bool operator==(const VRc &a, const VRc &b) { return a.inner == b.inner; }
|
||||
friend bool operator!=(const VRc &a, const VRc &b) { return a.inner != b.inner; }
|
||||
const VTable *vtable() const { return inner->vtable; }
|
||||
};
|
||||
|
||||
template<typename VTable, typename X = Dyn>
|
||||
|
|
|
@ -53,7 +53,10 @@ static GLint compile_shader(GLuint program, GLuint shader_type, const GLchar *co
|
|||
glGetIntegerv(ParamName, (GLint *)&saved_value); \
|
||||
BindingFn(TargetName, new_value); \
|
||||
} \
|
||||
~StructName() { BindingFn(TargetName, saved_value); } \
|
||||
~StructName() \
|
||||
{ \
|
||||
BindingFn(TargetName, saved_value); \
|
||||
} \
|
||||
}
|
||||
|
||||
DEFINE_SCOPED_BINDING(ScopedTextureBinding, GL_TEXTURE_BINDING_2D, glBindTexture, GL_TEXTURE_2D);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue