From 8ce441e9372bb15b98a708d2fe09dd2fdd948057 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 5 Jun 2016 18:16:36 +0100 Subject: [PATCH] Added DTEND property for saving data from a CalendarFreeBusyObject. Added the code and unit tests for the DTEND property. --- .../CalendarFreeBusy-Save.cpp | 39 +++++++++++++++++++ .../tests/xestiacalendar_icalfreebusysave.h | 2 + 2 files changed, 41 insertions(+) diff --git a/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp b/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp index 1fabb01..ecf68e8 100644 --- a/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp +++ b/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp @@ -150,6 +150,45 @@ void CalendarFreeBusyObject::SaveObjectData(string *SaveData){ } + // Process the DTEND. + + if (DateTimeEndData.size() > 0){ + + DataLine += "DTEND"; + + if (DateTimeEndDataValue.size() > 0){ + + DataLine += ";VALUE="; + DataLine += DateTimeEndDataValue; + + } + + if (DateTimeEndDataTimeZoneID.size() > 0){ + + DataLine += ";TZID="; + DataLine += DateTimeEndDataTimeZoneID; + + } + + if (DateTimeEndDataTokens.size() > 0){ + + DataLine += ";"; + DataLine += DateTimeEndDataTokens; + + } + + DataLine += ":"; + DataLine += DateTimeEndData; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } *SaveData += "END:VFREEBUSY\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icalfreebusysave.h b/source/tests/xestiacalendar_icalfreebusysave.h index bc09da4..fdd5d97 100644 --- a/source/tests/xestiacalendar_icalfreebusysave.h +++ b/source/tests/xestiacalendar_icalfreebusysave.h @@ -61,6 +61,8 @@ TEST(iCalendarSaveFreeBusy, SaveFreeBusyTests){ "CONTACT;ALTREP=\"null:nodata\";LANGUAGE=en-GB;EXAMPLE=TOKEN:Contact Person\n" "DTSTART;VALUE=DATE-TIME;TZID=Europe/Truro;PARAMONE=YES;PARAMTWO=NO:20160131T1\n" " 03000Z\n" + "DTEND;VALUE=DATE-TIME;TZID=Europe/Truro;PARAMFOUR=YES;PARAMTHREE=NO:20160131T\n" + " 183000Z\n" "END:VFREEBUSY\n" "END:VCALENDAR"; -- 2.39.5