From: Steve Brokenshire Date: Sat, 11 Jun 2016 09:31:55 +0000 (+0100) Subject: Added RRULE property for saving data from a CalendarTimezoneObject. X-Git-Tag: release-0.02~130 X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=commitdiff_plain;h=ba9c31f949273de8ceff83c2c16ada0e586010b3 Added RRULE property for saving data from a CalendarTimezoneObject. Added the code and unit tests for the RRULE 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 dd0bad5..127ac00 100644 --- a/source/objects/calendartimezone/CalendarTimezone-Save.cpp +++ b/source/objects/calendartimezone/CalendarTimezone-Save.cpp @@ -185,6 +185,34 @@ void CalendarTimezoneObject::SaveObjectData(string *SaveData){ DataLineProcessed.clear(); } + + // Process the RRULE value. + + if (TimezoneStandardCollection[TimezoneStandardSeek].RecurranceRuleData.size() > 0){ + + if (TimezoneStandardCollection[TimezoneStandardSeek].RecurranceRuleDataTokens.size() > 0){ + + DataLine += "RRULE;"; + DataLine += TimezoneStandardCollection[TimezoneStandardSeek].RecurranceRuleDataTokens; + + } else { + + DataLine += "RRULE"; + + } + + DataLine += ":"; + DataLine += TimezoneStandardCollection[TimezoneStandardSeek].RecurranceRuleData; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } *SaveData += "END:STANDARD\n"; @@ -284,6 +312,34 @@ void CalendarTimezoneObject::SaveObjectData(string *SaveData){ DataLineProcessed.clear(); } + + // Process the RRULE value. + + if (TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceRuleData.size() > 0){ + + if (TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceRuleDataTokens.size() > 0){ + + DataLine += "RRULE;"; + DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceRuleDataTokens; + + } else { + + DataLine += "RRULE"; + + } + + DataLine += ":"; + DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].RecurranceRuleData; + 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 6110400..cf2266d 100644 --- a/source/tests/xestiacalendar_icaltimezonesave.h +++ b/source/tests/xestiacalendar_icaltimezonesave.h @@ -78,6 +78,7 @@ TEST(iCalendarSaveTimezone, SaveTimezoneTests){ "DTSTART;MEEP=MOO:20160206T020000\n" "TZOFFSETFROM;LETS=GO:-0500\n" "TZOFFSETTO;EXAMPLE=DATA:-0400\n" + "RRULE;YAK=YES:FREQ=DAILY;COUNT=10\n" "END:STANDARD\n" "BEGIN:DAYLIGHT\n" "DTSTART:20160204T020000\n" @@ -93,6 +94,7 @@ TEST(iCalendarSaveTimezone, SaveTimezoneTests){ "DTSTART;MEEP=MOO:20160206T020000\n" "TZOFFSETFROM;LETS=GO:-0500\n" "TZOFFSETTO;EXAMPLE=DATA:-0400\n" + "RRULE;YAK=YES:FREQ=DAILY;COUNT=10\n" "END:DAYLIGHT\n" "END:VTIMEZONE\n" "END:VCALENDAR";