aui#
Promise type specialization for AFuture
| Header: | #include <AUI/Thread/AFutureCpp20Coro.h> |
| CMake: | aui_link(my_target PUBLIC aui::core) |
Detailed Description#
Provides return_void (required by the coroutine standard for void-returning promises) and delegates to CoPromiseTypeBase::return_() with no arguments.
Examples#
examples/ui/opengl_simple/CMakeLists.txt
OpenGL Example - Demonstrates how to integrate custom OpenGL rendering with AUI Framework.
cmake_minimum_required(VERSION 3.10)
get_filename_component(_t ${CMAKE_CURRENT_SOURCE_DIR} NAME)
aui_executable("aui.example.${_t}")
aui_link("aui.example.${_t}" PRIVATE aui::core aui::views)
examples/ui/backdrop/CMakeLists.txt
Backdrop - Backdrop effects demo.
cmake_minimum_required(VERSION 3.10)
aui_executable(aui.example.backdrop)
aui_compile_assets(aui.example.backdrop)
aui_link(aui.example.backdrop PRIVATE aui::core aui::views)
examples/ui/contacts/CMakeLists.txt
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
cmake_minimum_required(VERSION 3.10)
aui_executable(aui.example.contacts)
aui_link(aui.example.contacts PRIVATE aui::core aui::views)
examples/ui/infinite_lazy_list/CMakeLists.txt
Infinite Lazy List - Usage of AUI_DECLARATIVE_FOR to make an infinite lazy list.
cmake_minimum_required(VERSION 3.10)
aui_executable(aui.example.infinite_lazy_list)
aui_link(aui.example.infinite_lazy_list PRIVATE aui::core aui::views)
examples/ui/infinite_lazy_list/src/main.cpp
Infinite Lazy List - Usage of AUI_DECLARATIVE_FOR to make an infinite lazy list.
};
});
return Vertical {
AUI_DECLARATIVE_FOR(i, *state->items, AVerticalLayout) { return Label{} & i->value; },
Centered {
_new<ASpinnerV2>() AUI_LET {
AObject::connect(it->redrawn, AObject::GENERIC_OBSERVER, [state] {
// when a spinner appears, we indicate that we need more items.
state->needMore = true;
examples/ui/views/CMakeLists.txt
Views Example - All-in-one views building example.
examples/ui/views/src/ExampleWindow.cpp
Views Example - All-in-one views building example.
}
}),
_new<ASpacerExpanding>(),
} AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } },
AUI_DECLARATIVE_FOR(i, *state->colors, AWordWrappingLayout) {
return Horizontal {
_new<ALabel>(i.toString()) AUI_OVERRIDE_STYLE {
TextColor { i.readableBlackOrWhite() },
}
} AUI_OVERRIDE_STYLE {
examples/ui/embedded_sdl/CMakeLists.txt
SDL3 - This code demonstrates how to integrate the AUI Framework with SDL3 to create a window with OpenGL rendering.
set(AUIB_SDL3_VALIDATE OFF)
auib_import(SDL3 https://github.com/libsdl-org/SDL VERSION release-3.2.26)
aui_executable(aui.example.embedded_sdl)
aui_link(aui.example.embedded_sdl PRIVATE aui::core aui::views)
if (TARGET SDL3::SDL3-static)
aui_link(aui.example.embedded_sdl PRIVATE SDL3::SDL3-static)
elseif (TARGET SDL3::SDL3-shared)
examples/basic/hello_world/CMakeLists.txt
Console Hello World Example - Basic CLI Hello World application.
project(project_template)
# Use AUI.Boot
#
# Download aui.boot.cmake (one-time):
# curl https://raw.githubusercontent.com/aui-framework/aui/refs/heads/develop/aui.boot.cmake -o aui.boot.cmake
#
# Or use CLI mode:
# cmake -P aui.boot.cmake update
#
examples/app/fractal/CMakeLists.txt
Fractal Example - Fractal viewer application demonstrating usage of custom shaders.
if (NOT (AUI_PLATFORM_WIN OR AUI_PLATFORM_LINUX OR AUI_PLATFORM_MACOS))
return()
endif ()
aui_executable(aui.example.fractal)
aui_compile_assets(aui.example.fractal)
aui_link(aui.example.fractal PRIVATE aui::core aui::views)
examples/app/notes/CMakeLists.txt
Notes App - Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.
examples/app/notes/src/main.cpp
Notes App - Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.
},
/// [scrollarea]
AScrollArea::Builder()
.withContents(
AUI_DECLARATIVE_FOR(note, *mNotes, AVerticalLayout) {
observeChangesForDirty(note);
return notePreview(note) AUI_LET {
connect(it->clicked, [this, note] { mCurrentNote = note; });
it& mCurrentNote > [note](AView& view, const _<Note>& currentNote) {
ALOG_DEBUG(LOG_TAG) << "currentNote == note " << currentNote << " == " << note;
examples/app/minesweeper/CMakeLists.txt
Minesweeper Game - Minesweeper game implementation driven by ass.
if (NOT (AUI_PLATFORM_WIN OR AUI_PLATFORM_LINUX OR AUI_PLATFORM_MACOS))
return()
endif ()
aui_executable(aui.example.minesweeper)
aui_compile_assets(aui.example.minesweeper)
aui_link(aui.example.minesweeper PRIVATE aui::core aui::views)
examples/app/game_of_life/CMakeLists.txt
Game of Life - Game of Life implementation that uses advanced large dynamic data rendering techniques such as ITexture, AImage to be GPU friendly. The computation is performed in AThreadPool.
examples/app/game_of_life/src/main.cpp
Game of Life - Game of Life implementation that uses advanced large dynamic data rendering techniques such as ITexture, AImage to be GPU friendly. The computation is performed in AThreadPool.
},
} AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } },
},
Centered {
_new<CellsView>(aui::ptr::fake_shared(&mCells)) AUI_OVERRIDE_STYLE {
Expanding(),
BackgroundSolid(AColor::BLACK),
},
},
} AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } });
examples/7guis/cells/CMakeLists.txt
7GUIs Cells - Spreadsheet processor (Excel).
cmake_minimum_required(VERSION 3.10)
aui_executable(aui.example.cells)
aui_link(aui.example.cells PRIVATE aui::views)
aui_enable_tests(aui.example.cells)
examples/7guis/cells/src/AST.cpp
7GUIs Cells - Spreadsheet processor (Excel).
examples/7guis/cells/src/main.cpp
7GUIs Cells - Spreadsheet processor (Excel).
mConnection = connect(mCell.value, [this](const formula::Value& v) {
ALayoutInflater::inflate(
this,
std::visit(
aui::lambda_overloaded {
[](std::nullopt_t) -> _<AView> { return _new<AView>(); },
[](double v) -> _<AView> { return Label { "{}"_format(v) } AUI_OVERRIDE_STYLE { ATextAlign::RIGHT }; },
[](const AString& v) -> _<AView> { return Label { "{}"_format(v) }; },
[](const formula::Range& v) -> _<AView> { return Label { "#RANGE?" }; },
},
examples/7guis/cells/src/Functions.cpp
7GUIs Cells - Spreadsheet processor (Excel).
#include <range/v3/all.hpp>
#include "Functions.h"
namespace {
template<aui::invocable<formula::Value> Callback>
void forEachArgAndRangeCell(const functions::Ctx& ctx, Callback&& callback) {
for (const auto& arg : ctx.args) {
if (auto rng = std::get_if<formula::Range>(&arg)) {
for (const auto& cell : ctx.spreadsheet[*rng]) {
callback(cell.value);
examples/7guis/cells/src/Tokens.cpp
7GUIs Cells - Spreadsheet processor (Excel).
examples/7guis/cells/src/Tokens.h
7GUIs Cells - Spreadsheet processor (Excel).
};
using Any = std::variant<Identifier, Double, Semicolon, LPar, RPar, Colon, Plus, Minus, Asterisk, Slash, LAngle, RAngle, StringLiteral>;
AVector<token::Any> parse(aui::no_escape<ATokenizer> t);
} // namespace token
examples/7guis/cells/src/Spreadsheet.h
7GUIs Cells - Spreadsheet processor (Excel).
bool operator==(const RangeIterator&) const = default;
bool operator!=(const RangeIterator&) const = default;
};
return aui::range(
RangeIterator { .spreadsheet = this, .range = range, .current = range.from },
RangeIterator { .spreadsheet = this, .range = range, .current = { Cell::UNDEFINED, Cell::UNDEFINED } });
}
glm::uvec2 size() const { return mSize; }
examples/7guis/counter/CMakeLists.txt
7GUIs Counter - Simple counter.
cmake_minimum_required(VERSION 3.10)
aui_executable(aui.example.counter)
aui_link(aui.example.counter PRIVATE aui::views)
examples/7guis/crud/CMakeLists.txt
7GUIs CRUD - Create/Read/Update/Delete example.
cmake_minimum_required(VERSION 3.10)
aui_executable(aui.example.crud)
aui_link(aui.example.crud PRIVATE aui::views)
examples/7guis/crud/src/main.cpp
7GUIs CRUD - Create/Read/Update/Delete example.
Label { "Filter prefix:" },
_new<ATextField>() AUI_OVERRIDE_STYLE { Expanding(1, 0) } && mFilterPrefix,
} AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } },
AScrollArea::Builder().withExpanding().withContents(
AUI_DECLARATIVE_FOR(i, *mUsers | FILTER_VIEW, AVerticalLayout) {
auto view = _new<ALabel>();
view & i->displayName;
connect(mSelectedUser, view, [this, &view = *view, i] {
view.setAssName("selected", mSelectedUser == i);
});
examples/7guis/timer/CMakeLists.txt
7GUIs Timer - Timer example.
cmake_minimum_required(VERSION 3.10)
aui_executable(aui.example.timer)
aui_link(aui.example.timer PRIVATE aui::views)
examples/7guis/timer/src/main.cpp
7GUIs Timer - Timer example.
Label { "Duration:" },
Slider {
.value = AUI_REACT(float(mDuration->count()) / float(MAX_DURATION.count())),
.onValueChanged =
[this](aui::float_within_0_1 newValue) {
mDuration =
high_resolution_clock::duration(long(float(MAX_DURATION.count()) * float(newValue)));
},
} AUI_OVERRIDE_STYLE { Expanding { 1, 0 } },
} AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } },
examples/7guis/temperature_converter/CMakeLists.txt
7GUIs Temperature Converter - Fahrenheit to Celsius and vice versa.
cmake_minimum_required(VERSION 3.10)
aui_executable(aui.example.temperature_converter)
aui_link(aui.example.temperature_converter PRIVATE aui::views)
examples/7guis/circle_drawer/CMakeLists.txt
7GUIs Circle Drawer - Undo, redo, dialog control.
cmake_minimum_required(VERSION 3.10)
aui_executable(aui.example.circle_drawer)
aui_link(aui.example.circle_drawer PRIVATE aui::views)
examples/7guis/circle_drawer/src/main.cpp
7GUIs Circle Drawer - Undo, redo, dialog control.
examples/7guis/flight_booker/CMakeLists.txt
7GUIs Flight Booker - Flight Booker.
auib_import(ctre https://github.com/hanickadot/compile-time-regular-expressions
VERSION 6225211806c48230e5d17a1e555ef69e7325051c
CMAKE_ARGS -DCTRE_BUILD_TESTS=OFF)
aui_executable(aui.example.flight_booker)
aui_link(aui.example.flight_booker PRIVATE aui::views ctre::ctre)
Public Methods#
return_void#
Called by the compiler when the coroutine co_return s without a value.
Examples:
examples/ui/contacts/src/main.cpp
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
mSelectedContact = nullptr;
}
_<AView> indexedList() {
return AUI_DECLARATIVE_FOR(group, *mContacts | ranges::views::chunk_by([](const _<Contact>& lhs, const _<Contact>& rhs) {
return groupLetter(lhs->displayName) == groupLetter(rhs->displayName);
}), AVerticalLayout) {
auto firstContact = *ranges::begin(group);
auto firstLetter = groupLetter(firstContact->displayName);
ALogger::info("Test") << "Computing view for group " << AString(1, firstLetter);
examples/ui/infinite_lazy_list/src/main.cpp
Infinite Lazy List - Usage of AUI_DECLARATIVE_FOR to make an infinite lazy list.
};
});
return Vertical {
AUI_DECLARATIVE_FOR(i, *state->items, AVerticalLayout) { return Label{} & i->value; },
Centered {
_new<ASpinnerV2>() AUI_LET {
AObject::connect(it->redrawn, AObject::GENERIC_OBSERVER, [state] {
// when a spinner appears, we indicate that we need more items.
state->needMore = true;
examples/ui/views/src/ExampleWindow.cpp
Views Example - All-in-one views building example.
}
}),
_new<ASpacerExpanding>(),
} AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } },
AUI_DECLARATIVE_FOR(i, *state->colors, AWordWrappingLayout) {
return Horizontal {
_new<ALabel>(i.toString()) AUI_OVERRIDE_STYLE {
TextColor { i.readableBlackOrWhite() },
}
} AUI_OVERRIDE_STYLE {
examples/app/notes/src/main.cpp
Notes App - Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.
},
/// [scrollarea]
AScrollArea::Builder()
.withContents(
AUI_DECLARATIVE_FOR(note, *mNotes, AVerticalLayout) {
observeChangesForDirty(note);
return notePreview(note) AUI_LET {
connect(it->clicked, [this, note] { mCurrentNote = note; });
it& mCurrentNote > [note](AView& view, const _<Note>& currentNote) {
ALOG_DEBUG(LOG_TAG) << "currentNote == note " << currentNote << " == " << note;
examples/7guis/crud/src/main.cpp
7GUIs CRUD - Create/Read/Update/Delete example.
Label { "Filter prefix:" },
_new<ATextField>() AUI_OVERRIDE_STYLE { Expanding(1, 0) } && mFilterPrefix,
} AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } },
AScrollArea::Builder().withExpanding().withContents(
AUI_DECLARATIVE_FOR(i, *mUsers | FILTER_VIEW, AVerticalLayout) {
auto view = _new<ALabel>();
view & i->displayName;
connect(mSelectedUser, view, [this, &view = *view, i] {
view.setAssName("selected", mSelectedUser == i);
});