1 // CalendarObject.h - CalendarObject class header
3 // (c) 2016-2017 Xestia Software Development.
5 // This file is part of Xestia Calendar.
7 // Xestia Calendar is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Calendar is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
19 #ifndef __OBJECTS_CALENDAROBJECT_CALENDAROBJECT_H__
20 #define __OBJECTS_CALENDAROBJECT_CALENDAROBJECT_H__
30 #include "../../common/text.h"
31 #include "../../version.h"
39 enum CalendarObjectLoadResult {
40 CALENDAROBJECTLOAD_UNITTESTFAIL = -1,
41 CALENDAROBJECTLOAD_OK,
42 CALENDAROBJECTLOAD_MISSING,
43 CALENDAROBJECTLOAD_INVALIDFORMAT,
44 CALENDAROBJECTLOAD_CANNOTOPEN
47 enum CalendarObjectSaveResult {
48 CALENDAROBJECTSAVE_UNITTESTFAIL = -1,
49 CALENDAROBJECTSAVE_OK,
50 CALENDAROBJECTSAVE_CANNOTOPEN
53 enum CalendarObjectValidResult{
54 CALENDAROBJECTVALID_UNITTESTFAIL = -1,
55 CALENDAROBJECTVALID_OK,
56 CALENDAROBJECTVALID_INVALIDFORMAT
59 enum CalendarAlarmAction{
60 CALENDARALARM_UNSPECIFIED = -1,
62 CALENDARALARM_DISPLAY,
66 struct CalendarAlarmDataStruct{
68 CalendarAlarmAction alarmType = CALENDARALARM_UNSPECIFIED;
71 string alarmActionTokens;
75 string triggerRelated;
78 string descriptionData;
79 string descriptionAltRep;
80 string descriptionLanguage;
81 string descriptionTokens;
88 string summaryLanguage;
91 vector<string> attendeeList;
92 vector<string> attendeeListMember;
93 vector<string> attendeeListDelegatedFrom;
94 vector<string> attendeeListDelegatedTo;
95 vector<string> attendeeListRole;
96 vector<string> attendeeListRSVP;
97 vector<string> attendeeListDirectoryEntry;
98 vector<string> attendeeListSentBy;
99 vector<string> attendeeListCommonName;
100 vector<string> attendeeListCalendarUserType;
101 vector<string> attendeeListParticipationStatus;
102 vector<string> attendeeListLanguage;
103 vector<string> attendeeListTokens;
106 string durationTokens;
108 vector<string> attachList;
109 vector<string> attachListTokens;
110 vector<string> attachListEncoding;
111 vector<string> attachListFormatType;
112 vector<string> attachListValue;
114 vector<string> xTokensData;
115 vector<string> xTokensDataTokens;
119 class CalendarObject{
122 CalendarObjectLoadResult LoadFile(string loadFilename);
123 CalendarObjectLoadResult LoadString(string *loadStringData);
124 CalendarObjectSaveResult SaveFile(string saveFilename);
125 CalendarObjectSaveResult SaveString(string *saveStringData);
126 CalendarObjectValidResult ValidBaseObject();
127 void ProcessBaseData();
129 // Setup virtual subroutines for use by objects
130 // inheriting from CalendarObject later on.
132 virtual CalendarObjectValidResult ValidObject() { return CALENDAROBJECTVALID_OK; };
133 virtual void Clear() {};
134 virtual void SaveObjectData(string *saveData) {};
141 string calendarScaleData;
142 string calendarScaleTokens;
145 string uniqueIDTokens;
147 vector<string> attachList;
148 vector<string> attachListTokens;
149 vector<string> attachListEncoding;
150 vector<string> attachListFormatType;
151 vector<string> attachListValue;
153 vector<string> categoriesList;
154 vector<string> categoriesListLanguage;
155 vector<string> categoriesListTokens;
158 string classDataTokens;
160 string completedData;
161 string completedDataTokens;
163 vector<string> commentList;
164 vector<string> commentListAltRep;
165 vector<string> commentListLanguage;
166 vector<string> commentListTokens;
168 vector<string> descriptionList;
169 vector<string> descriptionListAltRep;
170 vector<string> descriptionListLanguage;
171 vector<string> descriptionListTokens;
173 string geographicData;
174 string geographicTokens;
177 string locationDataAltRep;
178 string locationDataLanguage;
179 string locationDataTokens;
181 string percentCompleteData;
182 string percentCompleteTokens;
184 int priorityData = -1;
185 string priorityTokens;
187 vector<string> resourcesData;
188 vector<string> resourcesDataAltRep;
189 vector<string> resourcesDataLanguage;
190 vector<string> resourcesDataTokens;
193 string statusLanguage;
197 string summaryDataAltRep;
198 string summaryDataLanguage;
199 string summaryDataTokens;
201 string dateTimeEndData;
202 string dateTimeEndDataValue;
203 string dateTimeEndDataTimeZoneID;
204 string dateTimeEndDataTokens;
208 string dueDataTimeZoneID;
209 string dueDataTokens;
211 string dateTimeStartData;
212 string dateTimeStartDataValue;
213 string dateTimeStartDataTimeZoneID;
214 string dateTimeStartDataTokens;
217 string durationDataTokens;
219 vector<string> freeBusyList;
220 vector<string> freeBusyListType;
221 vector<string> freeBusyListTokens;
223 string timeTransparencyData;
224 string timeTransparencyDataTokens;
227 string timeZoneDataTokens;
229 vector<string> timeZoneNameList;
230 vector<string> timeZoneNameListLanguage;
231 vector<string> timeZoneNameListTokens;
233 string timeZoneOffsetFromData;
234 string timeZoneOffsetFromDataTokens;
236 string timeZoneOffsetToData;
237 string timeZoneOffsetToDataTokens;
239 string timeZoneURLData;
240 string timeZoneURLTokens;
242 vector<string> attendeeList;
243 vector<string> attendeeListMember;
244 vector<string> attendeeListDelegatedFrom;
245 vector<string> attendeeListDelegatedTo;
246 vector<string> attendeeListRole;
247 vector<string> attendeeListRSVP;
248 vector<string> attendeeListDirectoryEntry;
249 vector<string> attendeeListSentBy;
250 vector<string> attendeeListCommonName;
251 vector<string> attendeeListCalendarUserType;
252 vector<string> attendeeListParticipationStatus;
253 vector<string> attendeeListLanguage;
254 vector<string> attendeeListTokens;
256 vector<string> contactList;
257 vector<string> contactListAltRep;
258 vector<string> contactListLanguage;
259 vector<string> contactListTokens;
261 string organiserData;
262 string organiserDataCommonName;
263 string organiserDataDirectoryEntry;
264 string organiserDataSentByParam;
265 string organiserDataLanguage;
266 string organiserDataTokens;
268 string recurranceIDData;
269 string recurranceIDDataTimeZoneParam;
270 string recurranceIDDataRangeParam;
271 string recurranceIDDataValue;
272 string recurranceIDDataTokens;
274 vector<string> relatedToData;
275 vector<string> relatedToDataRelationType;
276 vector<string> relatedToDataTokens;
279 string urlDataTokens;
281 vector<string> excludeDateData;
282 vector<string> excludeDateDataValue;
283 vector<string> excludeDateDataTimeZoneParam;
284 vector<string> excludeDateDataTokens;
286 vector<string> recurranceDateData;
287 vector<string> recurranceDateDataValue;
288 vector<string> recurranceDateDataTimeZoneParam;
289 vector<string> recurranceDateDataTokens;
291 string recurranceRuleData;
292 string recurranceRuleDataTokens;
294 string triggerDataList;
295 string triggerDataValue;
296 string triggerDataRelatedParam;
297 string triggerDataTokens;
299 string dateTimeCreatedData;
300 string dateTimeCreatedTokens;
302 string dateTimeStampData;
303 string dateTimeStampTokens;
305 string lastModifiedData;
306 string lastModifiedTokens;
308 int sequenceData = -1;
309 string sequenceTokens;
311 vector<string> xTokensData;
312 vector<string> xTokensDataTokens;
314 vector<string> requestStatusData;
315 vector<string> requestStatusLanguage;
316 vector<string> requestStatusTokens;
318 vector<CalendarAlarmDataStruct> calendarAlarmData;
321 // Initial Loading Data.
322 vector<string> objectName;
323 vector<string> objectData;
325 vector<vector<string>> eventAlarmName;
326 vector<vector<string>> eventAlarmData;
329 virtual void ProcessData() {};