TimelineDiff.h header
#include <ew/app/TimelineDiff.h>
Namespace ew::app
DiffEvent struct
struct ew::app::DiffEvent
One event as the timeline-diff engine sees it (TL-71): its id, its title (how a reader matches it across two timelines – "the Coronation" is the same event whether it happened in year 1200 or 1250), and its span [start, end].
Members
ew::core::ContentId ew::app::DiffEvent::id
The event's id.
QString ew::app::DiffEvent::title
The event's title, used to match it against the other timeline's events.
qint64 ew::app::DiffEvent::start = 0
The event's start instant (minutes since the epoch).
qint64 ew::app::DiffEvent::end = 0
The event's end instant.
TimelineDiffEntry struct
struct ew::app::TimelineDiffEntry
One line of a timeline comparison (TL-71): a matched pair, or an event unique to one side. For a matched entry both ids are set; for OnlyInA idB is null; for OnlyInB idA is null. The spans are the raw ones from each side (0 on the side an event is absent from), so a view can show the shift as startB - startA for a Moved entry.
Members
ew::core::ContentId ew::app::TimelineDiffEntry::idA
The A-side event's id, or null when the entry is OnlyInB.
ew::core::ContentId ew::app::TimelineDiffEntry::idB
The B-side event's id, or null when the entry is OnlyInA.
QString ew::app::TimelineDiffEntry::title
The event's title (the matched title, or the sole side's title).
TimelineDiffKind ew::app::TimelineDiffEntry::kind =
How this event compares across the two timelines.
qint64 ew::app::TimelineDiffEntry::startA = 0
The A-side start instant (0 when OnlyInB).
qint64 ew::app::TimelineDiffEntry::endA = 0
The A-side end instant (0 when OnlyInB).
qint64 ew::app::TimelineDiffEntry::startB = 0
The B-side start instant (0 when OnlyInA).
qint64 ew::app::TimelineDiffEntry::endB = 0
The B-side end instant (0 when OnlyInA).
bool operator==(const TimelineDiffEntry &, const TimelineDiffEntry &)=default
Value equality over all fields, so the diff is testable without a view.
Enumerations
enum class TimelineDiffKind { Unchanged, Moved, OnlyInA, OnlyInB }
How an event compares across the two timelines being differenced (TL-71).
Functions
std::vector< TimelineDiffEntry > ew::app::diffTimelines(const std::vector< DiffEvent > &a, const std::vector< DiffEvent > &b)
Differences the two timelines a and b (TL-71): pairs their events by title – so the same event in both histories is recognised as one line – and classifies each as Unchanged (same span), Moved (matched but shifted), OnlyInA, or OnlyInB.
Matching is by title, compared case-insensitively after trimming (a rename is treated as a different event, which is honest – the timelines genuinely disagree about what happened). Titles that repeat within one timeline (two "Battle"s) are paired in order, greedily, so N in A and M in B yield min(N, M) matched lines and the surplus falls to the OnlyIn side.
The result is ordered so a reader can scan it: the matched entries first, in A's order, then A's unique events (A order), then B's unique events (B order). Pure – no view, no calendar; a caller formats the shift in whatever reckoning it is showing.