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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user