From 2a9d429d61c6cf4599b9d52e088cde3e30838e02 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 5 Jun 2016 23:53:21 +0100 Subject: [PATCH] Added DESCRIPTION property for saving data from a CalendarJournalObject. Added the code and unit tests for the DESCRIPTION property. --- .../calendarjournal/CalendarJournal-Save.cpp | 46 +++++++++++++++++++ source/tests/xestiacalendar_icaljournalsave.h | 4 ++ 2 files changed, 50 insertions(+) diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index e866df6..2827bb5 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -710,6 +710,52 @@ void CalendarJournalObject::SaveObjectData(string *SaveData){ } + // Process the DESCRIPTION values. + + if (DescriptionList.size() > 0){ + + for (int DescriptionListSeek = 0; DescriptionListSeek < DescriptionList.size() > 0; + DescriptionListSeek++){ + + DataLine += "DESCRIPTION"; + + if (DescriptionListAltRep[DescriptionListSeek].size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += DescriptionListAltRep[DescriptionListSeek]; + DataLine += "\""; + + } + + if (DescriptionListLanguage[DescriptionListSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += DescriptionListLanguage[DescriptionListSeek]; + + } + + if (DescriptionListTokens[DescriptionListSeek].size() > 0){ + + DataLine += ";"; + DataLine += DescriptionListTokens[DescriptionListSeek]; + + } + + DataLine += ":"; + DataLine += DescriptionList[DescriptionListSeek]; + 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 0ddb69d..fb69016 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -100,6 +100,10 @@ TEST(iCalendarSaveJournal, SaveEventTests){ "CONTACT:First Contact\n" "CONTACT;ALTREP=\"null:nodata\";LANGUAGE=en-GB:Second Contact\n" "CONTACT;ZEBRAS=NO:Third Contact\n" + "DESCRIPTION:First Journal Entry Description\n" + "DESCRIPTION;ALTREP=\"null:nodata\";LANGUAGE=en-GB:This is the second journal de\n" + " scription.\n" + "DESCRIPTION;ZEBRAS=NO:This is the third journal description.\n" "END:VJOURNAL\n" "END:VCALENDAR"; -- 2.39.5