From e9ea0552688d66681ff40857e656a5953642a60d Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 1 Jun 2016 22:48:51 +0100 Subject: [PATCH] Added DESCRIPTION property for saving data from a CalendarEventObject. Added the code and unit tests for the DESCRIPTION property. --- .../calendarevent/CalendarEvent-Save.cpp | 42 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 2 + 2 files changed, 44 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index ee48352..849a196 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -242,6 +242,48 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the DESCRIPTION values. Write out the + // first DESCRPITION only as per RFC5545 specifcation. + + if (DescriptionList.size() > 0){ + + DataLine += "DESCRIPTION"; + + if (DescriptionListAltRep[0].size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += DescriptionListAltRep[0]; + DataLine += "\""; + + } + + if (DescriptionListLanguage[0].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += DescriptionListLanguage[0]; + + } + + if (DescriptionListTokens[0].size() > 0){ + + DataLine += ";"; + DataLine += DescriptionListTokens[0]; + + } + + DataLine += ":"; + DataLine += DescriptionList[0]; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + *SaveData += "END:VEVENT\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaleventsave.h b/source/tests/xestiacalendar_icaleventsave.h index 41e07a8..ef5f60a 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -80,6 +80,8 @@ TEST(iCalendarSaveEvent, SaveEventTests){ " y of the event.\n" "CLASS;CHOCOLATE=BAR:PUBLIC\n" "CREATED;CARAMEL=PLEASE:20160123T081100Z\n" + "DESCRIPTION;ALTREP=\"null:nodata\";LANGUAGE=kw;EXAMPLE=TOKEN;MOREDATA=YES:This \n" + " is a description of the event.\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5