From 39c108c1f90cb142ce0226c4ad3faa93812674fe Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 5 Jun 2016 23:55:24 +0100 Subject: [PATCH] Added EXDATE property for saving data from a CalendarJournalObject. Added the code and unit tests for the EXDATE property. --- .../calendarjournal/CalendarJournal-Save.cpp | 45 +++++++++++++++++++ source/tests/xestiacalendar_icaljournalsave.h | 3 ++ 2 files changed, 48 insertions(+) diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index 2827bb5..0d1a172 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -756,6 +756,51 @@ void CalendarJournalObject::SaveObjectData(string *SaveData){ } + // Process the EXDATE value. + + if (ExcludeDateData.size() > 0){ + + for (int ExcludeDateDataSeek = 0; ExcludeDateDataSeek < ExcludeDateData.size(); + ExcludeDateDataSeek++){ + + DataLine += "EXDATE"; + + if (ExcludeDateDataTimeZoneParam[ExcludeDateDataSeek].size() > 0){ + + DataLine += ";TZID="; + DataLine += ExcludeDateDataTimeZoneParam[ExcludeDateDataSeek]; + + } + + if (ExcludeDateDataValue[ExcludeDateDataSeek].size() > 0){ + + DataLine += ";VALUE="; + DataLine += ExcludeDateDataValue[ExcludeDateDataSeek]; + + } + + if (ExcludeDateDataTokens[ExcludeDateDataSeek].size() > 0){ + + DataLine += ";"; + DataLine += ExcludeDateDataTokens[ExcludeDateDataSeek]; + + } + + DataLine += ":"; + DataLine += ExcludeDateData[ExcludeDateDataSeek]; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + } + *SaveData += "END:VJOURNAL\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaljournalsave.h b/source/tests/xestiacalendar_icaljournalsave.h index fb69016..8ea3eb0 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -104,6 +104,9 @@ TEST(iCalendarSaveJournal, SaveEventTests){ "DESCRIPTION;ALTREP=\"null:nodata\";LANGUAGE=en-GB:This is the second journal de\n" " scription.\n" "DESCRIPTION;ZEBRAS=NO:This is the third journal description.\n" + "EXDATE:20160125T120000Z\n" + "EXDATE;TZID=Europe/Truro;VALUE=DATE-TIME:20160125T130000Z\n" + "EXDATE;ZOOP=ZIPPO:20160125T133000Z\n" "END:VJOURNAL\n" "END:VCALENDAR"; -- 2.39.5