Audience.h header

#include <ew/core/Audience.h>

Namespace ew::core

Audience struct

struct ew::core::Audience

A readership content visibility can be scoped to – "Players", "GM", "Editor", "Public".

Audiences are a lightweight, project-level registry (like the plot-thread registry), not full content objects: an object references the audiences it is visible to by id, so an audience can be renamed without touching a single piece of content.

Why identity is separate from the name. Before this existed, content referenced audiences by their display string, which made renaming one either impossible or silently destructive – every object would keep pointing at a readership that no longer existed, and because visibility is subtractive those objects become visible to NOBODY. Plot threads solved the same problem the same way and said so; audiences are the registry that comparison was pointing at.

It also matters ahead of any permission work: a permission subject identified by a string the user can edit is the retrofit nobody wants to do later.

Ids of projects written before this change are the audience name itself. That is deliberate, not a fallback – it makes the migration a no-op, because every stored reference already IS the id. New audiences get a UUID from the UI, so the core stays free of id-generation side effects. A migrated audience renamed later keeps its original id, which is exactly the point.

Members

QString ew::core::content::Audience::id

Stable identity; how content references this audience (survives renames). For audiences migrated from a pre-identity project this is the original name.

QString ew::core::content::Audience::name

The writer-facing name (e.g. "Players", "GM only").

bool operator==(const Audience &, const Audience &)=default

Two audiences compare equal when both fields match.