AString#
Concept shortcut to std::is_arithmetic_v
| Header: | #include <AUI/Traits/concepts.h> |
| CMake: | aui_link(my_target PUBLIC aui::core) |
Examples#
examples/app/minesweeper/src/NewGameWindow.cpp
Minesweeper Game - Minesweeper game implementation driven by ass.
void NewGameWindow::updateDifficultyLabel() {
mMines->setMax(mWidth->getValue() * mHeight->getValue() * 3 / 4);
int difficulty = mWidth->getValue() * mHeight->getValue() / glm::max(mMines->getValue(), int64_t(1));
AString text = "Difficulty: ";
switch (difficulty) {
default:
case 0:
case 1:
text += "very low";
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/views/src/DemoListModel.h
Views Example - All-in-one views building example.
examples/7guis/cells/tests/FormulaTests.cpp
7GUIs Cells - Spreadsheet processor (Excel).
EXPECT_EQ(std::get<double>(formula::evaluate(mSpreadsheet, "0")), 0.0);
}
TEST_F(Cells_Formula, String) {
EXPECT_EQ(std::get<AString>(formula::evaluate(mSpreadsheet, "test")), "test");
}
TEST_F(Cells_Formula, EConstant) {
EXPECT_DOUBLE_EQ(std::get<double>(formula::evaluate(mSpreadsheet, "=1")), 1.0);
}
examples/app/minesweeper/src/CellView.cpp
Minesweeper Game - Minesweeper game implementation driven by ass.
examples/app/fractal/src/JumpToCoordsWindow.cpp
Fractal Example - Fractal viewer application demonstrating usage of custom shaders.
auto im = _new<ATextField>();
auto scale = _new<ATextField>();
auto pos = fractalView->getPlotPosition();
re->setText(AString::number(pos.x));
im->setText(AString::number(pos.y));
scale->setText(AString::number(fractalView->getPlotScale()));
setContents(Vertical {
_form({
examples/ui/contacts/src/model/Contact.h
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
examples/ui/contacts/src/view/ContactDetailsView.h
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
examples/ui/contacts/src/view/ContactDetailsView.cpp
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
namespace {
_<AView> profilePhoto(const _<Contact>& contact) {
return Centered {
Label {
AUI_REACT(contact->displayName->empty() ? "?" : AString(1, contact->displayName->first()).uppercase())
} AUI_WITH_STYLE { Opacity(0.5f), FontSize { 32_dp } },
} AUI_WITH_STYLE {
FixedSize { 64_dp },
BorderRadius { 32_dp },
BackgroundGradient { AColor::GRAY.lighter(0.5f), AColor::GRAY, 163_deg },
examples/ui/views/src/DemoListModel.cpp
Views Example - All-in-one views building example.
examples/7guis/cells/src/Functions.h
7GUIs Cells - Spreadsheet processor (Excel).
examples/7guis/cells/src/Functions.cpp
7GUIs Cells - Spreadsheet processor (Excel).
examples/7guis/cells/src/Tokens.h
7GUIs Cells - Spreadsheet processor (Excel).
examples/7guis/cells/src/Cell.cpp
7GUIs Cells - Spreadsheet processor (Excel).
examples/7guis/cells/src/AST.cpp
7GUIs Cells - Spreadsheet processor (Excel).
formula::Value evaluate(const Spreadsheet& ctx) override { return value; }
};
struct StringLiteralNode : INode {
AString value;
explicit StringLiteralNode(AString value) : value(std::move(value)) {}
~StringLiteralNode() override = default;
formula::Value evaluate(const Spreadsheet& ctx) override { return value; }
};
examples/7guis/cells/src/main.cpp
7GUIs Cells - Spreadsheet processor (Excel).