From: Steve Brokenshire Date: Sun, 5 Jun 2016 23:08:07 +0000 (+0100) Subject: Added X-Token property for saving data from a CalendarJournalObject. X-Git-Tag: release-0.02~176 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=64b98a748b9cc40fa657bd1c4de83a7440d4b2f7;p=xestiacalendar%2F.git Added X-Token property for saving data from a CalendarJournalObject. Added the code and unit tests for the X-Token property. --- 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";