feat: RECURRENCE-ID parsing, serialization, and round-trip support

Add recurrence_id field to Event domain model. Parse and serialize
RECURRENCE-ID from/to iCalendar files. Override events (with
RECURRENCE-ID but no RRULE) are safe to rewrite. Save validation
rejects events with both RECURRENCE-ID and RRULE.
This commit is contained in:
2026-07-23 18:55:31 +01:00
parent 6c1f58ffb0
commit 3b73badf5d
3 changed files with 80 additions and 3 deletions

View File

@@ -50,6 +50,7 @@ struct Event {
std::optional<RecurrenceRule> recurrence;
std::vector<TimePoint> recurrence_additions;
std::vector<TimePoint> recurrence_exceptions;
std::optional<TimePoint> recurrence_id;
};
struct Calendar {
@@ -70,4 +71,11 @@ struct Calendar {
return event.recurrence.has_value() || !event.recurrence_additions.empty();
}
// True when this event is a detached override of a recurring series
// (has a RECURRENCE-ID but is not itself a recurring series).
[[nodiscard]] constexpr bool is_override(const Event& event) noexcept
{
return event.recurrence_id.has_value();
}
} // namespace nocal