From 64b98a748b9cc40fa657bd1c4de83a7440d4b2f7 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 6 Jun 2016 00:08:07 +0100 Subject: [PATCH] Added X-Token property for saving data from a CalendarJournalObject. Added the code and unit tests for the X-Token property. --- .../calendarjournal/CalendarJournal-Save.cpp | 23 +++++++++++++++++++ source/tests/xestiacalendar_icaljournalsave.h | 9 ++++++++ 2 files changed, 32 insertions(+) diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index a46aa84..c0626ee 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -922,6 +922,29 @@ void CalendarJournalObject::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:VJOURNAL\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaljournalsave.h b/source/tests/xestiacalendar_icaljournalsave.h index f9da37e..7086c81 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -117,6 +117,15 @@ TEST(iCalendarSaveJournal, SaveEventTests){ "REQUEST-STATUS;LANGUAGE=en:3.42;Really big irrecoverable error caused by the \n" " user\n" "REQUEST-STATUS;USER=MISSING:3.7;Invalid calendar user\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:VJOURNAL\n" "END:VCALENDAR"; -- 2.39.5