From 13832ca2c3304ad9fa4973519991bc5671dd98cd Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 4 Jun 2016 21:14:23 +0100 Subject: [PATCH] Added RESOURCES property for saving data from a CalendarEventObject. Added the code and unit tests for the RESOURCES property. --- .../calendarevent/CalendarEvent-Save.cpp | 46 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 3 ++ 2 files changed, 49 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index d7251aa..0cf4cda 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1064,6 +1064,52 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the RESOURCES value. + + if (ResourcesData.size() > 0){ + + for (int ResourcesDataSeek = 0; ResourcesDataSeek < ResourcesData.size(); + ResourcesDataSeek++){ + + DataLine += "RESOURCES"; + + if (ResourcesDataAltRep[ResourcesDataSeek].size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += ResourcesDataAltRep[ResourcesDataSeek]; + DataLine += "\""; + + } + + if (ResourcesDataLanguage[ResourcesDataSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += ResourcesDataLanguage[ResourcesDataSeek]; + + } + + if (ResourcesDataTokens[ResourcesDataSeek].size() > 0){ + + DataLine += ";"; + DataLine += ResourcesDataTokens[ResourcesDataSeek]; + + } + + DataLine += ":"; + DataLine += ResourcesData[ResourcesDataSeek]; + 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 d7794da..2b52dc5 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -126,6 +126,9 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "RELATED-TO:person.1@example.com\n" "RELATED-TO;RELTYPE=PARENT:person.2@example.com\n" "RELATED-TO;SCHOOL=MEETING:person.3@example.com\n" + "RESOURCES:DMAC RECEIVER\n" + "RESOURCES;LANGUAGE=en:PAL-I TELEVISION SET\n" + "RESOURCES;ALTREP=\"null:nodata\";STATUS=BROKEN:PAL/SECAM VCR\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5