ReferenceTargets.h header

#include <ew/app/ReferenceTargets.h>

Namespace ew::app

Functions

bool ew::app::entity::isReferenceTarget(const ew::app::library::MountedLibraries &libraries, const ew::core::project::Project &project, ew::core::foundation::CategoryId restriction, const ew::core::entity::Entity &entity)

Whether entity is one a reference property restricted to restriction may point at.

True for anything when restriction is null – that is the unrestricted field every project had before this. Otherwise the entity's category must BE that category or sit beneath it: an "Affiliation" restricted to Factions wants the orders and the guilds under Factions too, or the restriction would punish a writer for organizing.

entity is read against ITS OWN project's taxonomy, found through libraries, because a mounted library brings its own categories. Those carry different ids, so a mounted entity is matched by category NAME as well: a shared library's "Factions" is the same kind of thing as this project's, and names are the vocabulary mounts already compose on.

std::vector< std::pair< QString, ew::core::foundation::CategoryId > > ew::app::entity::referenceCategoryChoices(const ew::core::project::Project &project)

Every category in project as a (path, id) pair, ordered by path – what a picker for a reference restriction offers.

A path ("Factions / Orders") rather than a bare name: two categories may share a name at different places in the tree, and a picker showing "Orders" twice cannot be answered.

QString ew::app::entity::referenceRestrictionName(const ew::core::project::Project &project, ew::core::foundation::CategoryId restriction)

The name of restriction in project's taxonomy, or an empty string when it names nothing.

A restriction pointing at a category that has since been deleted reads as "no restriction" everywhere, rather than as a field that can never be filled in.