OperationKind.h header

#include <ew/core/OperationKind.h>

Namespace ew::core

Enumerations

enum class OperationKind { Applied, Undone, Redone }

What a journal entry records happening to its subject.

Undoing a change IS a change, and the journal records it as one rather than deleting the entry that undoing reverses – an append-only account of what happened, not a running diff of where things stand. Without this, the same description would appear twice with nothing to say which occurrence put the value there and which took it away.

Serialized as a stable lowercase token. Switches over this enum omit a default: label so C4062 fails the build on an unhandled value; see ProjectFacet for the same reasoning.

Functions

std::optional< OperationKind > ew::core::journal::operationKindFromToken(QStringView token)

Parses an operation kind from its token; std::nullopt if unrecognized. An ABSENT kind is the caller's decision, not this function's – a journal written before kinds existed has entries that were all applies, and JournalEntry reads a missing field that way.

QString ew::core::journal::toToken(OperationKind kind)

Returns the stable serialization token for kind ("applied" / "undone" / "redone").