From: Steve Brokenshire Date: Sun, 5 Jun 2016 18:47:41 +0000 (+0100) Subject: Added FREEBUSY property for saving data from a CalendarFreeBusyObject. X-Git-Tag: release-0.02~202 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=0e734d02c42c09e69cbaba95ae25586d10d3abe7;p=xestiacalendar%2F.git Added FREEBUSY property for saving data from a CalendarFreeBusyObject. Added the code and unit tests for the FREEBUSY property. --- diff --git a/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp b/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp index 9132b94..d14ea57 100644 --- a/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp +++ b/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp @@ -432,6 +432,44 @@ void CalendarFreeBusyObject::SaveObjectData(string *SaveData){ } + // Process the FREEBUSY value. + + if (FreeBusyList.size() > 0){ + + for (int FreeBusyListSeek = 0; FreeBusyListSeek < FreeBusyList.size(); + FreeBusyListSeek++){ + + DataLine += "FREEBUSY"; + + if (FreeBusyListType[FreeBusyListSeek].size() > 0){ + + DataLine += ";FBTYPE="; + DataLine += FreeBusyListType[FreeBusyListSeek]; + + } + + if (FreeBusyListTokens[FreeBusyListSeek].size() > 0){ + + DataLine += ";"; + DataLine += FreeBusyListTokens[FreeBusyListSeek]; + + } + + DataLine += ":"; + DataLine += FreeBusyList[FreeBusyListSeek]; + 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 9d36a57..75f73bb 100644 --- a/source/tests/xestiacalendar_icalfreebusysave.h +++ b/source/tests/xestiacalendar_icalfreebusysave.h @@ -75,6 +75,9 @@ TEST(iCalendarSaveFreeBusy, SaveFreeBusyTests){ "COMMENT:This is the first comment.\n" "COMMENT;ALTREP=\"null:nodata\";LANGUAGE=en:This is the second comment.\n" "COMMENT;ZEBRAS=YES:This is the third comment.\n" + "FREEBUSY:20160202T210000Z/PT1H\n" + "FREEBUSY;FBTYPE=FREE:20160202T220000Z/PT1H\n" + "FREEBUSY;FBTYPE=BUSY-UNAVAILABLE;RESULT=ARGH;TEST=YES:20160202T230000Z/PT9H\n" "END:VFREEBUSY\n" "END:VCALENDAR";