From 0da7ecb7ec3c888a6e079182e4730f4924a76681 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 5 Jun 2016 02:51:27 +0100 Subject: [PATCH] Added X-Token property for saving data from a CalendarEventObject. Added the code and unit tests for the X-Token property. --- .../calendarevent/CalendarEvent-Save.cpp | 23 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 9 ++++++++ 2 files changed, 32 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 89819dd..4dddd89 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1555,6 +1555,29 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the X-Token values. + + if (XTokensData.size() > 0){ + + for (int XTokenSeek = 0; XTokenSeek < XTokensData.size(); + XTokenSeek++){ + + DataLine += XTokensDataTokens[XTokenSeek]; + DataLine += ":"; + DataLine += XTokensData[XTokenSeek]; + 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 af9fb1d..ae25a55 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -181,6 +181,15 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "X-EXAMPLE2;NOPE=YEP:Example Data 2\n" "X-EXAMPLE3;WORLD=NO:Example Data 3\n" "END:VALARM\n" + "X-EXAMPLE1:Moo\n" + "X-EXAMPLE1;ANIMAL=NOPE:Meep\n" + "X-EXAMPLE1;ANIMAL=CAT:Meow\n" + "X-EXAMPLE2:Dish\n" + "X-EXAMPLE2;OBJECT=KITCHEN:Fork\n" + "X-EXAMPLE2;OBJECT=LIVINGROOM:Table\n" + "X-STATUS;HOLIDAY=YES:Idle\n" + "X-TRANSPORT;PUBLIC=NO:Private Hire\n" + "X-PHANTOM-STATUS;HELP=NONE:None\n" "END:VEVENT\n" "END:VCALENDAR"; -- 2.39.5