EntityMerge.h header

#include <ew/app/EntityMerge.h>

Namespace ew::app

EntityReference struct

struct ew::app::EntityReference

One stored reference to an entity, found while scanning a project for a merge. Names the object that holds the reference and, in human terms, where within it, so the merge dialog can preview exactly what will be re-pointed before the writer commits.

Members

ew::core::ContentId ew::app::EntityReference::holderId

The object that holds the reference (its own id).

QString ew::app::EntityReference::holderLabel

A display label for the holder (its title/name, or a type name when it has none).

QString ew::app::EntityReference::where

A human description of the slot holding the reference (e.g. "reference field \"Mentor\"", "timeline participant", "map region", "comment", "pinned").

Functions

std::unique_ptr< ew::core::Command > ew::app::buildMergeEntitiesCommand(ew::core::Project &project, ew::core::ContentId sourceId, ew::core::ContentId targetId)

Builds an undoable command that merges entity sourceId into entity targetId within project: it fills gaps in the target from the source (field values the target lacks, an unknown birth/death, and the union of tags and audiences – never reducing the target's visibility), re-points every reference from the source to the target (the same slots entityReferences scans, dropping any reference that would become the target pointing at itself), transfers the pin if the source was pinned, then removes the source. The whole merge is one entry on the undo stack.

Returns null when the merge is not well-formed: either id is null, they are equal, or either does not identify an entity in project. Merge operates on the project's own entities; references held in mounted libraries are not rewritten (a library is a separate, often read-only repo).

std::vector< EntityReference > ew::app::entityReferences(const ew::core::Project &project, ew::core::ContentId entityId)

Every stored reference to entity entityId within project, for the merge preview. Scans the structured slots that hold an entity id – entity Reference-field values, timeline event participants and locations, map region/route/token links, comment and task targets, research- canvas cards and connections, plot-thread character arcs, the pinned set, entity-template Reference defaults, and inline object links (ewriter://object/) in document bodies. An entity's reference to itself is not reported. The result is empty when nothing points at entityId (so it can be merged or deleted with no fallout) or when entityId is not an entity.