From 6b1023322f3c0d967816c6b4436de3ff1b22e89c Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 1 Jun 2016 22:07:20 +0100 Subject: [PATCH] Added CREATED value for saving data from a CalendarEventObject. Added the code and unit tests for the CREATED value. --- .../calendarevent/CalendarEvent-Save.cpp | 30 ++++++++++++++++++- source/tests/xestiacalendar_icaleventsave.h | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 1d1edcc..ee48352 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -186,7 +186,7 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } - // Process the CLASS. + // Process the CLASS value. if (ClassData.size() > 0){ @@ -214,6 +214,34 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the CREATED value. + + if (DateTimeCreatedData.size() > 0){ + + if (DateTimeCreatedTokens.size() > 0){ + + DataLine += "CREATED;"; + DataLine += DateTimeCreatedTokens; + + } else { + + DataLine += "CREATED"; + + } + + DataLine += ":"; + DataLine += DateTimeCreatedData; + 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 2e2ffbf..41e07a8 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -79,6 +79,7 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "SUMMARY;ALTREP=\"null:nodata\";LANGUAGE=kw;FAVOURITE=TOFU;NOTLIKE=NONE:A summar\n" " y of the event.\n" "CLASS;CHOCOLATE=BAR:PUBLIC\n" + "CREATED;CARAMEL=PLEASE:20160123T081100Z\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5