Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added LAST-MODIFIED property for saving data from a CalendarEventObject.
[xestiacalendar/.git] / source / objects / calendarevent / CalendarEvent-Save.cpp
1 #include "CalendarEvent.h"
3 using namespace std;
5 void CalendarEventObject::SaveObjectData(string *SaveData){
7         string DataLine = "";
8         string DataLineProcessed = "";
9         
10         *SaveData += "BEGIN:VEVENT\n";
11         
12         // Process the UID.
13         
14         if (UniqueID.size() > 0){
15                 
16                 if (UniqueIDTokens.size() > 0){
17                 
18                         DataLine += "UID;";
19                         DataLine += UniqueIDTokens;
20                         
21                 } else {
23                         DataLine += "UID";
24                         
25                 }
27                 DataLine += ":";
28                 DataLine += UniqueID;
29                 DataLine += "\n";
30                 
31                 DataLineProcessed = OutputText(&DataLine);
32                 
33                 *SaveData += DataLineProcessed;
34                 
35                 DataLine.clear();
36                 DataLineProcessed.clear();
37                 
38         }
39         
40         // Process the DTSTAMP.
41         
42         if (DateTimeStampData.size() > 0){
43                 
44                 if (DateTimeStampTokens.size() > 0){
45                 
46                         DataLine += "DTSTAMP;";
47                         DataLine += DateTimeStampTokens;
48                         
49                 } else {
51                         DataLine += "DTSTAMP";
52                         
53                 }
55                 DataLine += ":";
56                 DataLine += DateTimeStampData;
57                 DataLine += "\n";
58                 
59                 DataLineProcessed = OutputText(&DataLine);
60                 
61                 *SaveData += DataLineProcessed;
62                 
63                 DataLine.clear();
64                 DataLineProcessed.clear();
65                 
66         }
68         // Process the DTSTART.
69         
70         if (DateTimeStartData.size() > 0){
71                 
72                 DataLine += "DTSTART";
73                 
74                 if (DateTimeStartDataValue.size() > 0){
75                 
76                         DataLine += ";VALUE=";
77                         DataLine += DateTimeStartDataValue;                     
78                         
79                 }
80                 
81                 if (DateTimeStartDataTimeZoneID.size() > 0){
82                 
83                         DataLine += ";TZID=";
84                         DataLine += DateTimeStartDataTimeZoneID;                        
85                         
86                 }
87                 
88                 if (DateTimeStartDataTokens.size() > 0){
89                 
90                         DataLine += ";";
91                         DataLine += DateTimeStartDataTokens;
92                         
93                 }
95                 DataLine += ":";
96                 DataLine += DateTimeStartData;
97                 DataLine += "\n";
98                 
99                 DataLineProcessed = OutputText(&DataLine);
100                 
101                 *SaveData += DataLineProcessed;
102                 
103                 DataLine.clear();
104                 DataLineProcessed.clear();
105                 
106         }
107         
108         // Process the DTEND.
109         
110         if (DateTimeEndData.size() > 0){
111                 
112                 DataLine += "DTEND";
113                 
114                 if (DateTimeEndDataValue.size() > 0){
115                 
116                         DataLine += ";VALUE=";
117                         DataLine += DateTimeEndDataValue;                       
118                         
119                 }
120                 
121                 if (DateTimeEndDataTimeZoneID.size() > 0){
122                 
123                         DataLine += ";TZID=";
124                         DataLine += DateTimeEndDataTimeZoneID;                  
125                         
126                 }
127                 
128                 if (DateTimeEndDataTokens.size() > 0){
129                 
130                         DataLine += ";";
131                         DataLine += DateTimeEndDataTokens;
132                         
133                 }
135                 DataLine += ":";
136                 DataLine += DateTimeEndData;
137                 DataLine += "\n";
138                 
139                 DataLineProcessed = OutputText(&DataLine);
140                 
141                 *SaveData += DataLineProcessed;
142                 
143                 DataLine.clear();
144                 DataLineProcessed.clear();
145                 
146         }
147         
148         // Process the SUMMARY.
149         
150         if (SummaryData.size() > 0){
151                 
152                 DataLine += "SUMMARY";
153                 
154                 if (SummaryDataAltRep.size() > 0){
155                 
156                         DataLine += ";ALTREP=\"";
157                         DataLine += SummaryDataAltRep;
158                         DataLine += "\"";
159                         
160                 }
161                 
162                 if (SummaryDataLanguage.size() > 0){
163                 
164                         DataLine += ";LANGUAGE=";
165                         DataLine += SummaryDataLanguage;                        
166                         
167                 }
168                 
169                 if (SummaryDataTokens.size() > 0){
170                 
171                         DataLine += ";";
172                         DataLine += SummaryDataTokens;
173                         
174                 }
175                 
176                 DataLine += ":";
177                 DataLine += SummaryData;
178                 DataLine += "\n";
179                 
180                 DataLineProcessed = OutputText(&DataLine);
181                 
182                 *SaveData += DataLineProcessed;
184                 DataLine.clear();
185                 DataLineProcessed.clear();
186                 
187         }
189         // Process the CLASS value.
190         
191         if (ClassData.size() > 0){
192                 
193                 if (ClassDataTokens.size() > 0){
194                 
195                         DataLine += "CLASS;";
196                         DataLine += ClassDataTokens;
197                         
198                 } else {
200                         DataLine += "CLASS";
201                         
202                 }
204                 DataLine += ":";
205                 DataLine += ClassData;
206                 DataLine += "\n";
207                 
208                 DataLineProcessed = OutputText(&DataLine);
209                 
210                 *SaveData += DataLineProcessed;
211                 
212                 DataLine.clear();
213                 DataLineProcessed.clear();
214                 
215         }
216         
217         // Process the CREATED value.
218         
219         if (DateTimeCreatedData.size() > 0){
220                 
221                 if (DateTimeCreatedTokens.size() > 0){
222                 
223                         DataLine += "CREATED;";
224                         DataLine += DateTimeCreatedTokens;
225                         
226                 } else {
228                         DataLine += "CREATED";
229                         
230                 }
232                 DataLine += ":";
233                 DataLine += DateTimeCreatedData;
234                 DataLine += "\n";
235                 
236                 DataLineProcessed = OutputText(&DataLine);
237                 
238                 *SaveData += DataLineProcessed;
239                 
240                 DataLine.clear();
241                 DataLineProcessed.clear();
242                 
243         }
244         
245         // Process the DESCRIPTION values. Write out the
246         // first DESCRPITION only as per RFC5545 specifcation.
247         
248         if (DescriptionList.size() > 0){
249                 
250                 DataLine += "DESCRIPTION";
251                 
252                 if (DescriptionListAltRep[0].size() > 0){
253                 
254                         DataLine += ";ALTREP=\"";
255                         DataLine += DescriptionListAltRep[0];
256                         DataLine += "\"";
257                         
258                 }
259                 
260                 if (DescriptionListLanguage[0].size() > 0){
261                 
262                         DataLine += ";LANGUAGE=";
263                         DataLine += DescriptionListLanguage[0];
264                         
265                 }
266                 
267                 if (DescriptionListTokens[0].size() > 0){
268                 
269                         DataLine += ";";
270                         DataLine += DescriptionListTokens[0];
271                         
272                 }
274                 DataLine += ":";
275                 DataLine += DescriptionList[0];
276                 DataLine += "\n";
277                 
278                 DataLineProcessed = OutputText(&DataLine);
279                 
280                 *SaveData += DataLineProcessed;
281                 
282                 DataLine.clear();
283                 DataLineProcessed.clear();
284                 
285         }
286         
287         // Process the GEO value.
288         
289         if (GeographicData.size() > 0){
290                 
291                 if (GeographicTokens.size() > 0){
292                 
293                         DataLine += "GEO;";
294                         DataLine += GeographicTokens;
295                         
296                 } else {
298                         DataLine += "GEO";
299                         
300                 }
302                 DataLine += ":";
303                 DataLine += GeographicData;
304                 DataLine += "\n";
305                 
306                 DataLineProcessed = OutputText(&DataLine);
307                 
308                 *SaveData += DataLineProcessed;
309                 
310                 DataLine.clear();
311                 DataLineProcessed.clear();
312                 
313         }
314         
315         // Process the LAST-MODIFIED value.
316         
317         if (LastModifiedData.size() > 0){
318                 
319                 if (LastModifiedTokens.size() > 0){
320                 
321                         DataLine += "LAST-MODIFIED;";
322                         DataLine += LastModifiedTokens;
323                         
324                 } else {
326                         DataLine += "LAST-MODIFIED";
327                         
328                 }
330                 DataLine += ":";
331                 DataLine += LastModifiedData;
332                 DataLine += "\n";
333                 
334                 DataLineProcessed = OutputText(&DataLine);
335                 
336                 *SaveData += DataLineProcessed;
337                 
338                 DataLine.clear();
339                 DataLineProcessed.clear();
340                 
341         }
342         
343         *SaveData += "END:VEVENT\n";
344         
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy