From 2f59db5effef27ce057160796deb1f70f1817cd7 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Thu, 2 Jun 2016 22:06:04 +0100 Subject: [PATCH] Added LOCATION property for saving data from a CalendarEventObject. Added the code and unit tests for the LOCATION property. --- .../calendarevent/CalendarEvent-Save.cpp | 41 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 1 + 2 files changed, 42 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index a5afcd5..8f28931 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -340,6 +340,47 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the LOCATION value. + + if (LocationData.size() > 0){ + + DataLine += "LOCATION"; + + if (LocationDataAltRep.size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += LocationDataAltRep; + DataLine += "\""; + + } + + if (LocationDataLanguage.size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += LocationDataLanguage; + + } + + if (LocationDataTokens.size() > 0){ + + DataLine += ";"; + DataLine += LocationDataTokens; + + } + + DataLine += ":"; + DataLine += LocationData; + 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 dcb07be..b6c7576 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -84,6 +84,7 @@ TEST(iCalendarSaveEvent, SaveEventTests){ " is a description of the event.\n" "GEO;EXAMPLE=MEEP:5.0;5.0\n" "LAST-MODIFIED;FUTURE=ODD:20160124T093000Z\n" + "LOCATION;ALTREP=\"null:nodata\";LANGUAGE=kw;EXACT=NO:The Basement, Truro\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5