+// CalendarObject.h - CalendarObject class header
+//
+// (c) 2016-2017 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Calendar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
+
+#ifndef __OBJECTS_CALENDAROBJECT_CALENDAROBJECT_H__
+#define __OBJECTS_CALENDAROBJECT_CALENDAROBJECT_H__
+
#include <string>
#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <vector>
+#include <stdexcept>
+#include <map>
+
+#include "../../common/text.h"
+#include "../../version.h"
+
+using namespace std;
enum CalendarObjectLoadResult {
- CALENDAROBJECTLOAD_UNITTESTFAIL = -1,
- CALENDAROBJECTLOAD_OK,
- CALENDAROBJECTLOAD_MISSING,
- CALENDAROBJECTLOAD_INVALIDFORMAT,
- CALENDAROBJECTLOAD_CANNOTOPEN
+ CALENDAROBJECTLOAD_UNITTESTFAIL = -1,
+ CALENDAROBJECTLOAD_OK,
+ CALENDAROBJECTLOAD_MISSING,
+ CALENDAROBJECTLOAD_INVALIDFORMAT,
+ CALENDAROBJECTLOAD_CANNOTOPEN
+};
+
+enum CalendarObjectSaveResult {
+ CALENDAROBJECTSAVE_UNITTESTFAIL = -1,
+ CALENDAROBJECTSAVE_OK,
+ CALENDAROBJECTSAVE_CANNOTOPEN
};
enum CalendarObjectValidResult{
- CALENDAROBJECTVALID_UNITTESTFAIL = -1,
- CALENDAROBJECTVALID_OK,
- CALENDAROBJECTVALID_INVALIDFORMAT
+ CALENDAROBJECTVALID_UNITTESTFAIL = -1,
+ CALENDAROBJECTVALID_OK,
+ CALENDAROBJECTVALID_INVALIDFORMAT
+};
+
+enum CalendarAlarmAction{
+ CALENDARALARM_UNSPECIFIED = -1,
+ CALENDARALARM_AUDIO,
+ CALENDARALARM_DISPLAY,
+ CALENDARALARM_EMAIL
+};
+
+struct CalendarAlarmDataStruct{
+
+ CalendarAlarmAction alarmType = CALENDARALARM_UNSPECIFIED;
+
+ string alarmAction;
+ string alarmActionTokens;
+
+ string triggerData;
+ string triggerValue;
+ string triggerRelated;
+ string triggerTokens;
+
+ string descriptionData;
+ string descriptionAltRep;
+ string descriptionLanguage;
+ string descriptionTokens;
+
+ string repeatData;
+ string repeatTokens;
+
+ string summaryData;
+ string summaryAltRep;
+ string summaryLanguage;
+ string summaryTokens;
+
+ vector<string> attendeeList;
+ vector<string> attendeeListMember;
+ vector<string> attendeeListDelegatedFrom;
+ vector<string> attendeeListDelegatedTo;
+ vector<string> attendeeListRole;
+ vector<string> attendeeListRSVP;
+ vector<string> attendeeListDirectoryEntry;
+ vector<string> attendeeListSentBy;
+ vector<string> attendeeListCommonName;
+ vector<string> attendeeListCalendarUserType;
+ vector<string> attendeeListParticipationStatus;
+ vector<string> attendeeListLanguage;
+ vector<string> attendeeListTokens;
+
+ string durationData;
+ string durationTokens;
+
+ vector<string> attachList;
+ vector<string> attachListTokens;
+ vector<string> attachListEncoding;
+ vector<string> attachListFormatType;
+ vector<string> attachListValue;
+
+ vector<string> xTokensData;
+ vector<string> xTokensDataTokens;
+
};
class CalendarObject{
- CalendarObjectLoadResult LoadFile();
- CalendarObjectLoadResult LoadString();
-
- // Setup virtual subroutines for use by objects
- // inheriting from CalendarObject later on.
-
- virtual CalendarObjectValidResult ValidObject() {};
+ public:
+ CalendarObjectLoadResult LoadFile(string loadFilename);
+ CalendarObjectLoadResult LoadString(string *loadStringData);
+ CalendarObjectSaveResult SaveFile(string saveFilename);
+ CalendarObjectSaveResult SaveString(string *saveStringData);
+ CalendarObjectValidResult ValidBaseObject();
+ void ProcessBaseData();
+
+ // Setup virtual subroutines for use by objects
+ // inheriting from CalendarObject later on.
+
+ virtual CalendarObjectValidResult ValidObject() { return CALENDAROBJECTVALID_OK; };
+ virtual void Clear() {};
+ virtual void SaveObjectData(string *saveData) {};
+
+ // Object data.
+
+ string methodData;
+ string methodTokens;
+
+ string calendarScaleData;
+ string calendarScaleTokens;
+
+ string uniqueID;
+ string uniqueIDTokens;
+
+ vector<string> attachList;
+ vector<string> attachListTokens;
+ vector<string> attachListEncoding;
+ vector<string> attachListFormatType;
+ vector<string> attachListValue;
+
+ vector<string> categoriesList;
+ vector<string> categoriesListLanguage;
+ vector<string> categoriesListTokens;
+
+ string classData;
+ string classDataTokens;
+
+ string completedData;
+ string completedDataTokens;
+
+ vector<string> commentList;
+ vector<string> commentListAltRep;
+ vector<string> commentListLanguage;
+ vector<string> commentListTokens;
+
+ vector<string> descriptionList;
+ vector<string> descriptionListAltRep;
+ vector<string> descriptionListLanguage;
+ vector<string> descriptionListTokens;
+
+ string geographicData;
+ string geographicTokens;
+
+ string locationData;
+ string locationDataAltRep;
+ string locationDataLanguage;
+ string locationDataTokens;
+
+ string percentCompleteData;
+ string percentCompleteTokens;
+
+ int priorityData = -1;
+ string priorityTokens;
+
+ vector<string> resourcesData;
+ vector<string> resourcesDataAltRep;
+ vector<string> resourcesDataLanguage;
+ vector<string> resourcesDataTokens;
+
+ string statusData;
+ string statusLanguage;
+ string statusTokens;
+
+ string summaryData;
+ string summaryDataAltRep;
+ string summaryDataLanguage;
+ string summaryDataTokens;
+
+ string dateTimeEndData;
+ string dateTimeEndDataValue;
+ string dateTimeEndDataTimeZoneID;
+ string dateTimeEndDataTokens;
+
+ string dueData;
+ string dueDataValue;
+ string dueDataTimeZoneID;
+ string dueDataTokens;
+
+ string dateTimeStartData;
+ string dateTimeStartDataValue;
+ string dateTimeStartDataTimeZoneID;
+ string dateTimeStartDataTokens;
+
+ string durationData;
+ string durationDataTokens;
+
+ vector<string> freeBusyList;
+ vector<string> freeBusyListType;
+ vector<string> freeBusyListTokens;
+
+ string timeTransparencyData;
+ string timeTransparencyDataTokens;
+
+ string timeZoneData;
+ string timeZoneDataTokens;
+
+ vector<string> timeZoneNameList;
+ vector<string> timeZoneNameListLanguage;
+ vector<string> timeZoneNameListTokens;
+
+ string timeZoneOffsetFromData;
+ string timeZoneOffsetFromDataTokens;
+
+ string timeZoneOffsetToData;
+ string timeZoneOffsetToDataTokens;
+
+ string timeZoneURLData;
+ string timeZoneURLTokens;
+
+ vector<string> attendeeList;
+ vector<string> attendeeListMember;
+ vector<string> attendeeListDelegatedFrom;
+ vector<string> attendeeListDelegatedTo;
+ vector<string> attendeeListRole;
+ vector<string> attendeeListRSVP;
+ vector<string> attendeeListDirectoryEntry;
+ vector<string> attendeeListSentBy;
+ vector<string> attendeeListCommonName;
+ vector<string> attendeeListCalendarUserType;
+ vector<string> attendeeListParticipationStatus;
+ vector<string> attendeeListLanguage;
+ vector<string> attendeeListTokens;
+
+ vector<string> contactList;
+ vector<string> contactListAltRep;
+ vector<string> contactListLanguage;
+ vector<string> contactListTokens;
+
+ string organiserData;
+ string organiserDataCommonName;
+ string organiserDataDirectoryEntry;
+ string organiserDataSentByParam;
+ string organiserDataLanguage;
+ string organiserDataTokens;
+
+ string recurranceIDData;
+ string recurranceIDDataTimeZoneParam;
+ string recurranceIDDataRangeParam;
+ string recurranceIDDataValue;
+ string recurranceIDDataTokens;
+
+ vector<string> relatedToData;
+ vector<string> relatedToDataRelationType;
+ vector<string> relatedToDataTokens;
+
+ string urlData;
+ string urlDataTokens;
+
+ vector<string> excludeDateData;
+ vector<string> excludeDateDataValue;
+ vector<string> excludeDateDataTimeZoneParam;
+ vector<string> excludeDateDataTokens;
+
+ vector<string> recurranceDateData;
+ vector<string> recurranceDateDataValue;
+ vector<string> recurranceDateDataTimeZoneParam;
+ vector<string> recurranceDateDataTokens;
+
+ string recurranceRuleData;
+ string recurranceRuleDataTokens;
+
+ string triggerDataList;
+ string triggerDataValue;
+ string triggerDataRelatedParam;
+ string triggerDataTokens;
+
+ string dateTimeCreatedData;
+ string dateTimeCreatedTokens;
+
+ string dateTimeStampData;
+ string dateTimeStampTokens;
+
+ string lastModifiedData;
+ string lastModifiedTokens;
+
+ int sequenceData = -1;
+ string sequenceTokens;
+
+ vector<string> xTokensData;
+ vector<string> xTokensDataTokens;
+
+ vector<string> requestStatusData;
+ vector<string> requestStatusLanguage;
+ vector<string> requestStatusTokens;
+
+ vector<CalendarAlarmDataStruct> calendarAlarmData;
+
+ protected:
+ // Initial Loading Data.
+ vector<string> objectName;
+ vector<string> objectData;
+
+ vector<vector<string>> eventAlarmName;
+ vector<vector<string>> eventAlarmData;
+
+ private:
+ virtual void ProcessData() {};
};
+
+#endif
\ No newline at end of file