EffectiveField.h header
#include <ew/core/project/EffectiveField.h>
Namespace ew::core::project
EffectiveField struct
struct ew::core::project::EffectiveField
One property an entity effectively has, together with where it was declared.
Provenance is not decoration: a writer looking at a property needs to know whether editing it changes one entity or every entity in a category, and a tool that offers to promote or demote it needs to know which end it currently lives on. Deriving that afterwards would mean re-walking the ancestry with a second copy of the composition rule, which is exactly how the answer and the explanation of the answer drift apart.
Exactly one of the two sources is set. ew::core::project::Project::effectiveFieldSourcesFor produces these; ew::core::project::Project::effectiveFieldsFor is the same walk with the provenance dropped.
Members
ew::core::taxonomy::FieldDefinition ew::core::project::EffectiveField::definition
The property itself, as it survived the walk – the declaration that won on its key.
ew::core::foundation::CategoryId ew::core::project::EffectiveField::sourceCategory
The category that declared it, or a null id when an entity did.
ew::core::foundation::ContentId ew::core::project::EffectiveField::sourceEntity
The entity that declared it as its own, or a null id when a category did.
ew::core::foundation::CategoryId ew::core::project::EffectiveField::membership
The MEMBERSHIP this property arrived through: the entity's primary category, or one of its additional ones. Null when the entity declared the property itself.
Distinct from sourceCategory, which names the category that DECLARED it – possibly an ancestor several levels up. This names the one the writer put on the entity, which is what they would have to remove to lose the property, and what a label saying "from Cursed Object" has to be built from.
bool ew::core::project::EffectiveField::shadowed = false
Whether another membership also declared this key and lost.
First wins by membership order, and the loss is REPORTED rather than silent: two categories that both declare "weight" mean different things by it often enough that quietly taking one is how an entity ends up showing a number nobody wrote.