From: Steve Brokenshire Date: Sat, 11 Jun 2016 21:41:38 +0000 (+0100) Subject: Added RDATE property for saving data from a CalendarTimezoneObject. X-Git-Tag: release-0.02~128 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=d3fc919ab635089db80fddb5265430ae23038b4a;p=xestiacalendar%2F.git Added RDATE property for saving data from a CalendarTimezoneObject. Added the code and unit tests for the RDATE property in both STANDARD and DAYLIGHT timezone types. --- diff --git a/source/objects/calendartimezone/CalendarTimezone-Save.cpp b/source/objects/calendartimezone/CalendarTimezone-Save.cpp index 2dc194e..eaed644 100644 --- a/source/objects/calendartimezone/CalendarTimezone-Save.cpp +++ b/source/objects/calendartimezone/CalendarTimezone-Save.cpp @@ -259,6 +259,51 @@ void CalendarTimezoneObject::SaveObjectData(string *SaveData){ } } + + // Process the RDATE value. + + if (TimezoneStandardCollection[TimezoneStandardSeek].RecurranceDateData.size() > 0){ + + for (int CommentListSeek = 0; CommentListSeek < TimezoneStandardCollection[TimezoneStandardSeek].RecurranceDateData.size(); + CommentListSeek++){ + + DataLine += "RDATE"; + + if (TimezoneStandardCollection[TimezoneStandardSeek].RecurranceDateDataValue[CommentListSeek].size() > 0){ + + DataLine += ";VALUE="; + DataLine += TimezoneStandardCollection[TimezoneStandardSeek].RecurranceDateDataValue[CommentListSeek]; + + } + + if (TimezoneStandardCollection[TimezoneStandardSeek].RecurranceDateDataTimeZoneParam[CommentListSeek].size() > 0){ + + DataLine += ";TZID="; + DataLine += TimezoneStandardCollection[TimezoneStandardSeek].RecurranceDateDataTimeZoneParam[CommentListSeek]; + + } + + if (TimezoneStandardCollection[TimezoneStandardSeek].RecurranceDateDataTokens[CommentListSeek].size() > 0){ + + DataLine += ";"; + DataLine += TimezoneStandardCollection[TimezoneStandardSeek].RecurranceDateDataTokens[CommentListSeek]; + + } + + DataLine += ":"; + DataLine += TimezoneStandardCollection[TimezoneStandardSeek].RecurranceDateData[CommentListSeek]; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + } *SaveData += "END:STANDARD\n"; @@ -432,7 +477,52 @@ void CalendarTimezoneObject::SaveObjectData(string *SaveData){ } } + + // Process the RDATE value. + + if (TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceDateData.size() > 0){ + + for (int CommentListSeek = 0; CommentListSeek < TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceDateData.size(); + CommentListSeek++){ + + DataLine += "RDATE"; + + if (TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceDateDataValue[CommentListSeek].size() > 0){ + + DataLine += ";VALUE="; + DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceDateDataValue[CommentListSeek]; + + } + + if (TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceDateDataTimeZoneParam[CommentListSeek].size() > 0){ + + DataLine += ";TZID="; + DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceDateDataTimeZoneParam[CommentListSeek]; + + } + + if (TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceDateDataTokens[CommentListSeek].size() > 0){ + + DataLine += ";"; + DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceDateDataTokens[CommentListSeek]; + + } + + DataLine += ":"; + DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceDateData[CommentListSeek]; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + } + + } + *SaveData += "END:DAYLIGHT\n"; } diff --git a/source/tests/xestiacalendar_icaltimezonesave.h b/source/tests/xestiacalendar_icaltimezonesave.h index abeb5b9..5698b44 100644 --- a/source/tests/xestiacalendar_icaltimezonesave.h +++ b/source/tests/xestiacalendar_icaltimezonesave.h @@ -80,6 +80,8 @@ TEST(iCalendarSaveTimezone, SaveTimezoneTests){ "TZOFFSETTO;EXAMPLE=DATA:-0400\n" "RRULE;YAK=YES:FREQ=DAILY;COUNT=10\n" "COMMENT;ALTREP=\"null:nodata\";LANGUAGE=kw;YO=YOYOS:Example timezone comment.\n" + "RDATE;VALUE=DATE;TZID=Europe/Truro;BEEP=BOOP:20160205,20160207,20160216,20160\n" + " 305\n" "END:STANDARD\n" "BEGIN:DAYLIGHT\n" "DTSTART:20160204T020000\n" @@ -97,6 +99,8 @@ TEST(iCalendarSaveTimezone, SaveTimezoneTests){ "TZOFFSETTO;EXAMPLE=DATA:-0400\n" "RRULE;YAK=YES:FREQ=DAILY;COUNT=10\n" "COMMENT;ALTREP=\"null:nodata\";LANGUAGE=kw;YO=YOYOS:Example timezone comment.\n" + "RDATE;VALUE=DATE;TZID=Europe/Truro;BEEP=BOOP:20160205,20160207,20160216,20160\n" + " 305\n" "END:DAYLIGHT\n" "END:VTIMEZONE\n" "END:VCALENDAR";