From 4c47d3f6d51760821866f274e997b12161e73633 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 4 Jun 2016 21:18:55 +0100 Subject: [PATCH] Added RDATE property for saving data from a CalendarEventObject. Added the code and unit tests for the RDATE property. --- .../calendarevent/CalendarEvent-Save.cpp | 45 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 3 ++ 2 files changed, 48 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 0cf4cda..5236e1f 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1110,6 +1110,51 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the RDATE value. + + if (RecurranceDateData.size() > 0){ + + for (int RecurranceDateDataSeek = 0; RecurranceDateDataSeek < RecurranceDateData.size(); + RecurranceDateDataSeek++){ + + DataLine += "RDATE"; + + if (RecurranceDateDataValue[RecurranceDateDataSeek].size() > 0){ + + DataLine += ";VALUE="; + DataLine += RecurranceDateDataValue[RecurranceDateDataSeek]; + + } + + if (RecurranceDateDataTimeZoneParam[RecurranceDateDataSeek].size() > 0){ + + DataLine += ";TZID="; + DataLine += RecurranceDateDataTimeZoneParam[RecurranceDateDataSeek]; + + } + + if (RecurranceDateDataTokens[RecurranceDateDataSeek].size() > 0){ + + DataLine += ";"; + DataLine += RecurranceDateDataTokens[RecurranceDateDataSeek]; + + } + + DataLine += ":"; + DataLine += RecurranceDateData[RecurranceDateDataSeek]; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + } + *SaveData += "END:VEVENT\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaleventsave.h b/source/tests/xestiacalendar_icaleventsave.h index 2b52dc5..61ca2d1 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -129,6 +129,9 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "RESOURCES:DMAC RECEIVER\n" "RESOURCES;LANGUAGE=en:PAL-I TELEVISION SET\n" "RESOURCES;ALTREP=\"null:nodata\";STATUS=BROKEN:PAL/SECAM VCR\n" + "RDATE:20160120\n" + "RDATE;VALUE=DATE;TZID=Europe/Truro:20160121\n" + "RDATE;ZILCH=DATA:20160520\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5