Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
camelCase: Converted code in calendartimezone directory
[xestiacalendar/.git] / source / objects / calendartimezone / CalendarTimezone.cpp
1 // CalendarTimezone.cpp - CalendarTimezone class functions
2 //
3 // (c) 2016-2017 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
6 //
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.
10 //
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.
15 //
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 #include "CalendarTimezone.h"
21 using namespace std;
23 CalendarObjectValidResult CalendarTimezoneObject::ValidObject(){
24  
25         bool validBegin = false;
26         bool validEnd = false;
27         bool validTimeZoneID = false;
28 int seekCount = 0;
29         string propertyName;
30         
31         // Look for BEGIN:VEVENT.
32         
33         for (vector<string>::iterator iter = objectName.begin();
34                 iter != objectName.end(); iter++){
35         
36                 if (objectName[seekCount] == "BEGIN" &&
37                         objectData[seekCount] == "VTIMEZONE"){
38                         
39                         if (validBegin == false){
40                                 validBegin = true;
41                         } else {
42                                 return CALENDAROBJECTVALID_INVALIDFORMAT;
43                         }
44                                 
45                 }
46                 
47                 if (objectName[seekCount] == "END" &&
48                         objectData[seekCount] == "VTIMEZONE" &&
49                         validBegin == false){
50                 
51                         return CALENDAROBJECTVALID_INVALIDFORMAT;
52                                 
53                 }
54                 
55                 seekCount++;
56                         
57         }
58         
59         seekCount = 0;
60         
61         // Look for TZID.
62         
63         for (vector<string>::iterator iter = objectName.begin();
64                 iter != objectName.end(); iter++){
65                         
66                 try{
67                         PropertyName = objectName[seekCount].substr(0,4);
68                 }
69                         
70                 catch(const out_of_range& oor){
71                         continue;
72                 }
73                 
74                 if (PropertyName == "TZID"){
75                         
76                         if (validTimeZoneID == false){
77                                 validTimeZoneID = true;
78                         } else {
79                                 return CALENDAROBJECTVALID_INVALIDFORMAT;
80                         }
81                                 
82                 }
83                         
84                 seekCount++;
85                         
86         }
87         
88         seekCount = 0;
89         
90         // Look for END:VEVENT.
91         
92         for (vector<string>::iterator iter = objectName.begin();
93                 iter != objectName.end(); iter++){
94         
95                 if (objectName[seekCount] == "END" &&
96                         objectData[seekCount] == "VTIMEZONE"){
97                         
98                         if (validEnd == false){
99                                 validEnd = true;
100                         } else {
101                                 return CALENDAROBJECTVALID_INVALIDFORMAT;
102                         }
103                                 
104                 }
105                         
106                 seekCount++;
107                         
108         }
109         
110         // Check if the VEVENT is valid.
111         
112         if (validBegin == true && 
113                 validEnd == true && 
114                 validTimeZoneID == true){
115                 
116                 return CALENDAROBJECTVALID_OK;
117                         
118         } else {
119                 
120                 return CALENDAROBJECTVALID_INVALIDFORMAT;
121                 
122         }
123         
126 void CalendarTimezoneObject::ProcessData(){
128         // Process the data.
129         
130         multimap<string,string> dataReceived;
131         map<string,string> propertyData;
132         string *propertyNameData = nullptr;
133         int objectSeekCount = 0;
134         
135         // Process the data from TZID.
136         
137         dataReceived = ProcessTextVectors(&objectName, &objectData, false, "TZID");
138         
139         if (dataReceived.begin() != dataReceived.end()){
140         
141                 try {
142                         timeZoneDataTokens = dataReceived.begin()->first.substr(5);
143                 }
144                 
145                 catch(const out_of_range &oor){
146                         // Do nothing as there is no data.
147                 }               
148                 
149                 timeZoneData = dataReceived.begin()->second;
150                 
151         }
152         
153         // Process the data from LAST-MODIFIED.
154         
155         dataReceived = ProcessTextVectors(&objectName, &objectData, false, "LAST-MODIFIED");
156         
157         if (dataReceived.begin() != dataReceived.end()){
158         
159                 try {
160                         lastModifiedTokens = dataReceived.begin()->first.substr(14);
161                 }
162                 
163                 catch(const out_of_range &oor){
164                         // Do nothing as there is no data.
165                 }               
166                 
167                 lastModifiedData = dataReceived.begin()->second;
168                 
169         }
170         
171         // Process the data from TZURL.
172         
173         dataReceived = ProcessTextVectors(&objectName, &objectData, false, "TZURL");
174         
175         if (dataReceived.begin() != dataReceived.end()){
176         
177                 try {
178                         timeZoneURLTokens = dataReceived.begin()->first.substr(6);
179                 }
180                 
181                 catch(const out_of_range &oor){
182                         // Do nothing as there is no data.
183                 }               
184                 
185                 timeZoneURLData = dataReceived.begin()->second;
186                 
187         }
188         
189         // Process data from each STANDARD and DAYLIGHT.
190         
191         ProcessStandardDaylight();
193         int seekCount = 0;
194         
195         for (vector<vector<string>>::iterator tzsiter = timezoneStandardName.begin();
196                 tzsiter != timezoneStandardName.end(); tzsiter++){
198                 bool dateTimeStartFound = false;
199                 bool timeZoneOffsetToFound = false;
200                 bool timeZoneOffsetFromFound = false;
201                 
202                 timezoneDataStruct newTZData;
203                                         
204                 // Process the data from DTSTART.
205         
206                 dataReceived = ProcessTextVectors(&timezoneStandardName[seekCount], 
207                                 &timezoneStandardData[seekCount], false, "DTSTART");
208         
209                 if (dataReceived.begin() != dataReceived.end()){
210         
211                         try {
212                                 newTZData.dateTimeStartTokens = dataReceived.begin()->first.substr(8);
213                         }
214                 
215                         catch(const out_of_range &oor){
216                                 // Do nothing as there is no data.
217                         }
218                 
219                         newTZData.dateTimeStartData = dataReceived.begin()->second;
220                         dateTimeStartFound = true;
221                 
222                 }
223                         
224                 // Process the data from TZOFFSETFROM.
225                         
226                 dataReceived = ProcessTextVectors(&timezoneStandardName[seekCount], 
227                                 &timezoneStandardData[seekCount], false, "TZOFFSETFROM");
228         
229                 if (dataReceived.begin() != dataReceived.end()){
230         
231                         try {
232                                 newTZData.timeZoneOffsetFromTokens = dataReceived.begin()->first.substr(13);
233                         }
234                 
235                         catch(const out_of_range &oor){
236                                 // Do nothing as there is no data.
237                         }
238                 
239                         newTZData.timeZoneOffsetFromData = dataReceived.begin()->second;
240                         timeZoneOffsetFromFound = true;
241                 
242                 }
243                         
244                 // Process the data from TZOFFSETTO.
245                         
246                 dataReceived = ProcessTextVectors(&timezoneStandardName[seekCount], 
247                                 &timezoneStandardData[seekCount], false, "TZOFFSETTO");
248         
249                 if (dataReceived.begin() != dataReceived.end()){
250         
251                         try {
252                                 newTZData.timeZoneOffsetToTokens = dataReceived.begin()->first.substr(11);
253                         }
254                 
255                         catch(const out_of_range &oor){
256                                 // Do nothing as there is no data.
257                         }
258                 
259                         newTZData.timeZoneOffsetToData = dataReceived.begin()->second;
260                         timeZoneOffsetToFound = true;
261                 
262                 }
263                 
264                 // Process the data from RRULE.
266                 dataReceived = ProcessTextVectors(&timezoneStandardName[seekCount], 
267                         &timezoneStandardData[seekCount], false, "RRULE");
268         
269                 if (dataReceived.begin() != dataReceived.end()){
270         
271                         try {
272                                 newTZData.recurranceRuleDataTokens = dataReceived.begin()->first.substr(6);
273                         }
274                 
275                         catch(const out_of_range &oor){
276                                 // Do nothing as there is no data.
277                         }               
278                         
279                         newTZData.recurranceRuleData = dataReceived.begin()->second;
280                 
281                 }
282                         
283                 // Process the data from COMMENT.
284         
285                 dataReceived = ProcessTextVectors(&timezoneStandardName[seekCount], 
286                         &timezoneStandardData[seekCount], true, "COMMENT");
288                 objectSeekCount = 0;
289         
290                 for(multimap<string,string>::iterator propiter = dataReceived.begin(); 
291                         propiter != dataReceived.end(); 
292                         ++propiter){
293                 
294                         newTZData.commentListTokens.push_back("");
295                         newTZData.commentListAltRep.push_back("");
296                         newTZData.commentListLanguage.push_back("");
297                         newTZData.commentList.push_back("");
298                         
299                         bool TokenData = false;
300                         string propertyTokens;
301                 
302                         propertyNameData = (string*)&propiter->first;
303                 
304                         propertyData = SplitValues(*propertyNameData);
305                         
306                         for(map<string,string>::iterator propdataiter = propertyData.begin();
307                                 propdataiter != propertyData.end(); propdataiter++){
308                         
309                                 if (propdataiter->first == "ALTREP"){
310                                 
311                                         newTZData.commentListAltRep[objectSeekCount] = propdataiter->second;
312                                 
313                                 } else if (propdataiter->first == "LANGUAGE"){
314                                 
315                                         newTZData.commentListLanguage[objectSeekCount] = propdataiter->second;
316                                 
317                                 } else {
318                                 
319                                         if (TokenData == false){
320                                                 TokenData = true;
321                                         } else {
322                                                 propertyTokens += ";";
323                                         }
324                                 
325                                         propertyTokens += propdataiter->first;
326                                         propertyTokens += "=";
327                                         propertyTokens += propdataiter->second;
328                                 
329                                 }
330                                 
331                         }
332                 
333                         if (propertyTokens.size() > 0){
334                                 newTZData.commentListTokens[objectSeekCount] = propertyTokens;
335                         }
336                         
337                         newTZData.commentList[objectSeekCount] = propiter->second;
338                         
339                         objectSeekCount++;
340                 
341                 }
342                 
343                 // Process the data from RDATE.
344                         
345                 dataReceived = ProcessTextVectors(&timezoneStandardName[seekCount], 
346                         &timezoneStandardData[seekCount], true, "RDATE");
348                 objectSeekCount = 0;
349         
350                 for(multimap<string,string>::iterator propiter = dataReceived.begin(); 
351                         propiter != dataReceived.end(); 
352                         ++propiter){
353                 
354                         newTZData.recurranceDateDataTokens.push_back("");
355                         newTZData.recurranceDateDataValue.push_back("");
356                         newTZData.recurranceDateDataTimeZoneParam.push_back("");
357                         newTZData.recurranceDateData.push_back("");
358                         
359                         bool TokenData = false;
360                         string propertyTokens;
361                 
362                         propertyNameData = (string*)&propiter->first;
363                 
364                         propertyData = SplitValues(*propertyNameData);
365                         
366                         for(map<string,string>::iterator dataiter = propertyData.begin();
367                                 dataiter != propertyData.end(); dataiter++){
368                         
369                                 if (dataiter->first == "VALUE"){
370                         
371                                         newTZData.recurranceDateDataValue[objectSeekCount] = dataiter->second;
372                                 
373                                 } else if (dataiter->first == "TZID"){
374                                 
375                                         newTZData.recurranceDateDataTimeZoneParam[objectSeekCount] = dataiter->second;
376                                 
377                                 } else {
378                                 
379                                         if (TokenData == false){
380                                                 TokenData = true;
381                                         } else {
382                                                 propertyTokens += ";";
383                                         }
384                                 
385                                         propertyTokens += dataiter->first;
386                                         propertyTokens += "=";
387                                         propertyTokens += dataiter->second;
388                                 
389                                 }
390                                 
391                         }
392                 
393                         if (propertyTokens.size() > 0){
394                                 newTZData.recurranceDateDataTokens[objectSeekCount] = propertyTokens;
395                         }
396                         
397                         newTZData.recurranceDateData[objectSeekCount] = propiter->second;
398                 
399                         objectSeekCount++;
400                 
401                 }
402                         
403 // Process the data from TZNAME.
404                         
405                 dataReceived = ProcessTextVectors(&timezoneStandardName[seekCount], 
406                         &timezoneStandardData[seekCount], true, "TZNAME");
408                 objectSeekCount = 0;
409         
410                 for(multimap<string,string>::iterator propiter = dataReceived.begin(); 
411                         propiter != dataReceived.end(); 
412                         ++propiter){
413                 
414                         newTZData.timeZoneNameTokens.push_back("");
415                         newTZData.timeZoneNameLanguage.push_back("");
416                         newTZData.timeZoneNameData.push_back("");
417                         
418                         bool TokenData = false;
419                         string propertyTokens;
420                 
421                         propertyNameData = (string*)&propiter->first;
422                 
423                         propertyData = SplitValues(*propertyNameData);
424                         
425                         for(map<string,string>::iterator dataiter = propertyData.begin();
426                                 dataiter != propertyData.end(); dataiter++){
427                         
428                                 if (dataiter->first == "LANGUAGE"){
429                                 
430                                         newTZData.timeZoneNameLanguage[objectSeekCount] = dataiter->second;
431                                 
432                                 } else {
433                                 
434                                         if (TokenData == false){
435                                                 TokenData = true;
436                                         } else {
437                                                 propertyTokens += ";";
438                                         }
439                                 
440                                         propertyTokens += dataiter->first;
441                                         propertyTokens += "=";
442                                         propertyTokens += dataiter->second;
443                                 
444                                 }
445                                 
446                         }
447                 
448                         if (propertyTokens.size() > 0){
449                                 newTZData.timeZoneNameTokens[objectSeekCount] = propertyTokens;
450                         }
451                         
452                         newTZData.timeZoneNameData[objectSeekCount] = propiter->second;
453                 
454                         objectSeekCount++;
455                 
456                 }
457                         
458                 objectSeekCount = 0;
459         
460                 // Process data from X-*
461         
462                 for(vector<string>::iterator propiter = timezoneStandardName[seekCount].begin(); 
463                         propiter != timezoneStandardName[seekCount].end(); ++propiter){
464                 
465                         if (propiter->substr(0,2) == "X-" &&
466                                 propiter->size() > 2){
467                                         
468                                 newTZData.xTokensData.push_back(timezoneStandardData[seekCount][objectSeekCount]);
469                                 newTZData.xTokensDataTokens.push_back(timezoneStandardName[seekCount][objectSeekCount]);
470                                 
471                         }
472                 
473                         objectSeekCount++;
474                 
475                 }
476                 
477                 // Check if the required values were given and
478                 // insert newTZData into the vector list of
479                 // standard timezones.
480                         
481                 if (dateTimeStartFound == true &&
482                         timeZoneOffsetToFound == true &&
483                         timeZoneOffsetFromFound == true){
484                                         
485                         timezoneStandardCollection.push_back(newTZData);
486                                         
487                 }
488                         
489                 seekCount++;
490                         
491         }
493         seekCount = 0;
494         
495         for (vector<vector<string>>::iterator tzsiter = timezoneDaylightName.begin();
496                 tzsiter != timezoneDaylightName.end(); tzsiter++){
498                 bool dateTimeStartFound = false;
499                 bool timeZoneOffsetToFound = false;
500                 bool timeZoneOffsetFromFound = false;
501                 
502                 TimezoneDataStruct newTZData;
503                                         
504                 // Process the data from DTSTART.
505         
506                 dataReceived = ProcessTextVectors(&timezoneDaylightName[seekCount], 
507                                 &timezoneDaylightData[seekCount], false, "DTSTART");
508         
509                 if (dataReceived.begin() != dataReceived.end()){
510         
511                         try {
512                                 newTZData.dateTimeStartTokens = dataReceived.begin()->first.substr(8);
513                         }
514                 
515                         catch(const out_of_range &oor){
516                                 // Do nothing as there is no data.
517                         }
518                 
519                         newTZData.dateTimeStartData = dataReceived.begin()->second;
520                         dateTimeStartFound = true;
521                 
522                 }
523                         
524                 // Process the data from TZOFFSETFROM.
525                         
526                 dataReceived = ProcessTextVectors(&timezoneDaylightName[seekCount], 
527                                 &timezoneDaylightData[seekCount], false, "TZOFFSETFROM");
528         
529                 if (dataReceived.begin() != dataReceived.end()){
530         
531                         try {
532                                 newTZData.timeZoneOffsetFromTokens = dataReceived.begin()->first.substr(13);
533                         }
534                 
535                         catch(const out_of_range &oor){
536                                 // Do nothing as there is no data.
537                         }
538                 
539                         newTZData.timeZoneOffsetFromData = dataReceived.begin()->second;
540                         timeZoneOffsetFromFound = true;
541                 
542                 }
543                         
544                 // Process the data from TZOFFSETTO.
545                         
546                 dataReceived = ProcessTextVectors(&timezoneDaylightName[seekCount], 
547                                 &timezoneDaylightData[seekCount], false, "TZOFFSETTO");
548         
549                 if (dataReceived.begin() != dataReceived.end()){
550         
551                         try {
552                                 newTZData.timeZoneOffsetToTokens = dataReceived.begin()->first.substr(11);
553                         }
554                 
555                         catch(const out_of_range &oor){
556                                 // Do nothing as there is no data.
557                         }
558                 
559                         newTZData.timeZoneOffsetToData = dataReceived.begin()->second;
560                         timeZoneOffsetToFound = true;
561                 
562                 }
563                 
564                 // Process the data from RRULE.
566                 dataReceived = ProcessTextVectors(&timezoneDaylightName[seekCount], 
567                         &timezoneDaylightData[seekCount], false, "RRULE");
568         
569                 if (dataReceived.begin() != dataReceived.end()){
570         
571                         try {
572                                 newTZData.recurranceRuleDataTokens = dataReceived.begin()->first.substr(6);
573                         }
574                 
575                         catch(const out_of_range &oor){
576                                 // Do nothing as there is no data.
577                         }               
578                         
579                         newTZData.recurranceRuleData = dataReceived.begin()->second;
580                 
581                 }
582                         
583                 // Process the data from COMMENT.
584         
585                 dataReceived = ProcessTextVectors(&timezoneDaylightName[seekCount], 
586                         &timezoneDaylightData[seekCount], true, "COMMENT");
588                 objectSeekCount = 0;
589         
590                 for(multimap<string,string>::iterator propiter = dataReceived.begin(); 
591                         propiter != dataReceived.end(); 
592                         ++propiter){
593                 
594                         newTZData.commentListTokens.push_back("");
595                         newTZData.commentListAltRep.push_back("");
596                         newTZData.commentListLanguage.push_back("");
597                         newTZData.commentList.push_back("");
598                         
599                         bool TokenData = false;
600                         string propertyTokens;
601                 
602                         propertyNameData = (string*)&propiter->first;
603                 
604                         propertyData = SplitValues(*propertyNameData);
605                         
606                         for(map<string,string>::iterator propdataiter = propertyData.begin();
607                                 propdataiter != propertyData.end(); propdataiter++){
608                         
609                                 if (propdataiter->first == "ALTREP"){
610                                 
611                                         newTZData.commentListAltRep[objectSeekCount] = propdataiter->second;
612                                 
613                                 } else if (propdataiter->first == "LANGUAGE"){
614                                 
615                                         newTZData.commentListLanguage[objectSeekCount] = propdataiter->second;
616                                 
617                                 } else {
618                                 
619                                         if (TokenData == false){
620                                                 TokenData = true;
621                                         } else {
622                                                 propertyTokens += ";";
623                                         }
624                                 
625                                         propertyTokens += propdataiter->first;
626                                         propertyTokens += "=";
627                                         propertyTokens += propdataiter->second;
628                                 
629                                 }
630                                 
631                         }
632                 
633                         if (propertyTokens.size() > 0){
634                                 newTZData.commentListTokens[objectSeekCount] = propertyTokens;
635                         }
636                         
637                         newTZData.commentList[objectSeekCount] = propiter->second;
638                         
639                         objectSeekCount++;
640                 
641                 }
642                 
643                 // Process the data from RDATE.
644                         
645                 dataReceived = ProcessTextVectors(&timezoneDaylightName[seekCount], 
646                         &timezoneDaylightData[seekCount], true, "RDATE");
648                 objectSeekCount = 0;
649         
650                 for(multimap<string,string>::iterator propiter = dataReceived.begin(); 
651                         propiter != dataReceived.end(); 
652                         ++propiter){
653                 
654                         newTZData.recurranceDateDataTokens.push_back("");
655                         newTZData.recurranceDateDataValue.push_back("");
656                         newTZData.recurranceDateDataTimeZoneParam.push_back("");
657                         newTZData.recurranceDateData.push_back("");
658                         
659                         bool TokenData = false;
660                         string propertyTokens;
661                 
662                         propertyNameData = (string*)&propiter->first;
663                 
664                         propertyData = SplitValues(*propertyNameData);
665                         
666                         for(map<string,string>::iterator dataiter = propertyData.begin();
667                                 dataiter != propertyData.end(); dataiter++){
668                         
669                                 if (dataiter->first == "VALUE"){
670                         
671                                         newTZData.recurranceDateDataValue[objectSeekCount] = dataiter->second;
672                                 
673                                 } else if (dataiter->first == "TZID"){
674                                 
675                                         newTZData.recurranceDateDataTimeZoneParam[objectSeekCount] = dataiter->second;
676                                 
677                                 } else {
678                                 
679                                         if (TokenData == false){
680                                                 TokenData = true;
681                                         } else {
682                                                 propertyTokens += ";";
683                                         }
684                                 
685                                         propertyTokens += dataiter->first;
686                                         propertyTokens += "=";
687                                         propertyTokens += dataiter->second;
688                                 
689                                 }
690                                 
691                         }
692                 
693                         if (propertyTokens.size() > 0){
694                                 newTZData.recurranceDateDataTokens[objectSeekCount] = propertyTokens;
695                         }
696                         
697                         newTZData.recurranceDateData[objectSeekCount] = propiter->second;
698                 
699                         objectSeekCount++;
700                 
701                 }
702                         
703                 // Process the data from TZNAME.
704                         
705                 dataReceived = ProcessTextVectors(&timezoneDaylightName[seekCount], 
706                         &timezoneDaylightData[seekCount], true, "TZNAME");
708                 objectSeekCount = 0;
709         
710                 for(multimap<string,string>::iterator propiter = dataReceived.begin(); 
711                         propiter != dataReceived.end(); 
712                         ++propiter){
713                 
714                         newTZData.timeZoneNameTokens.push_back("");
715                         newTZData.timeZoneNameLanguage.push_back("");
716                         newTZData.timeZoneNameData.push_back("");
717                         
718                         bool TokenData = false;
719                         string propertyTokens;
720                 
721                         propertyNameData = (string*)&propiter->first;
722                 
723                         propertyData = SplitValues(*propertyNameData);
724                         
725                         for(map<string,string>::iterator dataiter = propertyData.begin();
726                                 dataiter != propertyData.end(); dataiter++){
727                         
728                                 if (dataiter->first == "LANGUAGE"){
729                                 
730                                         newTZData.timeZoneNameLanguage[objectSeekCount] = dataiter->second;
731                                 
732                                 } else {
733                                 
734                                         if (TokenData == false){
735                                                 TokenData = true;
736                                         } else {
737                                                 propertyTokens += ";";
738                                         }
739                                 
740                                         propertyTokens += dataiter->first;
741                                         propertyTokens += "=";
742                                         propertyTokens += dataiter->second;
743                                 
744                                 }
745                                 
746                         }
747                 
748                         if (propertyTokens.size() > 0){
749                                 newTZData.timeZoneNameTokens[objectSeekCount] = propertyTokens;
750                         }
751                         
752                         newTZData.timeZoneNameData[objectSeekCount] = propiter->second;
753                 
754                         objectSeekCount++;
755                 
756                 }
757                         
758                 objectSeekCount = 0;
759         
760                 // Process data from X-*
761         
762                 for(vector<string>::iterator propiter = timezoneDaylightName[seekCount].begin(); 
763                         propiter != timezoneDaylightName[seekCount].end(); ++propiter){
764                 
765                         if (propiter->substr(0,2) == "X-" &&
766                                 propiter->size() > 2){
767                                         
768                                 newTZData.xTokensData.push_back(timezoneDaylightData[seekCount][objectSeekCount]);
769                                 newTZData.xTokensDataTokens.push_back(timezoneDaylightName[seekCount][objectSeekCount]);
770                                 
771                         }
772                 
773                         objectSeekCount++;
774                 
775                 }
776                 
777                 // Check if the required values were given and
778                 // insert newTZData into the vector list of
779                 // daylight timezones.
780                         
781                 if (dateTimeStartFound == true &&
782                         timeZoneOffsetToFound == true &&
783                         timeZoneOffsetFromFound == true){
784                                         
785                         timezoneDaylightCollection.push_back(newTZData);
786                                         
787                 }
788                         
789                 seekCount++;
790                         
791         }
792         
795 void CalendarTimezoneObject::ProcessStandardDaylight(){
797         int seekCount = 0;
798         
799         bool TZMode = false; // False = STANDARD, True = DAYLIGHT.
800         bool validBegin = false;
801         vector<string> timezoneObjectName;
802         vector<string> timezoneObjectData;
803         
804         for (vector<string>::iterator iter = objectName.begin();
805                 iter != objectName.end(); iter++){      
806         
807                 // Check if the current name is BEGIN and
808                 // data is either STANDARD or DAYLIGHT.
809                         
810                 if (objectName[seekCount] == "BEGIN" &&
811                         (objectData[seekCount] == "STANDARD" || 
812                         objectData[seekCount] == "DAYLIGHT")){
813                         
814                         if (validBegin == false){
815                                 validBegin = true;
816                         } else {
817                                 
818                         }
819                         
820                         if (objectData[seekCount] == "STANDARD"){
821                                 TZMode = false;
822                         } else if (objectData[seekCount] == "DAYLIGHT") {
823                                 TZMode = true;
824                         }
825                         
826                         seekCount++;
827                         continue;
828                         
829                 }
830                 
831                 // Check if current name is END and
832                 // data is either STANDARD or DAYLIGHT.
833                 
834                 if (objectName[seekCount] == "END" &&
835                         (objectData[seekCount] == "STANDARD" || 
836                         objectData[seekCount] == "DAYLIGHT") && 
837                         validBegin == true){
838                                 
839                         if (TZMode == false && timezoneObjectName.size() > 0){
840                                 timezoneStandardName.push_back(timezoneObjectName);
841                                 timezoneStandardData.push_back(timezoneObjectData);
842                         } else {
843                                 timezoneDaylightName.push_back(timezoneObjectName);
844                                 timezoneDaylightData.push_back(timezoneObjectData);
845                         }
846                         
847                         timezoneObjectName.clear();
848                         timezoneObjectData.clear();
849                         
850                         validBegin = false;
851                                 
852                 }
853                 
854                 if (validBegin == true){
855                         
856                         timezoneObjectName.push_back(objectName[seekCount]);
857                         timezoneObjectData.push_back(objectData[seekCount]);
858                         
859                 }
860                 
861                 seekCount++;
862                         
863         }
864                         
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