From: Steve Brokenshire Date: Sat, 11 Jun 2016 09:16:45 +0000 (+0100) Subject: Added TZOFFSETTO property for saving data from a CalendarTimezoneObject. X-Git-Tag: release-0.02~131 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=c864ba7c1109df0cb68b58b995629ca891795230;p=xestiacalendar%2F.git Added TZOFFSETTO property for saving data from a CalendarTimezoneObject. Added the code and unit tests for the TZOFFSETTO 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 19920f7..dd0bad5 100644 --- a/source/objects/calendartimezone/CalendarTimezone-Save.cpp +++ b/source/objects/calendartimezone/CalendarTimezone-Save.cpp @@ -157,6 +157,34 @@ void CalendarTimezoneObject::SaveObjectData(string *SaveData){ DataLineProcessed.clear(); } + + // Process the TZOFFSETTO value. + + if (TimezoneStandardCollection[TimezoneStandardSeek].TimeZoneOffsetToData.size() > 0){ + + if (TimezoneStandardCollection[TimezoneStandardSeek].TimeZoneOffsetToTokens.size() > 0){ + + DataLine += "TZOFFSETTO;"; + DataLine += TimezoneStandardCollection[TimezoneStandardSeek].TimeZoneOffsetToTokens; + + } else { + + DataLine += "TZOFFSETTO"; + + } + + DataLine += ":"; + DataLine += TimezoneStandardCollection[TimezoneStandardSeek].TimeZoneOffsetToData; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } *SaveData += "END:STANDARD\n"; @@ -228,6 +256,34 @@ void CalendarTimezoneObject::SaveObjectData(string *SaveData){ DataLineProcessed.clear(); } + + // Process the TZOFFSETTO value. + + if (TimezoneDaylightCollection[TimezoneDaylightSeek].TimeZoneOffsetToData.size() > 0){ + + if (TimezoneDaylightCollection[TimezoneDaylightSeek].TimeZoneOffsetToTokens.size() > 0){ + + DataLine += "TZOFFSETTO;"; + DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].TimeZoneOffsetToTokens; + + } else { + + DataLine += "TZOFFSETTO"; + + } + + DataLine += ":"; + DataLine += TimezoneDaylightCollection[TimezoneDaylightSeek].TimeZoneOffsetToData; + 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 06283c1..6110400 100644 --- a/source/tests/xestiacalendar_icaltimezonesave.h +++ b/source/tests/xestiacalendar_icaltimezonesave.h @@ -67,26 +67,32 @@ TEST(iCalendarSaveTimezone, SaveTimezoneTests){ "BEGIN:STANDARD\n" "DTSTART:20160204T020000\n" "TZOFFSETFROM:-0500\n" + "TZOFFSETTO:-0400\n" "END:STANDARD\n" "BEGIN:STANDARD\n" "DTSTART;MEEP=MOO:20160205T020000\n" "TZOFFSETFROM;LETS=GO:-0500\n" + "TZOFFSETTO;EXAMPLE=DATA:-0400\n" "END:STANDARD\n" "BEGIN:STANDARD\n" "DTSTART;MEEP=MOO:20160206T020000\n" "TZOFFSETFROM;LETS=GO:-0500\n" + "TZOFFSETTO;EXAMPLE=DATA:-0400\n" "END:STANDARD\n" "BEGIN:DAYLIGHT\n" "DTSTART:20160204T020000\n" "TZOFFSETFROM:-0500\n" + "TZOFFSETTO:-0400\n" "END:DAYLIGHT\n" "BEGIN:DAYLIGHT\n" "DTSTART;MEEP=MOO:20160205T020000\n" "TZOFFSETFROM;LETS=GO:-0500\n" + "TZOFFSETTO;EXAMPLE=DATA:-0400\n" "END:DAYLIGHT\n" "BEGIN:DAYLIGHT\n" "DTSTART;MEEP=MOO:20160206T020000\n" "TZOFFSETFROM;LETS=GO:-0500\n" + "TZOFFSETTO;EXAMPLE=DATA:-0400\n" "END:DAYLIGHT\n" "END:VTIMEZONE\n" "END:VCALENDAR";