AUI Framework
master
Cross-platform module-based framework for developing C++20 desktop applications
kAUI.h
1
/*
2
* AUI Framework - Declarative UI toolkit for modern C++20
3
* Copyright (C) 2020-2024 Alex2772 and Contributors
4
*
5
* SPDX-License-Identifier: MPL-2.0
6
*
7
* This Source Code Form is subject to the terms of the Mozilla Public
8
* License, v. 2.0. If a copy of the MPL was not distributed with this
9
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
*/
11
12
#pragma once
13
14
#include <range/v3/range_fwd.hpp>
// range-v3 breaks by AUI's let, lol so forward it
15
#include <AUI/Thread/AThreadPool.h>
16
#include <AUI/Thread/AFuture.h>
17
#include <type_traits>
18
45
#define me this, &std::remove_reference_t<decltype(*this)>
46
47
namespace
aui::impl::slot
{
48
template
<
typename
T>
49
struct
decode_type
{
50
using
type = T;
51
};
52
53
template
<
typename
T>
54
struct
decode_type
<
_
<T>> {
55
using
type = T;
56
};
57
58
template
<
typename
T>
59
using
decode_type_t =
typename
decode_type<T>::type;
60
}
61
90
#define slot(v) v, &aui::impl::slot::decode_type_t<std::decay_t<decltype(v)>>
91
142
#define AUI_PERFORM_AS_MEMBER(object, lambda) \
143
struct __apply ## __FUNCTION__ ## __LINE__ : std::decay_t<decltype(object)> { \
144
void operator()() { \
145
lambda; \
146
} \
147
}; \
148
(static_cast<__apply ## __FUNCTION__ ## __LINE__ &>(object))()
149
184
#define AUI_EMIT_FOREIGN_SIGNAL(object) (*object) ^ object
185
197
#define AUI_DEFER ARaiiHelper AUI_PP_CAT($AUI_DEFER_at_line_, __LINE__) = [&]
198
199
262
#define let ^ [&](const auto& it)
263
287
#define with_style + ass::PropertyListRecursive
288
329
#define async AThreadPool::global() * [=]()
330
331
360
#define asyncX AThreadPool::global() *
361
391
#define do_once if(static bool _aui_once = false; (!_aui_once && (_aui_once = true)))
392
396
#define ui_thread (*getThread()) * [=]()
397
401
#define ui_threadX (*getThread()) *
402
#define AUI_REPEAT(times) for(auto repeatStubIndex = 0; repeatStubIndex < times; ++repeatStubIndex)
403
#define AUI_REPEAT_ASYNC(times) for(auto repeatStubIndex = 0; repeatStubIndex < times; ++repeatStubIndex) AThreadPool::global() << [=]()
_
An std::weak_ptr with AUI extensions.
Definition:
SharedPtrTypes.h:177
slot
#define slot(v)
Passes some variable and type of the variable separated by comma. It's convenient to use with the con...
Definition:
kAUI.h:90
aui::impl::slot::decode_type
Definition:
kAUI.h:49