C++: rename SLINT_FEATURE_STD in SLINT_FEATURE_FREESTANDING with the opposite meaning

This commit is contained in:
Olivier Goffart 2023-08-21 16:52:30 +02:00 committed by GitHub
parent cc006e8baf
commit 146ed520e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 33 additions and 30 deletions

View file

@ -148,10 +148,11 @@ public:
/// Returns a new WindowAdapter
virtual std::unique_ptr<WindowAdapter> create_window_adapter() = 0;
#ifndef SLINT_FEATURE_STD
#ifdef SLINT_FEATURE_FREESTANDING
/// Returns the amount of milliseconds since start of the application.
///
/// This function should only be implemented if the runtime is compiled with no_std
/// This function should only be implemented if the runtime is compiled with
/// SLINT_FEATURE_FREESTANDING
virtual std::chrono::milliseconds duration_since_start() const
{
return {};
@ -230,7 +231,7 @@ inline void set_platform(std::unique_ptr<Platform> platform)
(void)w.release();
},
[]([[maybe_unused]] void *p) -> uint64_t {
#ifdef SLINT_FEATURE_STD
#ifndef SLINT_FEATURE_FREESTANDING
return 0;
#else
return reinterpret_cast<const Platform *>(p)->duration_since_start().count();

View file

@ -23,7 +23,7 @@
#include <functional>
#include <concepts>
#ifdef SLINT_FEATURE_STD
#ifndef SLINT_FEATURE_FREESTANDING
# include <iostream>
# include <thread>
# include <mutex>
@ -77,7 +77,7 @@ using cbindgen_private::TableColumn;
/// use slint::invoke_from_event_loop
inline void assert_main_thread()
{
#ifdef SLINT_FEATURE_STD
#ifndef SLINT_FEATURE_FREESTANDING
# ifndef NDEBUG
static auto main_thread_id = std::this_thread::get_id();
if (main_thread_id != std::this_thread::get_id()) {
@ -823,7 +823,7 @@ public:
/// If the model can update the data, it should also call `row_changed`
virtual void set_row_data(size_t, const ModelData &)
{
#ifdef SLINT_FEATURE_STD
#ifndef SLINT_FEATURE_FREESTANDING
std::cerr << "Model::set_row_data was called on a read-only model" << std::endl;
#endif
};
@ -1787,7 +1787,7 @@ void invoke_from_event_loop(Functor f)
[](void *data) { delete reinterpret_cast<Functor *>(data); });
}
#ifdef SLINT_FEATURE_STD
#ifndef SLINT_FEATURE_FREESTANDING
/// Blocking version of invoke_from_event_loop()
///

View file

@ -121,7 +121,7 @@ public:
Image() : data(Data::ImageInner_None()) { }
#ifdef SLINT_FEATURE_STD
#ifndef SLINT_FEATURE_FREESTANDING
/// Load an image from an image file
[[nodiscard]] static Image load_from_path(const SharedString &file_path)
{