Skip to content

aui::lambda_overloaded#

Header:#include <AUI/Traits/callables.h>
CMake:aui_link(my_target PUBLIC aui::core)

Examples#

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/app/notes/src/main.cpp

Notes App — Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.

    void observeChangesForDirty(const _<Note>& note) {
        aui::reflect::for_each_field_value(
            *note,
            aui::lambda_overloaded {
              [&](auto& field) {},
              [&](APropertyReadable auto& field) {
                  ALOG_DEBUG(LOG_TAG) << "Observing for changes " << &field;
                  AObject::connect(field.changed, me::markDirty);
              },