mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-27 12:29:41 +00:00

sixtyfps::cbindgen_private Having private in the name makes it clear that this is ... private, and cbindgen helps remember that it's generated.
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
/* LICENSE BEGIN
|
|
|
|
This file is part of the Sixty FPS Project
|
|
|
|
Copyright (c) 2020 Olivier Goffart <olivier.goffart@sixtyfps.io>
|
|
Copyright (c) 2020 Simon Hausmann <simon.hausmann@sixtyfps.io>
|
|
|
|
SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
LICENSE END */
|
|
#pragma once
|
|
#include "sixtyfps_sharedarray_internal.h"
|
|
|
|
namespace sixtyfps {
|
|
|
|
template<typename T>
|
|
struct SharedArray
|
|
{
|
|
SharedArray()
|
|
{
|
|
cbindgen_private::sixtyfps_shared_array_new_null(reinterpret_cast<SharedArray<uint8_t> *>(this));
|
|
}
|
|
|
|
SharedArray(const SharedArray &other)
|
|
{
|
|
cbindgen_private::sixtyfps_shared_array_clone(
|
|
reinterpret_cast<SharedArray<uint8_t> *>(this),
|
|
reinterpret_cast<const SharedArray<uint8_t> *>(&other));
|
|
}
|
|
~SharedArray()
|
|
{
|
|
cbindgen_private::sixtyfps_shared_array_drop(reinterpret_cast<SharedArray<uint8_t> *>(this));
|
|
}
|
|
SharedArray &operator=(const SharedArray &other)
|
|
{
|
|
cbindgen_private::sixtyfps_shared_array_drop(reinterpret_cast<SharedArray<uint8_t> *>(this));
|
|
cbindgen_private::sixtyfps_shared_array_clone(
|
|
reinterpret_cast<SharedArray<uint8_t> *>(this),
|
|
reinterpret_cast<const SharedArray<uint8_t> *>(&other));
|
|
return *this;
|
|
}
|
|
SharedArray &operator=(SharedArray &&other)
|
|
{
|
|
std::swap(inner, other.inner);
|
|
return *this;
|
|
}
|
|
|
|
private:
|
|
void *inner; // opaque
|
|
};
|
|
}
|