EntityBindings.h header

#include <ew/app/EntityBindings.h>

Namespace ew::app

EntityBindings class

class ew::app::EntityBindings

The names a validation rule may use: the fields of the object under test, the fields of the objects it references, and – through the shared resolver – any object in the world.

price is this object's price. owner.name is the name of whatever owner refers to. members.age is EVERY member's age at once, because a list-valued reference resolves to one value per element – which is what lets MIN(members.age) >= 18 be a rule rather than a report. @Rhys.stats.strength is some other object entirely; see ew::app::expression::WorldResolver.

The nearer name wins. A name is looked for on the object under test first and in the world second, so price keeps meaning this object's price no matter what anyone names an entity. An object can always be named explicitly with @.

A field that is declared but unset resolves to a blank, NOT an error: a rule has to be able to say ISEMPTY(motto), and every rule over a category would otherwise fail on the first object that had not filled the field in yet. A name that is not declared anywhere IS an error, and says so by name – a typo must not read as an empty field and quietly pass.

Members

ew::app::expression::EntityBindings::EntityBindings(const ew::core::project::Project &project, const ew::core::entity::Entity &entity, std::optional< qint64 > instant, Viewer viewer={})

Binds to entity in project. instant pins every value to that moment on the timeline (Entity::valueAt); std::nullopt reads the entity's base values. viewer is who the expression is read as – the default is the author, who sees everything.

bool ew::app::expression::EntityBindings::isNameStart(QChar character) const override

Adds the object sigil, so @Rhys begins a name.

bool ew::app::expression::EntityBindings::isNameCharacter(QChar character) const override

Adds the path characters, so owner.name and inventory[2].weight are each one name.

std::optional< std::vector< ew::core::expression::Value > > ew::app::expression::EntityBindings::resolve(QStringView name, QString &error) const override

Resolves a dotted path from the bound entity, then from the world.

QStringList ew::app::expression::EntityBindings::names() const override

Every field of the bound entity, plus name, plus <field>.name for each reference field, plus every object in the world – one hop, because two would enumerate the codex.