From c5423350c3fd98eefb31d41ae1c5ab0df23f7829 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Tue, 31 May 2016 07:30:50 +0100 Subject: [PATCH] Added SaveObjectData for CalendarEventObject --- .../calendarevent/CalendarEvent-Save.cpp | 193 ++++++++++++++++++ source/objects/calendarevent/CalendarEvent.h | 1 + 2 files changed, 194 insertions(+) create mode 100644 source/objects/calendarevent/CalendarEvent-Save.cpp diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp new file mode 100644 index 0000000..911947b --- /dev/null +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -0,0 +1,193 @@ +#include "CalendarEvent.h" + +using namespace std; + +void CalendarEventObject::SaveObjectData(string *SaveData){ + + string DataLine = ""; + string DataLineProcessed = ""; + + *SaveData += "BEGIN:VEVENT\n"; + + // TODO: Replace SaveData with DataLine, DataLineProcessed + // and use the new OutputText function. + + // Process the UID. + + if (UniqueID.size() > 0){ + + if (UniqueIDTokens.size() > 0){ + + DataLine += "UID;"; + DataLine += UniqueIDTokens; + + } else { + + DataLine += "UID"; + + } + + DataLine += ":"; + DataLine += UniqueID; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + // Process the DTSTAMP. + + if (DateTimeStampData.size() > 0){ + + if (DateTimeStampTokens.size() > 0){ + + DataLine += "DTSTAMP;"; + DataLine += DateTimeStampTokens; + + } else { + + DataLine += "DTSTAMP"; + + } + + DataLine += ":"; + DataLine += DateTimeStampData; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + // Process the DTSTART. + + if (DateTimeStartData.size() > 0){ + + DataLine += "DTSTART"; + + if (DateTimeStartDataValue.size() > 0){ + + DataLine += ";VALUE="; + DataLine += DateTimeStartDataValue; + + } + + if (DateTimeStartDataTimeZoneID.size() > 0){ + + DataLine += ";TZID="; + DataLine += DateTimeStartDataTimeZoneID; + + } + + if (DateTimeStartDataTokens.size() > 0){ + + DataLine += ";"; + DataLine += DateTimeStartDataTokens; + + } + + DataLine += ":"; + DataLine += DateTimeStartData; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + // Process the DTEND. + + if (DateTimeStartData.size() > 0){ + + DataLine += "DTEND"; + + if (DateTimeStartDataValue.size() > 0){ + + DataLine += ";VALUE="; + DataLine += DateTimeStartDataValue; + + } + + if (DateTimeStartDataTimeZoneID.size() > 0){ + + DataLine += ";TZID="; + DataLine += DateTimeStartDataTimeZoneID; + + } + + if (DateTimeStartDataTokens.size() > 0){ + + DataLine += ";"; + DataLine += DateTimeStartDataTokens; + + } + + DataLine += ":"; + DataLine += DateTimeStartData; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + // Process the SUMMARY. + + if (SummaryData.size() > 0){ + + DataLine += "SUMMARY"; + + if (SummaryDataAltRep.size() > 0){ + + DataLine += ";ALTREP="; + DataLine += SummaryDataAltRep; + + } + + if (SummaryDataLanguage.size() > 0){ + + DataLine += ";TZID="; + DataLine += SummaryDataLanguage; + + } + + if (SummaryDataTokens.size() > 0){ + + DataLine += ";"; + DataLine += SummaryDataTokens; + + } + + DataLine += ":"; + DataLine += SummaryData; + 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/objects/calendarevent/CalendarEvent.h b/source/objects/calendarevent/CalendarEvent.h index e2bdf0d..c334b71 100644 --- a/source/objects/calendarevent/CalendarEvent.h +++ b/source/objects/calendarevent/CalendarEvent.h @@ -10,6 +10,7 @@ class CalendarEventObject: public CalendarObject{ private: void ProcessData(); + void SaveObjectData(string *SaveData); }; -- 2.39.5