From 57298ee87c00017037d019573764dfd06d97b41f Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 4 Jun 2016 18:11:19 +0100 Subject: [PATCH] Added CATEGORIES property for saving data from a CalendarEventObject. Added the code and unit tests for the CATEGORIES property. --- .../calendarevent/CalendarEvent-Save.cpp | 38 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 4 ++ 2 files changed, 42 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index ce47518..a2139fc 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -813,6 +813,44 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the CATEGORIES value. + + if (CategoriesList.size() > 0){ + + for (int CategoriesListSeek = 0; CategoriesListSeek < CategoriesList.size(); + CategoriesListSeek++){ + + DataLine += "CATEGORIES"; + + if (CategoriesListLanguage[CategoriesListSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += CategoriesListLanguage[CategoriesListSeek]; + + } + + if (CategoriesListTokens[CategoriesListSeek].size() > 0){ + + DataLine += ";"; + DataLine += CategoriesListTokens[CategoriesListSeek]; + + } + + DataLine += ":"; + DataLine += CategoriesList[CategoriesListSeek]; + 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 761819e..2858f3f 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -106,6 +106,10 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "ATTENDEE;DIR=\"null:nodata\";SENT-BY=\"mailto:sent.by@example.com\";CN=\"Attendee \n" " The Third\";CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED;LANGUAGE=kw;EXAMPLE=DATA:Atte\n" " ndee Three\n" + "CATEGORIES:CATEGORY ONE, CATEGORY TWO\n" + "CATEGORIES;LANGUAGE=en:CATEGORY THREE, CATEGORY FOUR\n" + "CATEGORIES;LANGUAGE=en-GB;SAMPLE=TOKEN:CATEGORY FIVE, CATEGORY SIX, CATEGORY \n" + " SEVEN\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5