AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
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
44#define me this, &std::remove_reference_t<decltype(*this)>
45
46namespace aui::impl::slot {
47 template<typename T>
48 struct decode_type {
49 using type = T;
50 };
51
52 template<typename T>
53 struct decode_type<_<T>> {
54 using type = T;
55 };
56
57 template<typename T>
58 using decode_type_t = typename decode_type<T>::type;
59}
60
88#define slot(v) v, &aui::impl::slot::decode_type_t<std::decay_t<decltype(v)>>
89
140#define AUI_PERFORM_AS_MEMBER(object, lambda) \
141 struct __apply ## __FUNCTION__ ## __LINE__ : std::decay_t<decltype(object)> { \
142 void operator()() { \
143 lambda; \
144 } \
145 }; \
146 (static_cast<__apply ## __FUNCTION__ ## __LINE__ &>(object))()
147
183#define AUI_EMIT_FOREIGN_SIGNAL(object) (*object) ^ object
184
196#define AUI_DEFER ARaiiHelper AUI_PP_CAT($AUI_DEFER_at_line_, __LINE__) = [&]
197
198
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
397#define ui_thread (*getThread()) * [=]()
398
403#define ui_threadX (*getThread()) *
404
405#define AUI_REPEAT(times) for(auto repeatStubIndex = 0; repeatStubIndex < times; ++repeatStubIndex)
406#define AUI_REPEAT_ASYNC(times) for(auto repeatStubIndex = 0; repeatStubIndex < times; ++repeatStubIndex) AThreadPool::global() << [=]()
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:178
Definition kAUI.h:48