openlifa.openmui
importopenmui: a user interface as one semantic tree --- an OpenLifa specification, its C ABI and its C++ module
import openmui.spec;
Module name taken from this index's own test project for the package.
mcpp add openlifa.openmui@0.4.1
Usage
From this repository's own test project — built and run by CI, not written for the website.
import std;
import openmui.spec;
namespace spec = omui::spec;
int main() {
const auto actor = spec::Actor::parse("agent:reader;via=person:alice,agent:planner");
if (!actor || actor->via.size() != 2 || actor->text() != "agent:reader;via=person:alice,agent:planner") return 1;
spec::SemanticNode n;
n.id = "notes/delete";
n.role = spec::Role::button;
n.name = "Delete";
n.actions.push_back({.name = "activate", .effect = spec::Effect::irreversible, .verb = "note.delete", .answer = "yes"});
if (!spec::check(n).empty()) return 2;
if (spec::catalog::find("slider") == nullptr) return 3;
spec::Envelope e;
e.error(spec::error_code::needs_answer, "confirm").result(spec::exit_code::needs_answer);
if (e.exit_code() != 2) return 4;
std::println("{}", e.ndjson());
return 0;
}
tests/examples/openlifa.openmui/tests/consume.cpp · project tests/examples/openlifa.openmui
Build · upstream manifest
- targets
openmui-spec (lib)- manifest version
0.4.1- source
https://raw.githubusercontent.com/openlifa/openmui/0.4.1/mcpp.toml