1 #include "CalendarEvent.h"
5 CalendarObjectValidResult CalendarEventObject::ValidObject(){
7 bool ValidBegin = false;
9 bool ValidDateTimeStamp = false;
10 bool ValidUniqueID = false;
11 bool ValidDateTimeStart = false;
15 // Look for BEGIN:VEVENT.
17 for (vector<string>::iterator iter = ObjectName.begin();
18 iter != ObjectName.end(); iter++){
20 if (ObjectName[SeekCount] == "BEGIN" &&
21 ObjectData[SeekCount] == "VEVENT"){
23 if (ValidBegin == false){
26 return CALENDAROBJECTVALID_INVALIDFORMAT;
31 if (ObjectName[SeekCount] == "END" &&
32 ObjectData[SeekCount] == "VEVENT" &&
35 return CALENDAROBJECTVALID_INVALIDFORMAT;
47 for (vector<string>::iterator iter = ObjectName.begin();
48 iter != ObjectName.end(); iter++){
51 PropertyName = ObjectName[SeekCount].substr(0,7);
54 catch(const out_of_range& oor){
58 if (PropertyName == "DTSTAMP"){
60 if (ValidDateTimeStamp == false){
61 ValidDateTimeStamp = true;
63 return CALENDAROBJECTVALID_INVALIDFORMAT;
76 for (vector<string>::iterator iter = ObjectName.begin();
77 iter != ObjectName.end(); iter++){
80 PropertyName = ObjectName[SeekCount].substr(0,3);
83 catch(const out_of_range& oor){
87 if (PropertyName == "UID"){
89 if (ValidUniqueID == false){
92 return CALENDAROBJECTVALID_INVALIDFORMAT;
103 // Look for DTSTART if nothing is set for METHOD..
105 if (MethodData.size() == 0){
107 for (vector<string>::iterator iter = ObjectName.begin();
108 iter != ObjectName.end(); iter++){
111 PropertyName = ObjectName[SeekCount].substr(0,7);
114 catch(const out_of_range& oor){
118 if (PropertyName == "DTSTART"){
120 if (ValidDateTimeStart == false){
121 ValidDateTimeStart = true;
123 return CALENDAROBJECTVALID_INVALIDFORMAT;
133 ValidDateTimeStart = true;
138 // Look for END:VEVENT.
140 for (vector<string>::iterator iter = ObjectName.begin();
141 iter != ObjectName.end(); iter++){
143 if (ObjectName[SeekCount] == "END" &&
144 ObjectData[SeekCount] == "VEVENT"){
146 if (ValidEnd == false){
149 return CALENDAROBJECTVALID_INVALIDFORMAT;
158 // Check if the VEVENT is valid.
160 if (ValidBegin == true &&
162 ValidDateTimeStamp == true &&
163 ValidDateTimeStart == true &&
164 ValidUniqueID == true){
166 return CALENDAROBJECTVALID_OK;
170 return CALENDAROBJECTVALID_INVALIDFORMAT;
176 void CalendarEventObject::ProcessData(){
180 multimap<string,string> DataReceived;
181 map<string,string> PropertyData;
182 string *PropertyNameData = nullptr;
183 int ObjectSeekCount = 0;
185 // Get the Date Time Stamp (DTSTAMP).
187 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "DTSTAMP");
189 // Process the data from DTSTAMP.
191 if (DataReceived.begin() != DataReceived.end()){
194 DateTimeStampTokens = DataReceived.begin()->first.substr(8);
197 catch(const out_of_range &oor){
198 // Do nothing as there is no data.
201 DateTimeStampData = DataReceived.begin()->second;
205 // Get the Unique ID (UID).
207 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "UID");
209 // Process the data from UID.
211 if (DataReceived.begin() != DataReceived.end()){
214 UniqueIDTokens = DataReceived.begin()->first.substr(4);
217 catch(const out_of_range &oor){
218 // Do nothing as there is no data.
221 UniqueID = DataReceived.begin()->second;
225 // Get the Date Time Start value.
227 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "DTSTART");
229 // Process the data from DTSTART.
231 if (DataReceived.begin() != DataReceived.end()){
233 bool TokenData = false;
234 string PropertyTokens;
236 PropertyNameData = (string*)&DataReceived.begin()->first;
238 PropertyData = SplitValues(*PropertyNameData);
240 for(map<string,string>::iterator iter = PropertyData.begin();
241 iter != PropertyData.end(); iter++){
243 if (iter->first == "VALUE"){
245 DateTimeStartDataValue = iter->second;
247 } else if (iter->first == "TZID"){
249 DateTimeStartDataTimeZoneID = iter->second;
253 if (TokenData == false){
256 PropertyTokens += ";";
259 PropertyTokens += iter->first;
260 PropertyTokens += "=";
261 PropertyTokens += iter->second;
267 if (PropertyTokens.size() > 0){
268 DateTimeStartDataTokens = PropertyTokens;
271 DateTimeStartData = DataReceived.begin()->second;
275 // Process the data from CLASS.
277 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "CLASS");
279 if (DataReceived.begin() != DataReceived.end()){
282 ClassDataTokens = DataReceived.begin()->first.substr(6);
285 catch(const out_of_range &oor){
286 // Do nothing as there is no data.
289 ClassData = DataReceived.begin()->second;
293 // Process the data from CREATED.
295 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "CREATED");
297 if (DataReceived.begin() != DataReceived.end()){
300 DateTimeCreatedTokens = DataReceived.begin()->first.substr(8);
303 catch(const out_of_range &oor){
304 // Do nothing as there is no data.
307 DateTimeCreatedData = DataReceived.begin()->second;
311 // Process the data from DESCRIPTION.
313 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "DESCRIPTION");
315 if (DataReceived.begin() != DataReceived.end()){
317 bool TokenData = false;
318 string PropertyTokens;
320 PropertyNameData = (string*)&DataReceived.begin()->first;
322 PropertyData = SplitValues(*PropertyNameData);
324 for(map<string,string>::iterator iter = PropertyData.begin();
325 iter != PropertyData.end(); iter++){
327 if (iter->first == "ALTREP"){
329 DescriptionListAltRep.clear();
330 DescriptionListAltRep.push_back(iter->second);
332 } else if (iter->first == "LANGUAGE"){
334 DescriptionListLanguage.clear();
335 DescriptionListLanguage.push_back(iter->second);
339 if (TokenData == false){
342 PropertyTokens += ";";
345 PropertyTokens += iter->first;
346 PropertyTokens += "=";
347 PropertyTokens += iter->second;
353 if (PropertyTokens.size() > 0){
354 DescriptionListTokens.clear();
355 DescriptionListTokens.push_back(PropertyTokens);
358 DescriptionList.clear();
359 DescriptionList.push_back(DataReceived.begin()->second);
363 // Process the data from GEO.
365 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "GEO");
367 if (DataReceived.begin() != DataReceived.end()){
370 GeographicTokens = DataReceived.begin()->first.substr(4);
373 catch(const out_of_range &oor){
374 // Do nothing as there is no data.
377 GeographicData = DataReceived.begin()->second;
381 // Process the data from LAST-MODIFIED.
383 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "LAST-MODIFIED");
385 if (DataReceived.begin() != DataReceived.end()){
388 LastModifiedTokens = DataReceived.begin()->first.substr(14);
391 catch(const out_of_range &oor){
392 // Do nothing as there is no data.
395 LastModifiedData = DataReceived.begin()->second;
399 // Process the data from LOCATION.
401 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "LOCATION");
403 if (DataReceived.begin() != DataReceived.end()){
405 bool TokenData = false;
406 string PropertyTokens;
408 PropertyNameData = (string*)&DataReceived.begin()->first;
410 PropertyData = SplitValues(*PropertyNameData);
412 for(map<string,string>::iterator iter = PropertyData.begin();
413 iter != PropertyData.end(); iter++){
415 if (iter->first == "ALTREP"){
417 LocationDataAltRep = iter->second;
419 } else if (iter->first == "LANGUAGE"){
421 LocationDataLanguage = iter->second;
425 if (TokenData == false){
428 PropertyTokens += ";";
431 PropertyTokens += iter->first;
432 PropertyTokens += "=";
433 PropertyTokens += iter->second;
439 if (PropertyTokens.size() > 0){
441 LocationDataTokens = PropertyTokens;
445 LocationData = DataReceived.begin()->second;
449 // Process the data from ORGANIZER.
451 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "ORGANIZER");
453 if (DataReceived.begin() != DataReceived.end()){
455 bool TokenData = false;
456 string PropertyTokens;
458 PropertyNameData = (string*)&DataReceived.begin()->first;
460 PropertyData = SplitValues(*PropertyNameData);
462 for(map<string,string>::iterator iter = PropertyData.begin();
463 iter != PropertyData.end(); iter++){
465 if (iter->first == "CN"){
467 OrganiserDataCommonName = iter->second;
469 } else if (iter->first == "DIR"){
471 OrganiserDataDirectoryEntry = iter->second;
473 } else if (iter->first == "SENT-BY"){
475 OrganiserDataSentByParam = iter->second;
477 } else if (iter->first == "LANGUAGE"){
479 OrganiserDataLanguage = iter->second;
483 if (TokenData == false){
486 PropertyTokens += ";";
489 PropertyTokens += iter->first;
490 PropertyTokens += "=";
491 PropertyTokens += iter->second;
497 if (PropertyTokens.size() > 0){
499 OrganiserDataTokens = PropertyTokens;
503 OrganiserData = DataReceived.begin()->second;
507 // Process the data from PRIORITY.
509 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "PRIORITY");
511 if (DataReceived.begin() != DataReceived.end()){
514 PriorityTokens = DataReceived.begin()->first.substr(9);
517 catch(const out_of_range &oor){
518 // Do nothing as there is no data.
522 PriorityData = stoi(DataReceived.begin()->second);
525 catch(const invalid_argument &oor){
526 PriorityTokens.clear();
531 // Process the data from SEQUENCE.
533 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "SEQUENCE");
535 if (DataReceived.begin() != DataReceived.end()){
538 SequenceTokens = DataReceived.begin()->first.substr(9);
541 catch(const out_of_range &oor){
542 // Do nothing as there is no data.
546 SequenceData = stoi(DataReceived.begin()->second);
549 catch(const invalid_argument &oor){
550 SequenceTokens.clear();
555 // Process the data from STATUS.
557 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "STATUS");
559 if (DataReceived.begin() != DataReceived.end()){
561 bool TokenData = false;
562 string PropertyTokens;
564 PropertyNameData = (string*)&DataReceived.begin()->first;
566 PropertyData = SplitValues(*PropertyNameData);
568 for(map<string,string>::iterator iter = PropertyData.begin();
569 iter != PropertyData.end(); iter++){
571 if (iter->first == "LANGUAGE"){
573 StatusLanguage = iter->second;
577 if (TokenData == false){
580 PropertyTokens += ";";
583 PropertyTokens += iter->first;
584 PropertyTokens += "=";
585 PropertyTokens += iter->second;
591 if (PropertyTokens.size() > 0){
593 StatusTokens = PropertyTokens;
597 StatusData = DataReceived.begin()->second;
601 // Process the data from SUMMARY.
603 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "SUMMARY");
605 if (DataReceived.begin() != DataReceived.end()){
607 bool TokenData = false;
608 string PropertyTokens;
610 PropertyNameData = (string*)&DataReceived.begin()->first;
612 PropertyData = SplitValues(*PropertyNameData);
614 for(map<string,string>::iterator iter = PropertyData.begin();
615 iter != PropertyData.end(); iter++){
617 if (iter->first == "ALTREP"){
619 SummaryDataAltRep = iter->second;
621 } else if (iter->first == "LANGUAGE"){
623 SummaryDataLanguage = iter->second;
627 if (TokenData == false){
630 PropertyTokens += ";";
633 PropertyTokens += iter->first;
634 PropertyTokens += "=";
635 PropertyTokens += iter->second;
641 if (PropertyTokens.size() > 0){
643 SummaryDataTokens = PropertyTokens;
647 SummaryData = DataReceived.begin()->second;
651 // Process the data from TRANSP.
653 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "TRANSP");
655 if (DataReceived.begin() != DataReceived.end()){
658 TimeTransparencyDataTokens = DataReceived.begin()->first.substr(7);
661 catch(const out_of_range &oor){
662 // Do nothing as there is no data.
665 TimeTransparencyData = DataReceived.begin()->second;
669 // Process the data from URL.
671 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "URL");
673 if (DataReceived.begin() != DataReceived.end()){
676 URLDataTokens = DataReceived.begin()->first.substr(4);
679 catch(const out_of_range &oor){
680 // Do nothing as there is no data.
683 URLData = DataReceived.begin()->second;
687 // Process the data from RECURRENCE-ID.
689 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "RECURRENCE-ID");
691 if (DataReceived.begin() != DataReceived.end()){
693 bool TokenData = false;
694 string PropertyTokens;
696 PropertyNameData = (string*)&DataReceived.begin()->first;
698 PropertyData = SplitValues(*PropertyNameData);
700 for(map<string,string>::iterator iter = PropertyData.begin();
701 iter != PropertyData.end(); iter++){
703 if (iter->first == "TZID"){
705 RecurranceIDDataTimeZoneParam = iter->second;
707 } else if (iter->first == "VALUE"){
709 RecurranceIDDataValue = iter->second;
711 } else if (iter->first == "RANGE"){
713 RecurranceIDDataRangeParam = iter->second;
717 if (TokenData == false){
720 PropertyTokens += ";";
723 PropertyTokens += iter->first;
724 PropertyTokens += "=";
725 PropertyTokens += iter->second;
731 if (PropertyTokens.size() > 0){
733 RecurranceIDDataTokens = PropertyTokens;
737 RecurranceIDData = DataReceived.begin()->second;
741 // Process the data from RRULE.
743 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "RRULE");
745 if (DataReceived.begin() != DataReceived.end()){
748 RecurranceRuleDataTokens = DataReceived.begin()->first.substr(6);
751 catch(const out_of_range &oor){
752 // Do nothing as there is no data.
755 RecurranceRuleData = DataReceived.begin()->second;
759 // Process the data from DTEND.
761 bool DateTimeEndProcessed = false;
763 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "DTEND");
765 if (DataReceived.begin() != DataReceived.end()){
767 bool TokenData = false;
768 string PropertyTokens;
770 PropertyNameData = (string*)&DataReceived.begin()->first;
772 PropertyData = SplitValues(*PropertyNameData);
774 for(map<string,string>::iterator iter = PropertyData.begin();
775 iter != PropertyData.end(); iter++){
777 if (iter->first == "VALUE"){
779 DateTimeEndDataValue = iter->second;
781 } else if (iter->first == "TZID"){
783 DateTimeEndDataTimeZoneID = iter->second;
787 if (TokenData == false){
790 PropertyTokens += ";";
793 PropertyTokens += iter->first;
794 PropertyTokens += "=";
795 PropertyTokens += iter->second;
801 if (PropertyTokens.size() > 0){
802 DateTimeEndDataTokens = PropertyTokens;
805 DateTimeEndData = DataReceived.begin()->second;
807 DateTimeEndProcessed = true;
811 if (DateTimeEndProcessed == false){
813 // Process the data from DURATION if DTEND
814 // hasn't already been processed.
816 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "DURATION");
818 if (DataReceived.begin() != DataReceived.end()){
821 DurationDataTokens = DataReceived.begin()->first.substr(9);
824 catch(const out_of_range &oor){
825 // Do nothing as there is no data.
828 DurationData = DataReceived.begin()->second;
834 // Process the data from ATTACH.
836 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "ATTACH");
838 for(multimap<string,string>::iterator iter = DataReceived.begin();
839 iter != DataReceived.end();
842 AttachListEncoding.push_back("");
843 AttachListValue.push_back("");
844 AttachListFormatType.push_back("");
845 AttachListTokens.push_back("");
846 AttachList.push_back("");
848 bool TokenData = false;
849 string PropertyTokens;
851 PropertyNameData = (string*)&iter->first;
853 PropertyData = SplitValues(*PropertyNameData);
855 for(map<string,string>::iterator dataiter = PropertyData.begin();
856 dataiter != PropertyData.end(); dataiter++){
858 if (dataiter->first == "ENCODING"){
860 AttachListEncoding[ObjectSeekCount] = dataiter->second;
862 } else if (dataiter->first == "VALUE"){
864 AttachListValue[ObjectSeekCount] = dataiter->second;
866 } else if (dataiter->first == "FMTTYPE"){
868 AttachListFormatType[ObjectSeekCount] = dataiter->second;
872 if (TokenData == false){
875 PropertyTokens += ";";
878 PropertyTokens += dataiter->first;
879 PropertyTokens += "=";
880 PropertyTokens += dataiter->second;
886 if (PropertyTokens.size() > 0){
887 AttachListTokens[ObjectSeekCount] = PropertyTokens;
890 AttachList[ObjectSeekCount] = iter->second;
896 // Process the data from ATTENDEE.
898 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "ATTENDEE");
902 for(multimap<string,string>::iterator iter = DataReceived.begin();
903 iter != DataReceived.end();
906 AttendeeListMember.push_back("");
907 AttendeeListDelegatedFrom.push_back("");
908 AttendeeListDelegatedTo.push_back("");
909 AttendeeListRole.push_back("");
910 AttendeeListRSVP.push_back("");
911 AttendeeListDirectoryEntry.push_back("");
912 AttendeeListSentBy.push_back("");
913 AttendeeListCommonName.push_back("");
914 AttendeeListCalendarUserType.push_back("");
915 AttendeeListParticipationStatus.push_back("");
916 AttendeeListLanguage.push_back("");
917 AttendeeListTokens.push_back("");
918 AttendeeList.push_back("");
920 bool TokenData = false;
921 string PropertyTokens;
923 PropertyNameData = (string*)&iter->first;
925 PropertyData = SplitValues(*PropertyNameData);
927 for(map<string,string>::iterator dataiter = PropertyData.begin();
928 dataiter != PropertyData.end(); dataiter++){
930 if (dataiter->first == "CUTYPE"){
932 AttendeeListCalendarUserType[ObjectSeekCount] = dataiter->second;
934 } else if (dataiter->first == "MEMBER"){
936 AttendeeListMember[ObjectSeekCount] = dataiter->second;
938 } else if (dataiter->first == "ROLE"){
940 AttendeeListRole[ObjectSeekCount] = dataiter->second;
942 } else if (dataiter->first == "PARTSTAT"){
944 AttendeeListParticipationStatus[ObjectSeekCount] = dataiter->second;
946 } else if (dataiter->first == "RSVP"){
948 AttendeeListRSVP[ObjectSeekCount] = dataiter->second;
950 } else if (dataiter->first == "DELEGATED-TO"){
952 AttendeeListDelegatedTo[ObjectSeekCount] = dataiter->second;
954 } else if (dataiter->first == "DELEGATED-FROM"){
956 AttendeeListDelegatedFrom[ObjectSeekCount] = dataiter->second;
958 } else if (dataiter->first == "SENT-BY"){
960 AttendeeListSentBy[ObjectSeekCount] = dataiter->second;
962 } else if (dataiter->first == "CN"){
964 AttendeeListCommonName[ObjectSeekCount] = dataiter->second;
966 } else if (dataiter->first == "DIR"){
968 AttendeeListDirectoryEntry[ObjectSeekCount] = dataiter->second;
970 } else if (dataiter->first == "LANGUAGE"){
972 AttendeeListLanguage[ObjectSeekCount] = dataiter->second;
976 if (TokenData == false){
979 PropertyTokens += ";";
982 PropertyTokens += dataiter->first;
983 PropertyTokens += "=";
984 PropertyTokens += dataiter->second;
990 if (PropertyTokens.size() > 0){
991 AttendeeListTokens[ObjectSeekCount] = PropertyTokens;
994 AttendeeList[ObjectSeekCount] = iter->second;
1000 // Process the data from CATEGORIES.
1002 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "CATEGORIES");
1004 ObjectSeekCount = 0;
1006 for(multimap<string,string>::iterator iter = DataReceived.begin();
1007 iter != DataReceived.end();
1010 CategoriesListTokens.push_back("");
1011 CategoriesListLanguage.push_back("");
1012 CategoriesList.push_back("");
1014 bool TokenData = false;
1015 string PropertyTokens;
1017 PropertyNameData = (string*)&iter->first;
1019 PropertyData = SplitValues(*PropertyNameData);
1021 for(map<string,string>::iterator dataiter = PropertyData.begin();
1022 dataiter != PropertyData.end(); dataiter++){
1024 if (dataiter->first == "LANGUAGE"){
1026 CategoriesListLanguage[ObjectSeekCount] = dataiter->second;
1030 if (TokenData == false){
1033 PropertyTokens += ";";
1036 PropertyTokens += dataiter->first;
1037 PropertyTokens += "=";
1038 PropertyTokens += dataiter->second;
1044 if (PropertyTokens.size() > 0){
1045 CategoriesListTokens[ObjectSeekCount] = PropertyTokens;
1048 CategoriesList[ObjectSeekCount] = iter->second;
1054 // Process the data from COMMENT.
1056 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "COMMENT");
1058 ObjectSeekCount = 0;
1060 for(multimap<string,string>::iterator iter = DataReceived.begin();
1061 iter != DataReceived.end();
1064 CommentListTokens.push_back("");
1065 CommentListAltRep.push_back("");
1066 CommentListLanguage.push_back("");
1067 CommentList.push_back("");
1069 bool TokenData = false;
1070 string PropertyTokens;
1072 PropertyNameData = (string*)&iter->first;
1074 PropertyData = SplitValues(*PropertyNameData);
1076 for(map<string,string>::iterator dataiter = PropertyData.begin();
1077 dataiter != PropertyData.end(); dataiter++){
1079 if (dataiter->first == "ALTREP"){
1081 CommentListAltRep[ObjectSeekCount] = dataiter->second;
1083 } else if (dataiter->first == "LANGUAGE"){
1085 CommentListLanguage[ObjectSeekCount] = dataiter->second;
1089 if (TokenData == false){
1092 PropertyTokens += ";";
1095 PropertyTokens += dataiter->first;
1096 PropertyTokens += "=";
1097 PropertyTokens += dataiter->second;
1103 if (PropertyTokens.size() > 0){
1104 CommentListTokens[ObjectSeekCount] = PropertyTokens;
1107 CommentList[ObjectSeekCount] = iter->second;
1113 // Process the data from CONTACT.
1115 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "CONTACT");
1117 ObjectSeekCount = 0;
1119 for(multimap<string,string>::iterator iter = DataReceived.begin();
1120 iter != DataReceived.end();
1123 ContactListTokens.push_back("");
1124 ContactListAltRep.push_back("");
1125 ContactListLanguage.push_back("");
1126 ContactList.push_back("");
1128 bool TokenData = false;
1129 string PropertyTokens;
1131 PropertyNameData = (string*)&iter->first;
1133 PropertyData = SplitValues(*PropertyNameData);
1135 for(map<string,string>::iterator dataiter = PropertyData.begin();
1136 dataiter != PropertyData.end(); dataiter++){
1138 if (dataiter->first == "ALTREP"){
1140 ContactListAltRep[ObjectSeekCount] = dataiter->second;
1142 } else if (dataiter->first == "LANGUAGE"){
1144 ContactListLanguage[ObjectSeekCount] = dataiter->second;
1148 if (TokenData == false){
1151 PropertyTokens += ";";
1154 PropertyTokens += dataiter->first;
1155 PropertyTokens += "=";
1156 PropertyTokens += dataiter->second;
1162 if (PropertyTokens.size() > 0){
1163 ContactListTokens[ObjectSeekCount] = PropertyTokens;
1166 ContactList[ObjectSeekCount] = iter->second;
1172 // Process the data from EXDATE.
1174 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "EXDATE");
1176 ObjectSeekCount = 0;
1178 for(multimap<string,string>::iterator iter = DataReceived.begin();
1179 iter != DataReceived.end();
1182 ExcludeDateDataTokens.push_back("");
1183 ExcludeDateDataValue.push_back("");
1184 ExcludeDateDataTimeZoneParam.push_back("");
1185 ExcludeDateData.push_back("");
1187 bool TokenData = false;
1188 string PropertyTokens;
1190 PropertyNameData = (string*)&iter->first;
1192 PropertyData = SplitValues(*PropertyNameData);
1194 for(map<string,string>::iterator dataiter = PropertyData.begin();
1195 dataiter != PropertyData.end(); dataiter++){
1197 if (dataiter->first == "VALUE"){
1199 ExcludeDateDataValue[ObjectSeekCount] = dataiter->second;
1201 } else if (dataiter->first == "TZID"){
1203 ExcludeDateDataTimeZoneParam[ObjectSeekCount] = dataiter->second;
1207 if (TokenData == false){
1210 PropertyTokens += ";";
1213 PropertyTokens += dataiter->first;
1214 PropertyTokens += "=";
1215 PropertyTokens += dataiter->second;
1221 if (PropertyTokens.size() > 0){
1222 ExcludeDateDataTokens[ObjectSeekCount] = PropertyTokens;
1225 ExcludeDateData[ObjectSeekCount] = iter->second;
1231 // Process the data from REQUEST-STATUS.
1233 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "REQUEST-STATUS");
1235 ObjectSeekCount = 0;
1237 for(multimap<string,string>::iterator iter = DataReceived.begin();
1238 iter != DataReceived.end();
1241 RequestStatusTokens.push_back("");
1242 RequestStatusLanguage.push_back("");
1243 RequestStatusData.push_back("");
1245 bool TokenData = false;
1246 string PropertyTokens;
1248 PropertyNameData = (string*)&iter->first;
1250 PropertyData = SplitValues(*PropertyNameData);
1252 for(map<string,string>::iterator dataiter = PropertyData.begin();
1253 dataiter != PropertyData.end(); dataiter++){
1255 if (dataiter->first == "LANGUAGE"){
1257 RequestStatusLanguage[ObjectSeekCount] = dataiter->second;
1261 if (TokenData == false){
1264 PropertyTokens += ";";
1267 PropertyTokens += dataiter->first;
1268 PropertyTokens += "=";
1269 PropertyTokens += dataiter->second;
1275 if (PropertyTokens.size() > 0){
1276 RequestStatusTokens[ObjectSeekCount] = PropertyTokens;
1279 RequestStatusData[ObjectSeekCount] = iter->second;
1285 // Process the data from RELATED-TO.
1287 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "RELATED-TO");
1289 ObjectSeekCount = 0;
1291 for(multimap<string,string>::iterator iter = DataReceived.begin();
1292 iter != DataReceived.end();
1295 RelatedToDataTokens.push_back("");
1296 RelatedToDataRelationType.push_back("");
1297 RelatedToData.push_back("");
1299 bool TokenData = false;
1300 string PropertyTokens;
1302 PropertyNameData = (string*)&iter->first;
1304 PropertyData = SplitValues(*PropertyNameData);
1306 for(map<string,string>::iterator dataiter = PropertyData.begin();
1307 dataiter != PropertyData.end(); dataiter++){
1309 if (dataiter->first == "RELTYPE"){
1311 RelatedToDataRelationType[ObjectSeekCount] = dataiter->second;
1315 if (TokenData == false){
1318 PropertyTokens += ";";
1321 PropertyTokens += dataiter->first;
1322 PropertyTokens += "=";
1323 PropertyTokens += dataiter->second;
1329 if (PropertyTokens.size() > 0){
1330 RelatedToDataTokens[ObjectSeekCount] = PropertyTokens;
1333 RelatedToData[ObjectSeekCount] = iter->second;
1339 // Process the data from RESOURCES.
1341 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "RESOURCES");
1343 ObjectSeekCount = 0;
1345 for(multimap<string,string>::iterator iter = DataReceived.begin();
1346 iter != DataReceived.end();
1349 ResourcesDataTokens.push_back("");
1350 ResourcesDataAltRep.push_back("");
1351 ResourcesDataLanguage.push_back("");
1352 ResourcesData.push_back("");
1354 bool TokenData = false;
1355 string PropertyTokens;
1357 PropertyNameData = (string*)&iter->first;
1359 PropertyData = SplitValues(*PropertyNameData);
1361 for(map<string,string>::iterator dataiter = PropertyData.begin();
1362 dataiter != PropertyData.end(); dataiter++){
1364 if (dataiter->first == "ALTREP"){
1366 ResourcesDataAltRep[ObjectSeekCount] = dataiter->second;
1368 } else if (dataiter->first == "LANGUAGE"){
1370 ResourcesDataLanguage[ObjectSeekCount] = dataiter->second;
1374 if (TokenData == false){
1377 PropertyTokens += ";";
1380 PropertyTokens += dataiter->first;
1381 PropertyTokens += "=";
1382 PropertyTokens += dataiter->second;
1388 if (PropertyTokens.size() > 0){
1389 ResourcesDataTokens[ObjectSeekCount] = PropertyTokens;
1392 ResourcesData[ObjectSeekCount] = iter->second;
1398 // Process the data from RDATE.
1400 DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "RDATE");
1402 ObjectSeekCount = 0;
1404 for(multimap<string,string>::iterator iter = DataReceived.begin();
1405 iter != DataReceived.end();
1408 RecurranceDateDataTokens.push_back("");
1409 RecurranceDateDataValue.push_back("");
1410 RecurranceDateDataTimeZoneParam.push_back("");
1411 RecurranceDateData.push_back("");
1413 bool TokenData = false;
1414 string PropertyTokens;
1416 PropertyNameData = (string*)&iter->first;
1418 PropertyData = SplitValues(*PropertyNameData);
1420 for(map<string,string>::iterator dataiter = PropertyData.begin();
1421 dataiter != PropertyData.end(); dataiter++){
1423 if (dataiter->first == "VALUE"){
1425 RecurranceDateDataValue[ObjectSeekCount] = dataiter->second;
1427 } else if (dataiter->first == "TZID"){
1429 RecurranceDateDataTimeZoneParam[ObjectSeekCount] = dataiter->second;
1433 if (TokenData == false){
1436 PropertyTokens += ";";
1439 PropertyTokens += dataiter->first;
1440 PropertyTokens += "=";
1441 PropertyTokens += dataiter->second;
1447 if (PropertyTokens.size() > 0){
1448 RecurranceDateDataTokens[ObjectSeekCount] = PropertyTokens;
1451 RecurranceDateData[ObjectSeekCount] = iter->second;
1457 // Process VALARM section.
1460 int AlarmObjectCount = 0;
1462 bool AlarmActionFound = false;
1464 for (vector<vector<string>>::iterator iter = EventAlarmName.begin();
1465 iter != EventAlarmName.end(); iter++){
1467 CalendarAlarmDataStruct NewAlarmData;
1469 // Process the data from ACTION.
1471 bool AlarmActionFound = false;
1472 bool AlarmTriggerFound = false;
1473 bool AlarmDurationFound = false;
1474 bool AlarmDescriptionFound = false;
1475 bool AlarmSummaryFound = false;
1477 DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount],
1478 &EventAlarmData[SeekCount], false, "ACTION");
1480 if (DataReceived.begin() != DataReceived.end()){
1483 NewAlarmData.AlarmActionTokens = DataReceived.begin()->first.substr(7);
1486 catch(const out_of_range &oor){
1487 // Do nothing as there is no data.
1490 NewAlarmData.AlarmAction = DataReceived.begin()->second;
1491 AlarmActionFound = true;
1495 // Check if a value was set for AlarmAction, otherwise
1496 // process the next VALARM section.
1498 if (NewAlarmData.AlarmAction.size() < 1){
1505 // Check if AlarmAction is DISPLAY, AUDIO or EMAIL.
1506 // Process the next VALARM section if not.
1508 if (NewAlarmData.AlarmAction == "AUDIO"){
1510 NewAlarmData.AlarmType = CALENDARALARM_AUDIO;
1512 } else if (NewAlarmData.AlarmAction == "DISPLAY"){
1514 NewAlarmData.AlarmType = CALENDARALARM_DISPLAY;
1516 } else if (NewAlarmData.AlarmAction == "EMAIL"){
1518 NewAlarmData.AlarmType = CALENDARALARM_EMAIL;
1527 // Process the data from TRIGGER.
1529 DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "TRIGGER");
1531 if (DataReceived.begin() != DataReceived.end()){
1533 bool TokenData = false;
1534 string PropertyTokens;
1536 PropertyNameData = (string*)&DataReceived.begin()->first;
1538 PropertyData = SplitValues(*PropertyNameData);
1540 for(map<string,string>::iterator iter = PropertyData.begin();
1541 iter != PropertyData.end(); iter++){
1543 if (iter->first == "VALUE"){
1545 NewAlarmData.TriggerValue = iter->second;
1547 } else if (iter->first == "RELATED"){
1549 NewAlarmData.TriggerRelated = iter->second;
1553 if (TokenData == false){
1556 PropertyTokens += ";";
1559 PropertyTokens += iter->first;
1560 PropertyTokens += "=";
1561 PropertyTokens += iter->second;
1567 if (PropertyTokens.size() > 0){
1568 NewAlarmData.TriggerTokens = PropertyTokens;
1571 NewAlarmData.TriggerData = DataReceived.begin()->second;
1572 AlarmTriggerFound = true;
1576 // Process the data from DESCRIPTION.
1578 DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "DESCRIPTION");
1580 if (DataReceived.begin() != DataReceived.end() &&
1581 (NewAlarmData.AlarmType == CALENDARALARM_DISPLAY ||
1582 NewAlarmData.AlarmType == CALENDARALARM_EMAIL)){
1584 bool TokenData = false;
1585 string PropertyTokens;
1587 PropertyNameData = (string*)&DataReceived.begin()->first;
1589 PropertyData = SplitValues(*PropertyNameData);
1591 for(map<string,string>::iterator iter = PropertyData.begin();
1592 iter != PropertyData.end(); iter++){
1594 if (iter->first == "ALTREP"){
1596 NewAlarmData.DescriptionAltRep = iter->second;
1598 } else if (iter->first == "LANGUAGE"){
1600 NewAlarmData.DescriptionLanguage = iter->second;
1604 if (TokenData == false){
1607 PropertyTokens += ";";
1610 PropertyTokens += iter->first;
1611 PropertyTokens += "=";
1612 PropertyTokens += iter->second;
1618 if (PropertyTokens.size() > 0){
1619 NewAlarmData.DescriptionTokens = PropertyTokens;
1622 NewAlarmData.DescriptionData = DataReceived.begin()->second;
1623 AlarmDescriptionFound = true;
1627 // Process data from SUMMARY.
1629 DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "SUMMARY");
1631 if (DataReceived.begin() != DataReceived.end() &&
1632 NewAlarmData.AlarmType == CALENDARALARM_EMAIL){
1634 bool TokenData = false;
1635 string PropertyTokens;
1637 PropertyNameData = (string*)&DataReceived.begin()->first;
1639 PropertyData = SplitValues(*PropertyNameData);
1641 for(map<string,string>::iterator iter = PropertyData.begin();
1642 iter != PropertyData.end(); iter++){
1644 if (iter->first == "ALTREP"){
1646 NewAlarmData.SummaryAltRep = iter->second;
1648 } else if (iter->first == "LANGUAGE"){
1650 NewAlarmData.SummaryLanguage = iter->second;
1654 if (TokenData == false){
1657 PropertyTokens += ";";
1660 PropertyTokens += iter->first;
1661 PropertyTokens += "=";
1662 PropertyTokens += iter->second;
1668 if (PropertyTokens.size() > 0){
1669 NewAlarmData.SummaryTokens = PropertyTokens;
1672 NewAlarmData.SummaryData = DataReceived.begin()->second;
1673 AlarmSummaryFound = true;
1677 // Process data from DURATION.
1679 DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "DURATION");
1681 if (DataReceived.begin() != DataReceived.end()){
1684 NewAlarmData.DurationTokens = DataReceived.begin()->first.substr(9);
1687 catch(const out_of_range &oor){
1688 // Do nothing as there is no data.
1691 NewAlarmData.DurationData = DataReceived.begin()->second;
1692 AlarmDurationFound = true;
1696 // Process data from REPEAT.
1698 DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "REPEAT");
1700 if (DataReceived.begin() != DataReceived.end() && AlarmDurationFound == true){
1703 NewAlarmData.RepeatTokens = DataReceived.begin()->first.substr(7);
1706 catch(const out_of_range &oor){
1707 // Do nothing as there is no data.
1710 NewAlarmData.RepeatData = DataReceived.begin()->second;
1714 NewAlarmData.DurationData.clear();
1715 NewAlarmData.DurationTokens.clear();
1719 // Process data from ATTENDEE.
1721 DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], true, "ATTENDEE");
1723 ObjectSeekCount = 0;
1725 for(multimap<string,string>::iterator iter = DataReceived.begin();
1726 iter != DataReceived.end();
1729 NewAlarmData.AttendeeListMember.push_back("");
1730 NewAlarmData.AttendeeListDelegatedFrom.push_back("");
1731 NewAlarmData.AttendeeListDelegatedTo.push_back("");
1732 NewAlarmData.AttendeeListRole.push_back("");
1733 NewAlarmData.AttendeeListRSVP.push_back("");
1734 NewAlarmData.AttendeeListDirectoryEntry.push_back("");
1735 NewAlarmData.AttendeeListSentBy.push_back("");
1736 NewAlarmData.AttendeeListCommonName.push_back("");
1737 NewAlarmData.AttendeeListCalendarUserType.push_back("");
1738 NewAlarmData.AttendeeListParticipationStatus.push_back("");
1739 NewAlarmData.AttendeeListLanguage.push_back("");
1740 NewAlarmData.AttendeeListTokens.push_back("");
1741 NewAlarmData.AttendeeList.push_back("");
1743 bool TokenData = false;
1744 string PropertyTokens;
1746 PropertyNameData = (string*)&iter->first;
1748 PropertyData = SplitValues(*PropertyNameData);
1750 for(map<string,string>::iterator dataiter = PropertyData.begin();
1751 dataiter != PropertyData.end(); dataiter++){
1753 if (dataiter->first == "CUTYPE"){
1755 NewAlarmData.AttendeeListCalendarUserType[ObjectSeekCount] = dataiter->second;
1757 } else if (dataiter->first == "MEMBER"){
1759 NewAlarmData.AttendeeListMember[ObjectSeekCount] = dataiter->second;
1761 } else if (dataiter->first == "ROLE"){
1763 NewAlarmData.AttendeeListRole[ObjectSeekCount] = dataiter->second;
1765 } else if (dataiter->first == "PARTSTAT"){
1767 NewAlarmData.AttendeeListParticipationStatus[ObjectSeekCount] = dataiter->second;
1769 } else if (dataiter->first == "RSVP"){
1771 NewAlarmData.AttendeeListRSVP[ObjectSeekCount] = dataiter->second;
1773 } else if (dataiter->first == "DELEGATED-TO"){
1775 NewAlarmData.AttendeeListDelegatedTo[ObjectSeekCount] = dataiter->second;
1777 } else if (dataiter->first == "DELEGATED-FROM"){
1779 NewAlarmData.AttendeeListDelegatedFrom[ObjectSeekCount] = dataiter->second;
1781 } else if (dataiter->first == "SENT-BY"){
1783 NewAlarmData.AttendeeListSentBy[ObjectSeekCount] = dataiter->second;
1785 } else if (dataiter->first == "CN"){
1787 NewAlarmData.AttendeeListCommonName[ObjectSeekCount] = dataiter->second;
1789 } else if (dataiter->first == "DIR"){
1791 NewAlarmData.AttendeeListDirectoryEntry[ObjectSeekCount] = dataiter->second;
1793 } else if (dataiter->first == "LANGUAGE"){
1795 NewAlarmData.AttendeeListLanguage[ObjectSeekCount] = dataiter->second;
1799 if (TokenData == false){
1802 PropertyTokens += ";";
1805 PropertyTokens += dataiter->first;
1806 PropertyTokens += "=";
1807 PropertyTokens += dataiter->second;
1813 if (PropertyTokens.size() > 0){
1814 NewAlarmData.AttendeeListTokens[ObjectSeekCount] = PropertyTokens;
1817 NewAlarmData.AttendeeList[ObjectSeekCount] = iter->second;
1823 // Process data from ATTACH.
1825 DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], true, "ATTACH");
1827 ObjectSeekCount = 0;
1829 for(multimap<string,string>::iterator iter = DataReceived.begin();
1830 iter != DataReceived.end();
1833 NewAlarmData.AttachListEncoding.push_back("");
1834 NewAlarmData.AttachListValue.push_back("");
1835 NewAlarmData.AttachListFormatType.push_back("");
1836 NewAlarmData.AttachListTokens.push_back("");
1837 NewAlarmData.AttachList.push_back("");
1839 bool TokenData = false;
1840 string PropertyTokens;
1842 PropertyNameData = (string*)&iter->first;
1844 PropertyData = SplitValues(*PropertyNameData);
1846 for(map<string,string>::iterator dataiter = PropertyData.begin();
1847 dataiter != PropertyData.end(); dataiter++){
1849 if (dataiter->first == "ENCODING"){
1851 NewAlarmData.AttachListEncoding[ObjectSeekCount] = dataiter->second;
1853 } else if (dataiter->first == "VALUE"){
1855 NewAlarmData.AttachListValue[ObjectSeekCount] = dataiter->second;
1857 } else if (dataiter->first == "FMTTYPE"){
1859 NewAlarmData.AttachListFormatType[ObjectSeekCount] = dataiter->second;
1863 if (TokenData == false){
1866 PropertyTokens += ";";
1869 PropertyTokens += dataiter->first;
1870 PropertyTokens += "=";
1871 PropertyTokens += dataiter->second;
1877 if (PropertyTokens.size() > 0){
1878 NewAlarmData.AttachListTokens[ObjectSeekCount] = PropertyTokens;
1881 NewAlarmData.AttachList[ObjectSeekCount] = iter->second;
1887 // Process data from X-*
1889 AlarmObjectCount = 0;
1891 for(vector<string>::iterator xtokeniter = EventAlarmName[SeekCount].begin();
1892 xtokeniter != EventAlarmName[SeekCount].end(); ++xtokeniter){
1894 bool TokenData = false;
1895 string PropertyTokens;
1897 if (xtokeniter->substr(0,2) == "X-" &&
1898 xtokeniter->size() > 2){
1900 NewAlarmData.XTokensData.push_back(EventAlarmData[SeekCount][AlarmObjectCount]);
1901 NewAlarmData.XTokensDataTokens.push_back(EventAlarmName[SeekCount][AlarmObjectCount]);
1909 if (NewAlarmData.AlarmType == CALENDARALARM_AUDIO &&
1910 AlarmActionFound == true &&
1911 AlarmTriggerFound == true){
1913 CalendarAlarmData.push_back(NewAlarmData);
1915 } else if (NewAlarmData.AlarmType == CALENDARALARM_DISPLAY &&
1916 AlarmActionFound == true &&
1917 AlarmTriggerFound == true &&
1918 AlarmDescriptionFound == true){
1920 CalendarAlarmData.push_back(NewAlarmData);
1922 } else if (NewAlarmData.AlarmType == CALENDARALARM_EMAIL &&
1923 AlarmActionFound == true &&
1924 AlarmTriggerFound == true &&
1925 AlarmDescriptionFound == true &&
1926 AlarmSummaryFound == true){
1928 CalendarAlarmData.push_back(NewAlarmData);
1936 ObjectSeekCount = 0;
1938 // Process data from X-*
1940 for(vector<string>::iterator iter = ObjectName.begin();
1941 iter != ObjectName.end(); ++iter){
1943 bool TokenData = false;
1944 string PropertyTokens;
1946 if (iter->substr(0,2) == "X-" &&
1949 XTokensData.push_back(ObjectData[ObjectSeekCount]);
1950 XTokensDataTokens.push_back(ObjectName[ObjectSeekCount]);