Project.h header

#include <ew/core/Project.h>

Namespace ew::core

Project class

class ew::core::Project

The in-memory content graph: owns every content object in an open project and resolves them by id. Serialization to the folder-of-text store and the command stack operate on this model. Objects are kept in ascending id order so any serialized output is deterministic and diff-stable.

Members

ew::core::project::Project::Project()

Constructs an empty project.

ew::core::project::Project::~Project()

Destroys the project and every object it owns.

ew::core::project::Project::Project(const Project &)=delete

Not copyable.

ew::core::project::Project::Project(Project &&)=delete

Not movable.

Project & ew::core::project::Project::operator=(const Project &)=delete

Not copyable.

Project & ew::core::project::Project::operator=(Project &&)=delete

Not movable.

content::ContentObject * ew::core::project::Project::add(std::unique_ptr< content::ContentObject > object)

Adds object, taking ownership. Returns a non-owning pointer to it, or null if object is null or an object with the same id is already present.

content::ContentObject * ew::core::project::Project::find(ew::core::foundation::ContentId id) const

Returns the object with id, or null if none is present.

bool ew::core::project::Project::contains(ew::core::foundation::ContentId id) const

Returns true if an object with id is present.

bool ew::core::project::Project::remove(ew::core::foundation::ContentId id)

Removes the object with id; returns true if one was removed.

std::unique_ptr< content::ContentObject > ew::core::project::Project::take(ew::core::foundation::ContentId id)

Removes the object with id and returns ownership of it, or null if none is present. Unlike remove(), the caller keeps the object (used to implement undo).

int ew::core::project::Project::objectCount() const

Returns the number of objects in the project.

std::vector< ew::core::foundation::ContentId > ew::core::project::Project::ids() const

Returns the ids of all objects, in ascending (deterministic) order.

void ew::core::project::Project::setPinned(ew::core::foundation::ContentId id, bool pinned)

Marks id pinned (a favorite) or unpinned.

bool ew::core::project::Project::isPinned(ew::core::foundation::ContentId id) const

Returns true if id is currently pinned.

std::vector< ew::core::foundation::ContentId > ew::core::project::Project::pinnedIds() const

Returns the ids of pinned objects that still exist, in ascending order.

void ew::core::project::Project::setSavedSearches(std::vector< SavedSearch > searches)

Replaces the project's saved searches.

const std::vector< SavedSearch > & ew::core::project::Project::savedSearches() const

Returns the project's saved searches, in order.

void ew::core::project::Project::setEntityTemplates(std::vector< entity::EntityTemplate > templates)

Replaces the project's entity-template registry – the reusable presets (category + pre-filled field values) a new codex entity can be created from.

const std::vector< entity::EntityTemplate > & ew::core::project::Project::entityTemplates() const

Returns the project's entity templates, in order.

void ew::core::project::Project::setAudiences(std::vector< QString > audiences)

Replaces the project's audience registry – the named readerships (e.g. "Players", "GM") that per-object visibility (ContentObject::visibleAudiences) can be scoped to.

const std::vector< QString > & ew::core::project::Project::audiences() const

Returns the project's audience registry, in order.

void ew::core::project::Project::setDefaultAudiences(std::set< QString > audiences)

Replaces the audiences a NEWLY created object starts out visible to.

Per-object visibility is subtractive: an object with an empty set is visible to EVERY audience, so an export for a readership always includes everything nobody has restricted. That makes "only these few things are for readers" impossible to express by tagging the few – you would have to tag all the rest. Setting a default (say "Author") inverts it: new content starts restricted, and content is PROMOTED to a readership rather than hidden from one. Empty (the default) keeps the original behaviour, so existing projects are unaffected.

This governs new objects only; ew::app::project::buildApplyAudienceToAllCommand applies a default to content that already exists.

const std::set< QString > & ew::core::project::Project::defaultAudiences() const

The audiences a newly created object starts out visible to; empty means unrestricted.

void ew::core::project::Project::setPlotThreads(std::vector< plot::PlotThread > plotThreads)

Replaces the project's plot-thread registry – the narrative through-lines (plot lines and character arcs) that scenes are tagged with (Document::plotThreadIds).

const std::vector< plot::PlotThread > & ew::core::project::Project::plotThreads() const

Returns the project's plot-thread registry, in order.

void ew::core::project::Project::setContinuityRules(std::vector< timeline::ContinuityRule > continuityRules)

Replaces the project's continuity-rule registry – the user-authored assertions (timeline::ContinuityRule) the timeline validator checks alongside its built-in rules.

const std::vector< timeline::ContinuityRule > & ew::core::project::Project::continuityRules() const

Returns the project's continuity-rule registry, in order.

void ew::core::project::Project::setTimelineEras(std::vector< timeline::TimelineEra > timelineEras)

Replaces the project's timeline-era registry (TL-18): the named background bands – the Third Age, the Occupation – drawn across the shared time axis. Replaced as a whole by one undoable command.

const std::vector< timeline::TimelineEra > & ew::core::project::Project::timelineEras() const

Returns the project's timeline-era registry, in order.

void ew::core::project::Project::setTimelineMarkers(std::vector< timeline::TimelineMarker > timelineMarkers)

Replaces the project's timeline-marker registry (TL-19): the "now" marker and other pinned instants drawn as labelled vertical lines across the shared time axis. Replaced as a whole by one undoable command.

const std::vector< timeline::TimelineMarker > & ew::core::project::Project::timelineMarkers() const

Returns the project's timeline-marker registry, in order.

void ew::core::project::Project::setTimelineBookmarks(std::vector< timeline::TimelineBookmark > timelineBookmarks)

Replaces the project's timeline-bookmark registry (TL-41): the named saved spans a writer returns to ("Act Two", "the war"). Replaced as a whole by one undoable command.

const std::vector< timeline::TimelineBookmark > & ew::core::project::Project::timelineBookmarks() const

Returns the project's timeline-bookmark registry, in order.

void ew::core::project::Project::setBeatSheet(plot::BeatSheet beatSheet)

Replaces the project's applied beat sheet – the chosen structure template and the scene mapped to each of its beats (an empty templateId means none applied).

const plot::BeatSheet & ew::core::project::Project::beatSheet() const

Returns the project's applied beat sheet.

void ew::core::project::Project::setMounts(std::vector< LibraryMount > mounts)

Replaces the project's mounted libraries (shared universes / reference repos).

const std::vector< LibraryMount > & ew::core::project::Project::mounts() const

Returns the project's mounted libraries, in order.

void ew::core::project::Project::setPropertyMigrationAnswer(QString answer)

Replaces the recorded answer to the property-migration prompt: empty (never asked), "accepted", or "declined".

Recorded so the prompt is asked ONCE per project rather than on every launch, and so a writer who declined is not nagged into an edit they refused.

const QString & ew::core::project::Project::propertyMigrationAnswer() const

The recorded answer to the property-migration prompt; empty when it has never been asked.

std::vector< ew::core::taxonomy::FieldDefinition > ew::core::project::Project::effectiveFieldsFor(const ew::core::entity::Entity &entity) const

Every property that applies to entity, in display order.

The entity-aware companion to taxonomy::Taxonomy::effectiveFields, which answers the DIFFERENT question "what does this category define" and keeps its own meaning. This one lives on Project because it is the only layer that can answer it: crossing an entity boundary means resolving an entity id to its category, and Project owns both the taxonomy and the entities.

The rule, in order: The category chain, root-down. Category to sub-category carries EVERYTHING. Where a category hangs from an entity, only the keys that category asked for cross drawn from everything reachable through that entity, its own one-off properties included. The receiving category decides; nothing is withheld from it by fiat. Each entity's own properties follow its own chain, so the queried entity's land last. A later declaration overrides an earlier one on the same key and keeps the earlier one's POSITION, so re-declaring a property does not move it.

One exception to 4: a FIXED property cannot be shadowed. The category supplies its value, and letting anything below re-declare it would be exactly the drift fixing it prevents.

Cycle-safe across the mixed tree. A category under an entity under a category can form a loop that no category-only guard can see, so the walk carries its own visited set.

std::vector< EffectiveField > ew::core::project::Project::effectiveFieldSourcesFor(const ew::core::entity::Entity &entity) const

Every property that applies to entity, in display order, each with where it was declared.

The same walk as effectiveFieldsFor and the one both are implemented from – that one is this one with the provenance dropped. A second implementation of the rule would answer differently the first time either was corrected.

Callers that need to SAY something about a property want this: whether editing it changes one entity or every entity in a category, which end promote and demote would move it between, and whether it is the entity's own. Exactly one source is set on each result.

bool ew::core::project::Project::ancestryIncludes(const ew::core::entity::Entity &entity, ew::core::foundation::CategoryId categoryId) const

Whether categoryId sits anywhere in the ancestry above entity.

The mixed-tree question no category-only walk can answer, and the guard a reparent needs: moving a category under an entity makes a loop exactly when that entity already hangs, however indirectly, beneath the category being moved. Cycle-safe itself, so it stays finite even when asked about a tree that is already looped.

ew::core::taxonomy::Taxonomy & ew::core::project::Project::taxonomy()

The project's codex taxonomy: user-defined categories and their field schemas.

const ew::core::taxonomy::Taxonomy & ew::core::project::Project::taxonomy() const

Const overload.

writing::WritingLog & ew::core::project::Project::writingLog()

The project's writing-activity log (words written per day), for productivity analytics.

const writing::WritingLog & ew::core::project::Project::writingLog() const

Const overload.

writing::WritingGoal & ew::core::project::Project::writingGoal()

The project's writing goals (daily habit target, manuscript target, deadline).

const writing::WritingGoal & ew::core::project::Project::writingGoal() const

Const overload.

calendar::Calendar & ew::core::project::Project::calendar()

The project's calendar (custom months, weekdays, era), used to interpret and format timeline instants.

const calendar::Calendar & ew::core::project::Project::calendar() const

Const overload.

void ew::core::project::Project::setCalendar(calendar::Calendar calendar)

Replaces the project's calendar.

const std::vector< calendar::Reckoning > & ew::core::project::Project::reckonings() const

The project's additional reckonings (TL-13): named regional datings of the same timeline (each a calendar + an epoch offset), which a reader may switch the display into. The primary calendar is the implicit zero-offset reckoning and is NOT in this list.

void ew::core::project::Project::setReckonings(std::vector< calendar::Reckoning > reckonings)

Replaces the project's reckoning registry, as a whole, by one undoable command.

const timeline::TimelineViewSettings & ew::core::project::Project::timelineViewSettings() const

The timeline view settings (how the timeline panel colours, groups, sizes, and labels events). One per-project configuration shared across all timelines.

void ew::core::project::Project::setTimelineViewSettings(timeline::TimelineViewSettings settings)

Replaces the project's timeline view settings.

void ew::core::project::Project::setTimelineViewPresets(std::vector< timeline::TimelineViewPreset > presets)

Replaces the project's user-saved timeline view presets – named bundles of the whole timeline view settings (TL-83) the reader can switch between in one gesture. Built-in presets are provided separately (ew::app::timeline::view::builtInTimelineViewPresets); this list is only the user's own.

const std::vector< timeline::TimelineViewPreset > & ew::core::project::Project::timelineViewPresets() const

Returns the project's user-saved timeline view presets, in order.