feat: embedded VTIMEZONE parsing, round-trip serialization
This commit is contained in:
@@ -27,6 +27,15 @@ private:
|
||||
friend class IcsStore;
|
||||
};
|
||||
|
||||
// Embedded VTIMEZONE definition preserved for round-trip serialization.
|
||||
struct VTimezoneDefinition {
|
||||
std::string tzid;
|
||||
// Complete raw content between BEGIN:VTIMEZONE and END:VTIMEZONE (exclusive
|
||||
// of the framing lines). Empty when the definition was not parsed from a
|
||||
// source calendar.
|
||||
std::string raw;
|
||||
};
|
||||
|
||||
struct LoadResult {
|
||||
std::vector<Event> events;
|
||||
std::vector<std::string> warnings;
|
||||
@@ -36,6 +45,9 @@ struct LoadResult {
|
||||
// Exact bytes that produced this result. Copies share immutable storage and
|
||||
// can be supplied to save/restore as an optimistic concurrency token.
|
||||
FileRevision revision;
|
||||
// Embedded VTIMEZONE definitions from the source calendar, preserved for
|
||||
// round-trip serialization. Populated only by load().
|
||||
std::vector<VTimezoneDefinition> vtimezones;
|
||||
};
|
||||
|
||||
class IcsStore {
|
||||
@@ -49,9 +61,11 @@ public:
|
||||
// requests durable filesystem flushes. I/O failures before replacement are
|
||||
// reported as std::runtime_error. If expected is present, the destination
|
||||
// must still contain the exact bytes represented by that revision.
|
||||
// Supply vtimezones to preserve embedded timezone definitions.
|
||||
static FileRevision save(
|
||||
const std::filesystem::path& path, std::span<const Event> events,
|
||||
std::optional<FileRevision> expected = std::nullopt);
|
||||
std::optional<FileRevision> expected = std::nullopt,
|
||||
std::span<const VTimezoneDefinition> vtimezones = {});
|
||||
|
||||
// Restores the exact bytes in <path>.bak without changing the backup.
|
||||
static FileRevision restore_backup(
|
||||
|
||||
Reference in New Issue
Block a user