1 // ContactDataObject.cpp - Client Data Object.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book 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 Address Book 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 Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "ContactDataObject.h"
21 ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
23 if (!wxFileExists(Filename)){
25 return CONTACTLOAD_FILEMISSING;
31 if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){
33 return CONTACTLOAD_FILEERROR;
37 // Check that the vCard is a valid vCard 4.0 file.
39 vCard vCard4FormatCheck;
41 vCard4FormatCheck.LoadFile(Filename);
43 if (vCard4FormatCheck.Get("VERSION") != wxT("4.0")){
45 return CONTACTLOAD_FILEINVALIDFORMAT;
49 // Check that the vCard meets the base specification.
51 if (!vCard4FormatCheck.MeetBaseSpecification()){
53 return CONTACTLOAD_FILEBASESPECFAIL;
57 wxStringTokenizer wSTContactFileLines(vCard4FormatCheck.WriteString(), wxT("\r\n"));
59 std::map<int, wxString> ContactFileLines;
61 int ContactLineSeek = 0;
63 while (wSTContactFileLines.HasMoreTokens() == TRUE){
65 wxString ContactLine = wSTContactFileLines.GetNextToken();
66 ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
71 wxString wxSPropertyNextLine;
73 bool ExtraLineSeek = TRUE;
74 bool QuoteMode = FALSE;
75 bool PropertyFind = TRUE;
76 bool KindProcessed = FALSE;
77 bool NameProcessed = FALSE;
78 bool GenderProcessed = FALSE;
79 bool BirthdayProcessed = FALSE;
80 bool AnniversaryProcessed = FALSE;
81 int ContactLineLen = 0;
82 int QuoteBreakPoint = 0;
85 int NicknameCount = 0;
86 int TimeZoneCount = 0;
90 int TelephoneCount = 0;
91 int LanguageCount = 0;
92 int GeographicCount = 0;
97 int OrganisationCount = 0;
99 int CategoryCount = 0;
103 int CalendarCount = 0;
104 int CalendarAddressCount = 0;
105 int FreeBusyAddressCount = 0;
106 wxString ContactLine;
107 wxString PropertyLine;
108 wxString PropertySeg1;
109 wxString PropertySeg2;
110 wxString PropertyNextLine;
113 for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
114 iter != ContactFileLines.end(); ++iter){
116 ExtraLineSeek = TRUE;
122 PropertyLine.Clear();
123 PropertySeg1.Clear();
124 PropertySeg2.Clear();
127 ContactLine = iter->second;
129 while (ExtraLineSeek == TRUE){
131 // Check if there is extra data on the next line
132 // (indicated by space or tab at the start) and add data.
136 if (iter == ContactFileLines.end()){
143 PropertyNextLine = iter->second;
145 if (PropertyNextLine.Mid(0, 1) == wxT(" ") || PropertyNextLine.Mid(0, 1) == wxT("\t")){
147 PropertyNextLine.Remove(0, 1);
148 ContactLine.Append(PropertyNextLine);
153 ExtraLineSeek = FALSE;
159 ContactLineLen = ContactLine.Len();
161 // Make sure we are not in quotation mode.
162 // Make sure colon does not have \ or \\ before it.
164 for (int i = 0; i <= ContactLineLen; i++){
166 if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
168 PropertyFind = FALSE;
170 } else if (PropertyFind == TRUE){
172 Property.Append(ContactLine.Mid(i, 1));
176 if (ContactLine.Mid(i, 1) == wxT("\"")){
178 if (QuoteMode == TRUE){
190 if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
199 // Split that line at the point into two variables (ignore the colon).
201 PropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
202 PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
204 if (Property == wxT("KIND") && KindProcessed == FALSE){
206 ProcessKind(PropertySeg2);
208 } else if (Property == wxT("MEMBER")){
210 ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
213 } else if (Property == wxT("FN")){
215 ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
218 } else if (Property == wxT("N") && NameProcessed == FALSE){
220 ProcessN(PropertySeg1, PropertySeg2);
221 NameProcessed = TRUE;
223 } else if (Property == wxT("NICKNAME")){
225 ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
228 } else if (Property == wxT("GENDER") && GenderProcessed == FALSE){
230 ProcessGender(PropertySeg1, PropertySeg2);
231 GenderProcessed = TRUE;
233 } else if (Property == wxT("BDAY") && BirthdayProcessed == FALSE){
235 ProcessBirthday(PropertySeg1, PropertySeg2);
236 BirthdayProcessed = TRUE;
238 } else if (Property == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
240 ProcessAnniversary(PropertySeg1, PropertySeg2);
241 AnniversaryProcessed = TRUE;
243 } else if (Property == wxT("TZ")){
245 ProcessTimeZone(PropertySeg1, PropertySeg2, &TimeZoneCount);
248 } else if (Property == wxT("ADR")){
250 ProcessAddress(PropertySeg1, PropertySeg2, &AddressCount);
253 } else if (Property == wxT("EMAIL")){
255 ProcessEmail(PropertySeg1, PropertySeg2, &EmailCount);
258 } else if (Property == wxT("IMPP")){
260 ProcessIM(PropertySeg1, PropertySeg2, &IMCount);
263 } else if (Property == wxT("TEL")){
265 ProcessTelephone(PropertySeg1, PropertySeg2, &TelephoneCount);
268 } else if (Property == wxT("LANG")){
270 // See frmContactEditor-LoadLanguage.cpp
272 ProcessLanguage(PropertySeg1, PropertySeg2, &LanguageCount);
275 } else if (Property == wxT("GEO")){
277 // See frmContactEditor-LoadGeo.cpp
279 ProcessGeographic(PropertySeg1, PropertySeg2, &GeographicCount);
282 } else if (Property == wxT("RELATED")){
284 // See fromContactEditor-LoadRelated.cpp
286 ProcessRelated(PropertySeg1, PropertySeg2, &RelatedCount);
289 } else if (Property == wxT("URL")){
291 // See frmContactEditor-LoadURL.cpp
293 ProcessURL(PropertySeg1, PropertySeg2, &URLCount);
296 } else if (Property == wxT("TITLE")) {
298 // See frmContactEditor-LoadTitle.cpp
300 ProcessTitle(PropertySeg1, PropertySeg2, &TitleCount);
303 } else if (Property == wxT("ROLE")) {
305 // See frmContactEditor-LoadTitle.cpp
307 ProcessRole(PropertySeg1, PropertySeg2, &RoleCount);
310 } else if (Property == wxT("ORG")) {
312 // See frmContactEditor-LoadOrg.cpp
314 ProcessOrganisation(PropertySeg1, PropertySeg2, &OrganisationCount);
317 } else if (Property == wxT("NOTE")) {
319 // See frmContactEditor-LoadNote.cpp
321 ProcessNote(PropertySeg1, PropertySeg2, &NoteCount);
324 } else if (Property == wxT("CATEGORIES")) {
326 // See frmContactEditor-LoadCategory.cpp
328 ProcessCategory(PropertySeg1, PropertySeg2, &CategoryCount);
331 } else if (Property == wxT("PHOTO")) {
333 // See frmContactEditor-LoadPhoto.cpp
335 ProcessPhoto(PropertySeg1, PropertySeg2, &PhotoCount);
338 } else if (Property == wxT("LOGO")) {
340 // See frmContactEditor-LoadPhoto.cpp
342 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
345 } else if (Property == wxT("LOGO")) {
347 // See frmContactEditor-LoadPhoto.cpp
349 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
352 } else if (Property == wxT("SOUND")) {
354 // See frmContactEditor-LoadSound.cpp
356 ProcessSound(PropertySeg1, PropertySeg2, &SoundCount);
359 } else if (Property == wxT("CALURI")){
361 // See frmContactEditor-LoadCalendar.cpp
363 ProcessCalendarURI(PropertySeg1, PropertySeg2, &CalendarCount);
366 } else if (Property == wxT("CALADRURI")){
368 ProcessCalendarAddressURI(PropertySeg1, PropertySeg2, &CalendarAddressCount);
369 CalendarAddressCount++;
371 } else if (Property == wxT("FBURL")){
373 // See frmContactEditor-LoadCalendar.cpp
375 ProcessCalendarFreeBusy(PropertySeg1, PropertySeg2, &FreeBusyAddressCount);
376 FreeBusyAddressCount++;
382 return CONTACTLOAD_OK;
386 void ContactDataObject::ProcessKind(wxString KindType){
388 if (KindType == wxT("individual")){
390 ContactKind = CONTACTKIND_INDIVIDUAL;
392 } else if (KindType == wxT("group")){
394 ContactKind = CONTACTKIND_GROUP;
396 } else if (KindType == wxT("org")){
398 ContactKind = CONTACTKIND_ORGANISATION;
400 } else if (KindType == wxT("location")){
402 ContactKind = CONTACTKIND_LOCATION;
406 ContactKind = CONTACTKIND_NONE;
411 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
413 std::map<int, int> SplitPoints;
414 std::map<int, int> SplitLength;
416 int intPrevValue = 8;
420 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
424 wxString PropertyName;
425 wxString PropertyValue;
426 wxString PropertyData;
427 wxString PropertyTokens;
428 std::map<int,int>::iterator SLiter;
429 bool FirstToken = TRUE;
431 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
432 intiter != SplitPoints.end(); ++intiter){
434 SLiter = SplitLength.find(intiter->first);
436 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
438 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
439 PropertyName = PropertyElement.GetNextToken();
440 PropertyValue = PropertyElement.GetNextToken();
442 intPrevValue = intiter->second;
444 CaptureString(&PropertyValue, FALSE);
446 if (PropertyName == wxT("ALTID")){
448 GroupsListAltID.erase(*GroupCount);
449 GroupsListAltID.insert(std::make_pair(*GroupCount, PropertyValue));
451 } else if (PropertyName == wxT("PID")){
453 GroupsListPID.erase(*GroupCount);
454 GroupsListPID.insert(std::make_pair(*GroupCount, PropertyValue));
456 } else if (PropertyName == wxT("PREF")){
458 int PriorityNumber = 0;
459 bool ValidNumber = TRUE;
462 PriorityNumber = std::stoi(PropertyValue.ToStdString());
465 catch(std::invalid_argument &e){
469 if (ValidNumber == TRUE){
471 GroupsListPref.erase(*GroupCount);
472 GroupsListPref.insert(std::make_pair(*GroupCount, PriorityNumber));
476 } else if (PropertyName == wxT("MEDIATYPE")){
478 GroupsListMediaType.erase(*GroupCount);
479 GroupsListMediaType.insert(std::make_pair(*GroupCount, PropertyValue));
481 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
483 if (FirstToken == TRUE){
485 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
490 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
498 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
500 if (!PropertyTokens.IsEmpty()){
502 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
509 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
511 std::map<int, int> SplitPoints;
512 std::map<int, int> SplitLength;
514 int intPrevValue = 4;
518 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
522 wxString PropertyName;
523 wxString PropertyValue;
524 wxString PropertyData;
525 wxString PropertyTokens;
526 std::map<int,int>::iterator SLiter;
527 bool FirstToken = TRUE;
529 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
530 intiter != SplitPoints.end(); ++intiter){
532 SLiter = SplitLength.find(intiter->first);
534 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
536 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
537 PropertyName = PropertyElement.GetNextToken();
538 PropertyValue = PropertyElement.GetNextToken();
540 intPrevValue = intiter->second;
542 CaptureString(&PropertyValue, FALSE);
544 if (PropertyName == wxT("TYPE")){
546 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
547 PropertyValue == wxT("work") ){
549 FullNamesListType.erase(*FNCount);
550 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
554 } else if (PropertyName == wxT("LANGUAGE")){
556 FullNamesListLanguage.erase(*FNCount);
557 FullNamesListLanguage.insert(std::make_pair(*FNCount, PropertyValue));
559 } else if (PropertyName == wxT("ALTID")){
561 FullNamesListAltID.erase(*FNCount);
562 FullNamesListAltID.insert(std::make_pair(*FNCount, PropertyValue));
564 } else if (PropertyName == wxT("PID")){
566 FullNamesListPID.erase(*FNCount);
567 FullNamesListPID.insert(std::make_pair(*FNCount, PropertyValue));
569 } else if (PropertyName == wxT("PREF")){
571 int PriorityNumber = 0;
572 bool ValidNumber = TRUE;
575 PriorityNumber = std::stoi(PropertyValue.ToStdString());
578 catch(std::invalid_argument &e){
582 if (ValidNumber == TRUE){
584 FullNamesListPref.erase(*FNCount);
585 FullNamesListPref.insert(std::make_pair(*FNCount, PriorityNumber));
589 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
591 if (FirstToken == TRUE){
593 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
598 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
606 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
608 if (!PropertyTokens.IsEmpty()){
610 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
616 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
618 std::map<int, int> SplitPoints;
619 std::map<int, int> SplitLength;
621 int intPrevValue = 3;
625 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
629 wxString PropertyName;
630 wxString PropertyValue;
631 wxString PropertyData;
632 wxString PropertyTokens;
633 std::map<int,int>::iterator SLiter;
634 bool FirstToken = TRUE;
636 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
637 intiter != SplitPoints.end(); ++intiter){
639 SLiter = SplitLength.find(intiter->first);
641 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
643 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
644 PropertyName = PropertyElement.GetNextToken();
645 PropertyValue = PropertyElement.GetNextToken();
647 intPrevValue = intiter->second;
649 CaptureString(&PropertyValue, FALSE);
651 if (PropertyName == wxT("ALTID")){
653 NameAltID = PropertyValue;
655 } else if (PropertyName == wxT("LANGUAGE")){
657 NameLanguage = PropertyValue;
659 } else if (PropertyName == wxT("SORT-AS")){
661 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
662 PropertyValue.Len() >= 3){
663 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
666 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
668 if (FirstToken == TRUE){
670 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
675 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
683 // Split the name data.
685 int intSplitSeek = 0;
686 int intSplitsFound = 0;
687 int intSplitSize = 0;
688 int intPropertyLen = PropertySeg2.Len();
690 std::map<int,wxString> NameValues;
693 for (int i = 0; i <= intPropertyLen; i++){
695 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
697 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
702 if (intSplitsFound == 4){
704 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
718 // Split the data into several parts.
720 for (std::map<int, wxString>::iterator iter = NameValues.begin();
721 iter != NameValues.end(); ++iter){
723 if (iter->first == 1){
725 // Deal with family name.
727 NameSurname = iter->second;
729 } else if (iter->first == 2){
731 // Deal with given names.
733 NameForename = iter->second;
735 } else if (iter->first == 3){
737 // Deal with additional names.
739 NameOtherNames = iter->second;
741 } else if (iter->first == 4){
743 // Deal with honorifix prefixes and suffixes.
745 NameTitle = iter->second;
749 if (iter == NameValues.end()){
755 NameSuffix = iter->second;
761 // Add the name token data.
763 if (!PropertyTokens.IsEmpty()){
765 NameTokens = PropertyTokens;
771 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
773 std::map<int, int> SplitPoints;
774 std::map<int, int> SplitLength;
776 int intPrevValue = 10;
779 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
783 PropertyType PropType = PROPERTY_NONE;
785 // Look for type before continuing.
787 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
791 std::map<int, wxString> *NicknamesList = NULL;
792 std::map<int, wxString> *NicknamesListType = NULL;
793 std::map<int, wxString> *NicknamesListLanguage = NULL;
794 std::map<int, wxString> *NicknamesListAltID = NULL;
795 std::map<int, wxString> *NicknamesListPID = NULL;
796 std::map<int, wxString> *NicknamesListTokens = NULL;
797 std::map<int, int> *NicknamesListPref = NULL;
801 NicknamesList = &GeneralNicknamesList;
802 NicknamesListType = &GeneralNicknamesListType;
803 NicknamesListLanguage = &GeneralNicknamesListLanguage;
804 NicknamesListAltID = &GeneralNicknamesListAltID;
805 NicknamesListPID = &GeneralNicknamesListPID;
806 NicknamesListTokens = &GeneralNicknamesListTokens;
807 NicknamesListPref = &GeneralNicknamesListPref;
810 NicknamesList = &HomeNicknamesList;
811 NicknamesListType = &HomeNicknamesListType;
812 NicknamesListLanguage = &HomeNicknamesListLanguage;
813 NicknamesListAltID = &HomeNicknamesListAltID;
814 NicknamesListPID = &HomeNicknamesListPID;
815 NicknamesListTokens = &HomeNicknamesListTokens;
816 NicknamesListPref = &HomeNicknamesListPref;
819 NicknamesList = &BusinessNicknamesList;
820 NicknamesListType = &BusinessNicknamesListType;
821 NicknamesListLanguage = &BusinessNicknamesListLanguage;
822 NicknamesListAltID = &BusinessNicknamesListAltID;
823 NicknamesListPID = &BusinessNicknamesListPID;
824 NicknamesListTokens = &BusinessNicknamesListTokens;
825 NicknamesListPref = &BusinessNicknamesListPref;
829 std::map<int, int>::iterator SLiter;
830 wxString PropertyData;
831 wxString PropertyName;
832 wxString PropertyValue;
833 wxString PropertyTokens;
834 bool FirstToken = TRUE;
836 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
837 intiter != SplitPoints.end(); ++intiter){
839 SLiter = SplitLength.find(intiter->first);
841 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
843 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
844 PropertyName = PropertyElement.GetNextToken();
845 PropertyValue = PropertyElement.GetNextToken();
847 intPrevValue = intiter->second;
849 CaptureString(&PropertyValue, FALSE);
851 if (PropertyName == wxT("ALTID")){
853 NicknamesListAltID->erase(*NicknameCount);
854 NicknamesListAltID->insert(std::make_pair(*NicknameCount, PropertyValue));
856 } else if (PropertyName == wxT("PID")){
858 NicknamesListPID->erase(*NicknameCount);
859 NicknamesListPID->insert(std::make_pair(*NicknameCount, PropertyValue));
861 } else if (PropertyName == wxT("PREF")){
863 int PriorityNumber = 0;
864 bool ValidNumber = TRUE;
867 PriorityNumber = std::stoi(PropertyValue.ToStdString());
870 catch(std::invalid_argument &e){
874 if (ValidNumber == TRUE){
876 NicknamesListPref->erase(*NicknameCount);
877 NicknamesListPref->insert(std::make_pair(*NicknameCount, PriorityNumber));
881 } else if (PropertyName == wxT("LANGUAGE")){
883 NicknamesListLanguage->erase(*NicknameCount);
884 NicknamesListLanguage->insert(std::make_pair(*NicknameCount, PropertyValue));
888 // Something else we don't know about so append
889 // to the tokens variable.
891 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
893 if (FirstToken == TRUE){
895 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
900 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
910 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
912 // Add the name token data.
914 if (!PropertyTokens.IsEmpty()){
916 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
922 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
924 std::map<int, int> SplitPoints;
925 std::map<int, int> SplitLength;
926 std::map<int, int>::iterator SLiter;
927 wxString PropertyData;
928 wxString PropertyName;
929 wxString PropertyValue;
930 wxString PropertyTokens;
931 bool FirstToken = TRUE;
932 int intPrevValue = 8;
934 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
938 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
939 intiter != SplitPoints.end(); ++intiter){
941 SLiter = SplitLength.find(intiter->first);
943 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
945 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
946 PropertyName = PropertyElement.GetNextToken();
947 PropertyValue = PropertyElement.GetNextToken();
949 intPrevValue = intiter->second;
951 // Process properties.
953 size_t intPropertyValueLen = PropertyValue.Len();
955 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
957 PropertyValue.Trim();
958 PropertyValue.RemoveLast();
962 if (PropertyValue.Mid(0, 1) == wxT("\"")){
964 PropertyValue.Remove(0, 1);
968 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
970 if (FirstToken == TRUE){
972 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
977 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
985 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
987 wxString GenderComponent;
989 if (GenderData.CountTokens() >= 2){
991 Gender = GenderData.GetNextToken();
992 GenderDetails = GenderData.GetString();
994 CaptureString(&GenderDetails, FALSE);
998 Gender = GenderData.GetNextToken();
1002 if (!PropertyTokens.IsEmpty()){
1004 GenderTokens = PropertyTokens;
1010 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1012 // Process date. Preserve the remainder in the string.
1014 std::map<int, int> SplitPoints;
1015 std::map<int, int> SplitLength;
1016 std::map<int, int>::iterator SLiter;
1017 wxString PropertyData;
1018 wxString PropertyName;
1019 wxString PropertyValue;
1020 wxString PropertyTokens;
1021 bool BirthdayText = FALSE;
1022 int intPrevValue = 6;
1024 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1028 // Look for type before continuing.
1030 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1031 intiter != SplitPoints.end(); ++intiter){
1033 SLiter = SplitLength.find(intiter->first);
1035 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1037 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1038 PropertyName = PropertyElement.GetNextToken();
1039 PropertyValue = PropertyElement.GetNextToken();
1041 intPrevValue = intiter->second;
1043 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1045 CaptureString(&PropertySeg2, FALSE);
1046 Birthday = PropertySeg2;
1047 BirthdayText = TRUE;
1053 // Setup blank lines for later on.
1056 bool FirstToken = TRUE;
1058 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1059 intiter != SplitPoints.end(); ++intiter){
1061 SLiter = SplitLength.find(intiter->first);
1063 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1065 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1066 PropertyName = PropertyElement.GetNextToken();
1067 PropertyValue = PropertyElement.GetNextToken();
1069 intPrevValue = intiter->second;
1071 // Process properties.
1073 CaptureString(&PropertyValue, FALSE);
1075 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1077 PropertyValue.Trim();
1078 PropertyValue.RemoveLast();
1082 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1084 PropertyValue.Remove(0, 1);
1088 if (PropertyName == wxT("ALTID")){
1090 BirthdayAltID = PropertyValue;
1092 } else if (PropertyName == wxT("CALSCALE")){
1094 BirthdayCalScale = PropertyValue;
1096 } else if (PropertyName != wxT("VALUE")) {
1098 // Something else we don't know about so append
1099 // to the tokens variable.
1101 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1103 if (FirstToken == TRUE){
1105 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1110 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1120 // Add the data to the variables and form.
1122 if (BirthdayText == FALSE){
1124 Birthday = PropertySeg2;
1128 if (!PropertyTokens.IsEmpty()){
1130 BirthdayTokens = PropertyTokens;
1136 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1138 // Process date. Preserve the remainder in the string.
1140 std::map<int, int> SplitPoints;
1141 std::map<int, int> SplitLength;
1142 std::map<int, int>::iterator SLiter;
1143 wxString PropertyData;
1144 wxString PropertyName;
1145 wxString PropertyValue;
1146 wxString PropertyTokens;
1147 bool AnniversaryText = FALSE;
1148 int intPrevValue = 13;
1150 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1154 // Look for type before continuing.
1156 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1157 intiter != SplitPoints.end(); ++intiter){
1159 SLiter = SplitLength.find(intiter->first);
1161 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1163 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1164 PropertyName = PropertyElement.GetNextToken();
1165 PropertyValue = PropertyElement.GetNextToken();
1167 intPrevValue = intiter->second;
1169 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1171 CaptureString(&PropertySeg2, FALSE);
1172 Anniversary = PropertySeg2;
1173 AnniversaryText = TRUE;
1179 // Setup blank lines for later on.
1182 bool FirstToken = TRUE;
1184 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1185 intiter != SplitPoints.end(); ++intiter){
1187 SLiter = SplitLength.find(intiter->first);
1189 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1191 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1192 PropertyName = PropertyElement.GetNextToken();
1193 PropertyValue = PropertyElement.GetNextToken();
1195 intPrevValue = intiter->second;
1197 // Process properties.
1199 CaptureString(&PropertyValue, FALSE);
1201 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1203 PropertyValue.Trim();
1204 PropertyValue.RemoveLast();
1208 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1210 PropertyValue.Remove(0, 1);
1214 if (PropertyName == wxT("ALTID")){
1216 AnniversaryAltID = PropertyValue;
1218 } else if (PropertyName == wxT("CALSCALE")){
1220 AnniversaryCalScale = PropertyValue;
1222 } else if (PropertyName != wxT("VALUE")) {
1224 // Something else we don't know about so append
1225 // to the tokens variable.
1227 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1229 if (FirstToken == TRUE){
1231 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1236 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1246 // Add the data to the variables and form.
1248 if (AnniversaryText == FALSE){
1250 Anniversary = PropertySeg2;
1254 if (!PropertyTokens.IsEmpty()){
1256 AnniversaryTokens = PropertyTokens;
1262 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1264 std::map<int, int> SplitPoints;
1265 std::map<int, int> SplitLength;
1267 int intPrevValue = 4;
1270 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1274 PropertyType PropType = PROPERTY_NONE;
1276 // Look for type before continuing.
1278 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1282 std::map<int, wxString> *TZList = NULL;
1283 std::map<int, wxString> *TZListType = NULL;
1284 std::map<int, wxString> *TZListMediatype = NULL;
1285 std::map<int, wxString> *TZListAltID = NULL;
1286 std::map<int, wxString> *TZListPID = NULL;
1287 std::map<int, wxString> *TZListTokens = NULL;
1288 std::map<int, int> *TZListPref = NULL;
1292 TZList = &GeneralTZList;
1293 TZListType = &GeneralTZListType;
1294 TZListMediatype = &GeneralTZListMediatype;
1295 TZListAltID = &GeneralTZListAltID;
1296 TZListPID = &GeneralTZListPID;
1297 TZListTokens = &GeneralTZListTokens;
1298 TZListPref = &GeneralTZListPref;
1301 TZList = &HomeTZList;
1302 TZListType = &HomeTZListType;
1303 TZListMediatype = &HomeTZListMediatype;
1304 TZListAltID = &HomeTZListAltID;
1305 TZListPID = &HomeTZListPID;
1306 TZListTokens = &HomeTZListTokens;
1307 TZListPref = &HomeTZListPref;
1310 TZList = &BusinessTZList;
1311 TZListType = &BusinessTZListType;
1312 TZListMediatype = &BusinessTZListMediatype;
1313 TZListAltID = &BusinessTZListAltID;
1314 TZListPID = &BusinessTZListPID;
1315 TZListTokens = &BusinessTZListTokens;
1316 TZListPref = &BusinessTZListPref;
1320 std::map<int, int>::iterator SLiter;
1321 wxString PropertyData;
1322 wxString PropertyName;
1323 wxString PropertyValue;
1324 wxString PropertyTokens;
1325 bool FirstToken = TRUE;
1327 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1328 intiter != SplitPoints.end(); ++intiter){
1330 SLiter = SplitLength.find(intiter->first);
1332 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1334 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1335 PropertyName = PropertyElement.GetNextToken();
1336 PropertyValue = PropertyElement.GetNextToken();
1338 intPrevValue = intiter->second;
1340 CaptureString(&PropertyValue, FALSE);
1342 if (PropertyName == wxT("ALTID")){
1344 TZListAltID->erase(*TimeZoneCount);
1345 TZListAltID->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1347 } else if (PropertyName == wxT("PID")){
1349 TZListPID->erase(*TimeZoneCount);
1350 TZListPID->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1352 } else if (PropertyName == wxT("PREF")){
1354 int PriorityNumber = 0;
1355 bool ValidNumber = TRUE;
1358 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1361 catch(std::invalid_argument &e){
1362 ValidNumber = FALSE;
1365 if (ValidNumber == TRUE){
1367 TZListPref->erase(*TimeZoneCount);
1368 TZListPref->insert(std::make_pair(*TimeZoneCount, PriorityNumber));
1372 } else if (PropertyName == wxT("MEDIATYPE")){
1374 TZListMediatype->erase(*TimeZoneCount);
1375 TZListMediatype->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1379 // Something else we don't know about so append
1380 // to the tokens variable.
1382 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1384 if (FirstToken == TRUE){
1386 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1391 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1401 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1403 // Add the name token data.
1405 if (!PropertyTokens.IsEmpty()){
1407 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1414 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1416 size_t intPropertyLen = PropertySeg1.Len();
1417 std::map<int, int> SplitPoints;
1418 std::map<int, int> SplitLength;
1419 std::map<int, int>::iterator SLiter;
1420 wxString PropertyData;
1421 wxString PropertyName;
1422 wxString PropertyValue;
1423 wxString PropertyTokens;
1424 wxString AddressLabel;
1425 wxString AddressLang;
1426 wxString AddressAltID;
1427 wxString AddressPID;
1428 wxString AddressTokens;
1429 wxString AddressGeo;
1430 wxString AddressTimezone;
1431 wxString AddressType;
1432 wxString AddressMediatype;
1433 wxString AddressPOBox;
1434 wxString AddressExtended;
1435 wxString AddressStreet;
1436 wxString AddressLocality;
1437 wxString AddressCity;
1438 wxString AddressRegion;
1439 wxString AddressPostalCode;
1440 wxString AddressCountry;
1441 bool FirstToken = TRUE;
1442 int intSplitsFound = 0;
1443 int intSplitSize = 0;
1444 int intPrevValue = 5;
1449 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1453 PropertyType PropType = PROPERTY_NONE;
1455 // Look for type before continuing.
1457 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1461 std::map<int, wxString> *AddressList = NULL;
1462 std::map<int, wxString> *AddressListTown = NULL;
1463 std::map<int, wxString> *AddressListCounty = NULL;
1464 std::map<int, wxString> *AddressListPostCode = NULL;
1465 std::map<int, wxString> *AddressListCountry = NULL;
1466 std::map<int, wxString> *AddressListLabel = NULL;
1467 std::map<int, wxString> *AddressListLang = NULL;
1468 std::map<int, wxString> *AddressListAltID = NULL;
1469 std::map<int, wxString> *AddressListPID = NULL;
1470 std::map<int, wxString> *AddressListTokens = NULL;
1471 std::map<int, wxString> *AddressListGeo = NULL;
1472 std::map<int, wxString> *AddressListTimezone = NULL;
1473 std::map<int, wxString> *AddressListType = NULL;
1474 std::map<int, wxString> *AddressListMediatype = NULL;
1475 std::map<int, int> *AddressListPref = NULL;
1479 AddressList = &GeneralAddressList;
1480 AddressListTown = &GeneralAddressListTown;
1481 AddressListCounty = &GeneralAddressListCounty;
1482 AddressListPostCode = &GeneralAddressListPostCode;
1483 AddressListCountry = &GeneralAddressListCountry;
1484 AddressListLabel = &GeneralAddressListLabel;
1485 AddressListLang = &GeneralAddressListLang;
1486 AddressListAltID = &GeneralAddressListAltID;
1487 AddressListPID = &GeneralAddressListPID;
1488 AddressListTokens = &GeneralAddressListTokens;
1489 AddressListGeo = &GeneralAddressListGeo;
1490 AddressListTimezone = &GeneralAddressListTimezone;
1491 AddressListType = &GeneralAddressListType;
1492 AddressListMediatype = &GeneralAddressListMediatype;
1493 AddressListPref = &GeneralAddressListPref;
1496 AddressList = &HomeAddressList;
1497 AddressListTown = &HomeAddressListTown;
1498 AddressListCounty = &HomeAddressListCounty;
1499 AddressListPostCode = &HomeAddressListPostCode;
1500 AddressListCountry = &HomeAddressListCountry;
1501 AddressListLabel = &HomeAddressListLabel;
1502 AddressListLang = &HomeAddressListLang;
1503 AddressListAltID = &HomeAddressListAltID;
1504 AddressListPID = &HomeAddressListPID;
1505 AddressListTokens = &HomeAddressListTokens;
1506 AddressListGeo = &HomeAddressListGeo;
1507 AddressListTimezone = &HomeAddressListTimezone;
1508 AddressListType = &HomeAddressListType;
1509 AddressListMediatype = &HomeAddressListMediatype;
1510 AddressListPref = &HomeAddressListPref;
1513 AddressList = &BusinessAddressList;
1514 AddressListTown = &BusinessAddressListTown;
1515 AddressListCounty = &BusinessAddressListCounty;
1516 AddressListPostCode = &BusinessAddressListPostCode;
1517 AddressListCountry = &BusinessAddressListCountry;
1518 AddressListLabel = &BusinessAddressListLabel;
1519 AddressListLang = &BusinessAddressListLang;
1520 AddressListAltID = &BusinessAddressListAltID;
1521 AddressListPID = &BusinessAddressListPID;
1522 AddressListTokens = &BusinessAddressListTokens;
1523 AddressListGeo = &BusinessAddressListGeo;
1524 AddressListTimezone = &BusinessAddressListTimezone;
1525 AddressListType = &BusinessAddressListType;
1526 AddressListMediatype = &BusinessAddressListMediatype;
1527 AddressListPref = &BusinessAddressListPref;
1533 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1534 intiter != SplitPoints.end(); ++intiter){
1536 SLiter = SplitLength.find(intiter->first);
1538 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1540 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1541 PropertyName = PropertyElement.GetNextToken();
1542 PropertyValue = PropertyElement.GetNextToken();
1544 intPrevValue = intiter->second;
1546 CaptureString(&PropertyValue, FALSE);
1548 // Process properties.
1550 if (PropertyName == wxT("LABEL")){
1552 AddressListLabel->erase(*AddressCount);
1553 AddressListLabel->insert(std::make_pair(*AddressCount, PropertyValue));
1555 } else if (PropertyName == wxT("LANGUAGE")){
1557 AddressListLang->erase(*AddressCount);
1558 AddressListLang->insert(std::make_pair(*AddressCount, PropertyValue));
1560 } else if (PropertyName == wxT("ALTID")){
1562 AddressListAltID->erase(*AddressCount);
1563 AddressListAltID->insert(std::make_pair(*AddressCount, PropertyValue));
1565 } else if (PropertyName == wxT("PID")){
1567 AddressListPID->erase(*AddressCount);
1568 AddressListPID->insert(std::make_pair(*AddressCount, PropertyValue));
1570 } else if (PropertyName == wxT("GEO")){
1572 AddressListGeo->erase(*AddressCount);
1573 AddressListGeo->insert(std::make_pair(*AddressCount, PropertyValue));
1575 } else if (PropertyName == wxT("TZ")){
1577 AddressListTimezone->erase(*AddressCount);
1578 AddressListTimezone->insert(std::make_pair(*AddressCount, PropertyValue));
1580 } else if (PropertyName == wxT("MEDIATYPE")){
1582 AddressListMediatype->erase(*AddressCount);
1583 AddressListMediatype->insert(std::make_pair(*AddressCount, PropertyValue));
1585 } else if (PropertyName == wxT("PREF")){
1587 int PriorityNumber = 0;
1588 bool ValidNumber = TRUE;
1591 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1594 catch(std::invalid_argument &e){
1595 ValidNumber = FALSE;
1598 if (ValidNumber == TRUE){
1600 AddressListPref->erase(*AddressCount);
1601 AddressListPref->insert(std::make_pair(*AddressCount, PriorityNumber));
1607 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1609 if (FirstToken == TRUE){
1611 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1616 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1626 // Split the address.
1628 //std::map<int, int>::iterator SLiter;
1629 intPropertyLen = PropertySeg2.Len();
1630 SplitPoints.clear();
1631 SplitLength.clear();
1636 for (int i = 0; i <= intPropertyLen; i++){
1640 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1643 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1645 if (intSplitsFound == 6){
1647 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1652 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1662 // Split the data into several parts.
1664 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1665 intiter != SplitPoints.end(); ++intiter){
1667 if (intiter->first == 1){
1669 // Deal with PO Box.
1671 SLiter = SplitLength.find(1);
1673 //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
1674 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1675 intPrevValue = intiter->second;
1677 } else if (intiter->first == 2){
1679 // Deal with extended address.
1681 SLiter = SplitLength.find(2);
1683 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1684 //txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1685 intPrevValue = intiter->second;
1687 } else if (intiter->first == 3){
1689 // Deal with street address.
1691 SLiter = SplitLength.find(3);
1693 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1694 //txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1695 intPrevValue = intiter->second;
1697 } else if (intiter->first == 4){
1699 // Deal with locality
1701 SLiter = SplitLength.find(4);
1703 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1704 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1705 intPrevValue = intiter->second;
1707 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1709 } else if (intiter->first == 5){
1711 // Deal with region.
1713 SLiter = SplitLength.find(5);
1715 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1716 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1717 intPrevValue = intiter->second;
1719 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1721 } else if (intiter->first == 6){
1723 // Deal with post code.
1725 SLiter = SplitLength.find(6);
1727 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1728 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1729 intPrevValue = intiter->second;
1731 // Deal with country.
1733 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1734 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1742 // Add the data to the General/Home/Work address variables.
1744 CaptureString(&AddressStreet, FALSE);
1745 CaptureString(&AddressLocality, FALSE);
1746 CaptureString(&AddressRegion, FALSE);
1747 CaptureString(&AddressPostalCode, FALSE);
1748 CaptureString(&AddressCountry, FALSE);
1750 if (!PropertyTokens.IsEmpty()){
1752 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1756 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1757 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1758 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1759 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1760 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1764 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1767 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1770 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1774 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1778 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1780 std::map<int, int> SplitPoints;
1781 std::map<int, int> SplitLength;
1783 int intPrevValue = 7;
1786 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1790 PropertyType PropType = PROPERTY_NONE;
1792 // Look for type before continuing.
1794 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1796 std::map<int, wxString> *EmailList = NULL;
1797 std::map<int, wxString> *EmailListType = NULL;
1798 std::map<int, wxString> *EmailListAltID = NULL;
1799 std::map<int, wxString> *EmailListPID = NULL;
1800 std::map<int, wxString> *EmailListTokens = NULL;
1801 std::map<int, int> *EmailListPref = NULL;
1805 EmailList = &GeneralEmailList;
1806 EmailListType = &GeneralEmailListType;
1807 EmailListAltID = &GeneralEmailListAltID;
1808 EmailListPID = &GeneralEmailListPID;
1809 EmailListTokens = &GeneralEmailListTokens;
1810 EmailListPref = &GeneralEmailListPref;
1813 EmailList = &HomeEmailList;
1814 EmailListType = &HomeEmailListType;
1815 EmailListAltID = &HomeEmailListAltID;
1816 EmailListPID = &HomeEmailListPID;
1817 EmailListTokens = &HomeEmailListTokens;
1818 EmailListPref = &HomeEmailListPref;
1821 EmailList = &BusinessEmailList;
1822 EmailListType = &BusinessEmailListType;
1823 EmailListAltID = &BusinessEmailListAltID;
1824 EmailListPID = &BusinessEmailListPID;
1825 EmailListTokens = &BusinessEmailListTokens;
1826 EmailListPref = &BusinessEmailListPref;
1832 std::map<int,int>::iterator SLiter;
1833 wxString PropertyData;
1834 wxString PropertyName;
1835 wxString PropertyValue;
1836 wxString PropertyTokens;
1837 bool FirstToken = TRUE;
1839 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1840 intiter != SplitPoints.end(); ++intiter){
1842 SLiter = SplitLength.find(intiter->first);
1844 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1846 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1847 PropertyName = PropertyElement.GetNextToken();
1848 PropertyValue = PropertyElement.GetNextToken();
1850 intPrevValue = intiter->second;
1852 CaptureString(&PropertyValue, FALSE);
1854 // Process properties.
1856 if (PropertyName == wxT("ALTID")){
1858 EmailListAltID->erase(*EmailCount);
1859 EmailListAltID->insert(std::make_pair(*EmailCount, PropertyValue));
1861 } else if (PropertyName == wxT("PID")){
1863 EmailListPID->erase(*EmailCount);
1864 EmailListPID->insert(std::make_pair(*EmailCount, PropertyValue));
1866 } else if (PropertyName == wxT("PREF")){
1868 int PriorityNumber = 0;
1869 bool ValidNumber = TRUE;
1872 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1875 catch(std::invalid_argument &e){
1876 ValidNumber = FALSE;
1879 if (ValidNumber == TRUE){
1881 EmailListPref->erase(*EmailCount);
1882 EmailListPref->insert(std::make_pair(*EmailCount, PriorityNumber));
1888 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1890 if (FirstToken == TRUE){
1892 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1897 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1907 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1909 // Add the name token data.
1911 if (!PropertyTokens.IsEmpty()){
1913 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1920 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1922 std::map<int, int> SplitPoints;
1923 std::map<int, int> SplitLength;
1925 int intPrevValue = 6;
1928 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1932 PropertyType PropType = PROPERTY_NONE;
1934 // Look for type before continuing.
1936 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1938 std::map<int, wxString> *IMList = NULL;
1939 std::map<int, wxString> *IMListType = NULL;
1940 std::map<int, wxString> *IMListAltID = NULL;
1941 std::map<int, wxString> *IMListPID = NULL;
1942 std::map<int, wxString> *IMListTokens = NULL;
1943 std::map<int, wxString> *IMListMediatype = NULL;
1944 std::map<int, int> *IMListPref = NULL;
1948 IMList = &GeneralIMList;
1949 IMListType = &GeneralIMListType;
1950 IMListAltID = &GeneralIMListAltID;
1951 IMListPID = &GeneralIMListPID;
1952 IMListTokens = &GeneralIMListTokens;
1953 IMListMediatype = &GeneralIMListMediatype;
1954 IMListPref = &GeneralIMListPref;
1957 IMList = &HomeIMList;
1958 IMListType = &HomeIMListType;
1959 IMListAltID = &HomeIMListAltID;
1960 IMListPID = &HomeIMListPID;
1961 IMListTokens = &HomeIMListTokens;
1962 IMListMediatype = &HomeIMListMediatype;
1963 IMListPref = &HomeIMListPref;
1966 IMList = &BusinessIMList;
1967 IMListType = &BusinessIMListType;
1968 IMListAltID = &BusinessIMListAltID;
1969 IMListPID = &BusinessIMListPID;
1970 IMListTokens = &BusinessIMListTokens;
1971 IMListMediatype = &BusinessIMListMediatype;
1972 IMListPref = &BusinessIMListPref;
1978 std::map<int,int>::iterator SLiter;
1979 wxString PropertyData;
1980 wxString PropertyName;
1981 wxString PropertyValue;
1982 wxString PropertyTokens;
1983 bool FirstToken = TRUE;
1985 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1986 intiter != SplitPoints.end(); ++intiter){
1988 SLiter = SplitLength.find(intiter->first);
1990 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1992 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1993 PropertyName = PropertyElement.GetNextToken();
1994 PropertyValue = PropertyElement.GetNextToken();
1996 intPrevValue = intiter->second;
1998 CaptureString(&PropertyValue, FALSE);
2000 // Process properties.
2002 if (PropertyName == wxT("ALTID")){
2004 IMListAltID->erase(*IMCount);
2005 IMListAltID->insert(std::make_pair(*IMCount, PropertyValue));
2007 } else if (PropertyName == wxT("PID")){
2009 IMListPID->erase(*IMCount);
2010 IMListPID->insert(std::make_pair(*IMCount, PropertyValue));
2012 } else if (PropertyName == wxT("MEDIATYPE")){
2014 IMListMediatype->erase(*IMCount);
2015 IMListMediatype->insert(std::make_pair(*IMCount, PropertyValue));
2017 } else if (PropertyName == wxT("PREF")){
2019 int PriorityNumber = 0;
2020 bool ValidNumber = TRUE;
2023 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2026 catch(std::invalid_argument &e){
2027 ValidNumber = FALSE;
2030 if (ValidNumber == TRUE){
2032 IMListPref->erase(*IMCount);
2033 IMListPref->insert(std::make_pair(*IMCount, PriorityNumber));
2039 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2041 if (FirstToken == TRUE){
2043 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2048 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2058 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2060 // Add the name token data.
2062 if (!PropertyTokens.IsEmpty()){
2064 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2070 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2072 std::map<int, int> SplitPoints;
2073 std::map<int, int> SplitLength;
2074 std::map<int, int>::iterator SLiter;
2078 PropertyType PropType = PROPERTY_NONE;
2080 // Look for type before continuing.
2083 wxString TelTypeDetail;
2084 wxString PropertyData;
2085 wxString PropertyName;
2086 wxString PropertyValue;
2087 wxString PropertyTokens;
2089 std::map<int,int> TypeSplitPoints;
2090 std::map<int,int> TypeSplitLength;
2091 std::map<int,int>::iterator TSLiter;
2093 int intSplitSize = 0;
2094 int intSplitsFound = 0;
2095 int intSplitPoint = 0;
2097 int intPrevValue = 5;
2099 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2103 // Look for type before continuing.
2105 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2106 intiter != SplitPoints.end(); ++intiter){
2108 SLiter = SplitLength.find(intiter->first);
2110 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2112 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2113 PropertyName = PropertyElement.GetNextToken();
2114 PropertyValue = PropertyElement.GetNextToken();
2116 intPrevValue = intiter->second;
2118 if (PropertyName == wxT("TYPE")){
2120 // Process each value in type and translate each
2123 // Strip out the quotes if they are there.
2125 size_t intPropertyValueLen = PropertyValue.Len();
2127 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2129 PropertyValue.Trim();
2130 PropertyValue.RemoveLast();
2134 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2136 PropertyValue.Remove(0, 1);
2140 TelTypeDetail = PropertyValue;
2146 for (int i = 0; i <= intPropertyValueLen; i++){
2150 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2152 if (intSplitsFound == 0){
2154 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2155 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2159 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2160 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2173 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2174 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2176 int intTypeSeek = 0;
2178 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2179 typeiter != TypeSplitPoints.end(); ++typeiter){
2181 wxString TypePropertyName;
2183 TSLiter = TypeSplitLength.find(typeiter->first);
2185 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2187 if (intTypeSeek == 0){
2192 TelTypeUI.Append(wxT(","));
2196 if (TypePropertyName == wxT("home")){
2198 PropType = PROPERTY_HOME;
2200 } else if (TypePropertyName == wxT("work")){
2202 PropType = PROPERTY_WORK;
2207 if (TypePropertyName == wxT("text")){
2209 TelTypeUI.Append(_("text"));
2212 } else if (TypePropertyName == wxT("voice")){
2214 TelTypeUI.Append(_("voice"));
2217 } else if (TypePropertyName == wxT("fax")){
2219 TelTypeUI.Append(_("fax"));
2222 } else if (TypePropertyName == wxT("cell")){
2224 TelTypeUI.Append(_("mobile"));
2227 } else if (TypePropertyName == wxT("video")){
2229 TelTypeUI.Append(_("video"));
2232 } else if (TypePropertyName == wxT("pager")){
2234 TelTypeUI.Append(_("pager"));
2237 } else if (TypePropertyName == wxT("textphone")){
2239 TelTypeUI.Append(_("textphone"));
2250 std::map<int, wxString> *TelephoneList = NULL;
2251 std::map<int, wxString> *TelephoneListType = NULL;
2252 std::map<int, wxString> *TelephoneListAltID = NULL;
2253 std::map<int, wxString> *TelephoneListPID = NULL;
2254 std::map<int, wxString> *TelephoneListTokens = NULL;
2255 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2256 std::map<int, int> *TelephoneListPref = NULL;
2260 TelephoneList = &GeneralTelephoneList;
2261 TelephoneListType = &GeneralTelephoneListType;
2262 TelephoneListAltID = &GeneralTelephoneListAltID;
2263 TelephoneListPID = &GeneralTelephoneListPID;
2264 TelephoneListTokens = &GeneralTelephoneListTokens;
2265 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2266 TelephoneListPref = &GeneralTelephoneListPref;
2269 TelephoneList = &HomeTelephoneList;
2270 TelephoneListType = &HomeTelephoneListType;
2271 TelephoneListAltID = &HomeTelephoneListAltID;
2272 TelephoneListPID = &HomeTelephoneListPID;
2273 TelephoneListTokens = &HomeTelephoneListTokens;
2274 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2275 TelephoneListPref = &HomeTelephoneListPref;
2278 TelephoneList = &BusinessTelephoneList;
2279 TelephoneListType = &BusinessTelephoneListType;
2280 TelephoneListAltID = &BusinessTelephoneListAltID;
2281 TelephoneListPID = &BusinessTelephoneListPID;
2282 TelephoneListTokens = &BusinessTelephoneListTokens;
2283 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2284 TelephoneListPref = &BusinessTelephoneListPref;
2288 // Process the properties.
2290 bool FirstToken = TRUE;
2293 SplitPoints.clear();
2294 SplitLength.clear();
2296 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2300 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2301 intiter != SplitPoints.end(); ++intiter){
2303 SLiter = SplitLength.find(intiter->first);
2305 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2307 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2308 PropertyName = PropertyElement.GetNextToken();
2309 PropertyValue = PropertyElement.GetNextToken();
2311 intPrevValue = intiter->second;
2313 CaptureString(&PropertyValue, FALSE);
2315 // Process properties.
2317 if (PropertyName == wxT("ALTID")){
2319 TelephoneListAltID->erase(*TelephoneCount);
2320 TelephoneListAltID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2322 } else if (PropertyName == wxT("PID")){
2324 TelephoneListPID->erase(*TelephoneCount);
2325 TelephoneListPID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2327 } else if (PropertyName == wxT("PREF")){
2329 int PriorityNumber = 0;
2330 bool ValidNumber = TRUE;
2333 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2336 catch(std::invalid_argument &e){
2337 ValidNumber = FALSE;
2340 if (ValidNumber == TRUE){
2342 TelephoneListPref->erase(*TelephoneCount);
2343 TelephoneListPref->insert(std::make_pair(*TelephoneCount, PriorityNumber));
2349 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2351 if (FirstToken == TRUE){
2353 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2358 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2368 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2369 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2371 // Add the name token data.
2373 if (!PropertyTokens.IsEmpty()){
2375 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2381 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2383 std::map<int, int> SplitPoints;
2384 std::map<int, int> SplitLength;
2386 int intPrevValue = 6;
2389 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2393 PropertyType PropType = PROPERTY_NONE;
2395 // Look for type before continuing.
2397 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2399 std::map<int, wxString> *LanguageList = NULL;
2400 std::map<int, wxString> *LanguageListType = NULL;
2401 std::map<int, wxString> *LanguageListAltID = NULL;
2402 std::map<int, wxString> *LanguageListPID = NULL;
2403 std::map<int, wxString> *LanguageListTokens = NULL;
2404 std::map<int, int> *LanguageListPref = NULL;
2408 LanguageList = &GeneralLanguageList;
2409 LanguageListType = &GeneralLanguageListType;
2410 LanguageListAltID = &GeneralLanguageListAltID;
2411 LanguageListPID = &GeneralLanguageListPID;
2412 LanguageListTokens = &GeneralLanguageListTokens;
2413 LanguageListPref = &GeneralLanguageListPref;
2416 LanguageList = &HomeLanguageList;
2417 LanguageListType = &HomeLanguageListType;
2418 LanguageListAltID = &HomeLanguageListAltID;
2419 LanguageListPID = &HomeLanguageListPID;
2420 LanguageListTokens = &HomeLanguageListTokens;
2421 LanguageListPref = &HomeLanguageListPref;
2424 LanguageList = &BusinessLanguageList;
2425 LanguageListType = &BusinessLanguageListType;
2426 LanguageListAltID = &BusinessLanguageListAltID;
2427 LanguageListPID = &BusinessLanguageListPID;
2428 LanguageListTokens = &BusinessLanguageListTokens;
2429 LanguageListPref = &BusinessLanguageListPref;
2435 std::map<int,int>::iterator SLiter;
2436 wxString PropertyData;
2437 wxString PropertyName;
2438 wxString PropertyValue;
2439 wxString PropertyTokens;
2440 bool FirstToken = TRUE;
2442 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2443 intiter != SplitPoints.end(); ++intiter){
2445 SLiter = SplitLength.find(intiter->first);
2447 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2449 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2450 PropertyName = PropertyElement.GetNextToken();
2451 PropertyValue = PropertyElement.GetNextToken();
2453 intPrevValue = intiter->second;
2455 CaptureString(&PropertyValue, FALSE);
2457 // Process properties.
2459 if (PropertyName == wxT("ALTID")){
2461 LanguageListAltID->erase(*LanguageCount);
2462 LanguageListAltID->insert(std::make_pair(*LanguageCount, PropertyValue));
2464 } else if (PropertyName == wxT("PID")){
2466 LanguageListPID->erase(*LanguageCount);
2467 LanguageListPID->insert(std::make_pair(*LanguageCount, PropertyValue));
2469 } else if (PropertyName == wxT("PREF")){
2471 int PriorityNumber = 0;
2472 bool ValidNumber = TRUE;
2475 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2478 catch(std::invalid_argument &e){
2479 ValidNumber = FALSE;
2482 if (ValidNumber == TRUE){
2484 LanguageListPref->erase(*LanguageCount);
2485 LanguageListPref->insert(std::make_pair(*LanguageCount, PriorityNumber));
2491 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2493 if (FirstToken == TRUE){
2495 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2500 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2510 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2512 // Add the name token data.
2514 if (!PropertyTokens.IsEmpty()){
2516 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2522 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2524 std::map<int, int> SplitPoints;
2525 std::map<int, int> SplitLength;
2527 int intPrevValue = 5;
2530 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2534 PropertyType PropType = PROPERTY_NONE;
2536 // Look for type before continuing.
2538 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2540 std::map<int, wxString> *GeopositionList = NULL;
2541 std::map<int, wxString> *GeopositionListType = NULL;
2542 std::map<int, wxString> *GeopositionListAltID = NULL;
2543 std::map<int, wxString> *GeopositionListPID = NULL;
2544 std::map<int, wxString> *GeopositionListTokens = NULL;
2545 std::map<int, wxString> *GeopositionListMediatype = NULL;
2546 std::map<int, int> *GeopositionListPref = NULL;
2550 GeopositionList = &GeneralGeographyList;
2551 GeopositionListType = &GeneralGeographyListType;
2552 GeopositionListAltID = &GeneralGeographyListAltID;
2553 GeopositionListPID = &GeneralGeographyListPID;
2554 GeopositionListTokens = &GeneralGeographyListTokens;
2555 GeopositionListMediatype = &GeneralGeographyListMediatype;
2556 GeopositionListPref = &GeneralGeographyListPref;
2559 GeopositionList = &HomeGeographyList;
2560 GeopositionListType = &HomeGeographyListType;
2561 GeopositionListAltID = &HomeGeographyListAltID;
2562 GeopositionListPID = &HomeGeographyListPID;
2563 GeopositionListTokens = &HomeGeographyListTokens;
2564 GeopositionListMediatype = &HomeGeographyListMediatype;
2565 GeopositionListPref = &HomeGeographyListPref;
2568 GeopositionList = &BusinessGeographyList;
2569 GeopositionListType = &BusinessGeographyListType;
2570 GeopositionListAltID = &BusinessGeographyListAltID;
2571 GeopositionListPID = &BusinessGeographyListPID;
2572 GeopositionListTokens = &BusinessGeographyListTokens;
2573 GeopositionListMediatype = &BusinessGeographyListMediatype;
2574 GeopositionListPref = &BusinessGeographyListPref;
2580 std::map<int,int>::iterator SLiter;
2581 wxString PropertyData;
2582 wxString PropertyName;
2583 wxString PropertyValue;
2584 wxString PropertyTokens;
2585 bool FirstToken = TRUE;
2587 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2588 intiter != SplitPoints.end(); ++intiter){
2590 SLiter = SplitLength.find(intiter->first);
2592 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2594 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2595 PropertyName = PropertyElement.GetNextToken();
2596 PropertyValue = PropertyElement.GetNextToken();
2598 intPrevValue = intiter->second;
2600 CaptureString(&PropertyValue, FALSE);
2602 // Process properties.
2604 if (PropertyName == wxT("ALTID")){
2606 GeopositionListAltID->erase(*GeographicCount);
2607 GeopositionListAltID->insert(std::make_pair(*GeographicCount, PropertyValue));
2609 } else if (PropertyName == wxT("PID")){
2611 GeopositionListPID->erase(*GeographicCount);
2612 GeopositionListPID->insert(std::make_pair(*GeographicCount, PropertyValue));
2614 } else if (PropertyName == wxT("MEDIATYPE")){
2616 GeopositionListMediatype->erase(*GeographicCount);
2617 GeopositionListMediatype->insert(std::make_pair(*GeographicCount, PropertyValue));
2619 } else if (PropertyName == wxT("PREF")){
2621 int PriorityNumber = 0;
2622 bool ValidNumber = TRUE;
2625 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2628 catch(std::invalid_argument &e){
2629 ValidNumber = FALSE;
2632 if (ValidNumber == TRUE){
2634 GeopositionListPref->erase(*GeographicCount);
2635 GeopositionListPref->insert(std::make_pair(*GeographicCount, PriorityNumber));
2641 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2643 if (FirstToken == TRUE){
2645 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2650 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2660 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2662 // Add the name token data.
2664 if (!PropertyTokens.IsEmpty()){
2666 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2672 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2674 size_t intPropertyLen = PropertySeg1.Len();
2675 std::map<int, int> SplitPoints;
2676 std::map<int, int> SplitLength;
2677 std::map<int, int>::iterator SLiter;
2678 wxString PropertyData;
2679 wxString PropertyName;
2680 wxString PropertyValue;
2681 wxString PropertyTokens;
2682 wxString RelatedType;
2683 wxString RelatedTypeOriginal;
2684 wxString RelatedName;
2685 bool FirstToken = TRUE;
2686 int intSplitsFound = 0;
2687 int intSplitSize = 0;
2688 int intPrevValue = 9;
2692 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2696 // Look for type before continuing.
2698 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2699 intiter != SplitPoints.end(); ++intiter){
2701 SLiter = SplitLength.find(intiter->first);
2703 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2705 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2706 PropertyName = PropertyElement.GetNextToken();
2707 PropertyValue = PropertyElement.GetNextToken();
2709 intPrevValue = intiter->second;
2713 RelatedTypeOriginal = PropertyValue;
2715 if (PropertyName == wxT("TYPE")){
2717 if (PropertyValue == wxT("contact")){
2719 RelatedType = _("Contact");
2721 } else if (PropertyValue == wxT("acquaintance")){
2723 RelatedType = _("Acquaintance");
2725 } else if (PropertyValue == wxT("friend")){
2727 RelatedType = _("Friend");
2729 } else if (PropertyValue == wxT("met")){
2731 RelatedType = _("Met");
2733 } else if (PropertyValue == wxT("co-worker")){
2735 RelatedType = _("Co-worker");
2737 } else if (PropertyValue == wxT("colleague")){
2739 RelatedType = _("Colleague");
2741 } else if (PropertyValue == wxT("co-resident")){
2743 RelatedType = _("Co-resident");
2745 } else if (PropertyValue == wxT("neighbor")){
2747 RelatedType = _("Neighbour");
2749 } else if (PropertyValue == wxT("child")){
2751 RelatedType = _("Child");
2753 } else if (PropertyValue == wxT("parent")){
2755 RelatedType = _("Parent");
2757 } else if (PropertyValue == wxT("sibling")){
2759 RelatedType = _("Sibling");
2761 } else if (PropertyValue == wxT("spouse")){
2763 RelatedType = _("Spouse");
2765 } else if (PropertyValue == wxT("kin")){
2767 RelatedType = _("Kin");
2769 } else if (PropertyValue == wxT("muse")){
2771 RelatedType = _("Muse");
2773 } else if (PropertyValue == wxT("crush")){
2775 RelatedType = _("Crush");
2777 } else if (PropertyValue == wxT("date")){
2779 RelatedType = _("Date");
2781 } else if (PropertyValue == wxT("sweetheart")){
2783 RelatedType = _("Sweetheart");
2785 } else if (PropertyValue == wxT("me")){
2787 RelatedType = _("Me");
2789 } else if (PropertyValue == wxT("agent")){
2791 RelatedType = _("Agent");
2793 } else if (PropertyValue == wxT("emergency")){
2795 RelatedType = _("Emergency");
2799 RelatedType = PropertyValue;
2809 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2810 intiter != SplitPoints.end(); ++intiter){
2812 SLiter = SplitLength.find(intiter->first);
2814 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2816 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2817 PropertyName = PropertyElement.GetNextToken();
2818 PropertyValue = PropertyElement.GetNextToken();
2820 intPrevValue = intiter->second;
2822 // Process properties.
2824 size_t intPropertyValueLen = PropertyValue.Len();
2826 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2828 PropertyValue.Trim();
2829 PropertyValue.RemoveLast();
2833 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2835 PropertyValue.Remove(0, 1);
2839 CaptureString(&PropertyValue, FALSE);
2841 if (PropertyName == wxT("ALTID")){
2843 GeneralRelatedListAltID.erase(*RelatedCount);
2844 GeneralRelatedListAltID.insert(std::make_pair(*RelatedCount, PropertyValue));
2846 } else if (PropertyName == wxT("PID")){
2848 GeneralRelatedListPID.erase(*RelatedCount);
2849 GeneralRelatedListPID.insert(std::make_pair(*RelatedCount, PropertyValue));
2851 } else if (PropertyName == wxT("PREF")){
2853 int PriorityNumber = 0;
2854 bool ValidNumber = TRUE;
2857 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2860 catch(std::invalid_argument &e){
2861 ValidNumber = FALSE;
2864 if (ValidNumber == TRUE){
2866 GeneralRelatedListPref.erase(*RelatedCount);
2867 GeneralRelatedListPref.insert(std::make_pair(*RelatedCount, PriorityNumber));
2871 } else if (PropertyName == wxT("LANGUAGE")){
2873 GeneralRelatedListLanguage.erase(*RelatedCount);
2874 GeneralRelatedListLanguage.insert(std::make_pair(*RelatedCount, PropertyValue));
2876 } else if (PropertyName != wxT("TYPE")) {
2878 // Something else we don't know about so append
2879 // to the tokens variable.
2881 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2883 if (FirstToken == TRUE){
2885 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2890 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2900 // Add the data to the General/Home/Work address variables.
2902 GeneralRelatedList.erase(*RelatedCount);
2903 GeneralRelatedListRelType.erase(*RelatedCount);
2904 GeneralRelatedListType.erase(*RelatedCount);
2905 GeneralRelatedListTokens.erase(*RelatedCount);
2906 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2907 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2908 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2909 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2913 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2915 std::map<int, int> SplitPoints;
2916 std::map<int, int> SplitLength;
2917 std::map<int, int>::iterator SLiter;
2918 wxString PropertyData;
2919 wxString PropertyName;
2920 wxString PropertyValue;
2921 wxString PropertyTokens;
2922 bool FirstToken = TRUE;
2923 int intPrevValue = 5;
2928 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2932 PropertyType PropType = PROPERTY_NONE;
2934 // Look for type before continuing.
2936 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2938 // Setup the pointers.
2940 std::map<int, wxString> *WebsiteList = NULL;
2941 std::map<int, wxString> *WebsiteListAltID = NULL;
2942 std::map<int, wxString> *WebsiteListPID = NULL;
2943 std::map<int, wxString> *WebsiteListType = NULL;
2944 std::map<int, wxString> *WebsiteListTokens = NULL;
2945 std::map<int, wxString> *WebsiteListMediatype = NULL;
2946 std::map<int, int> *WebsiteListPref = NULL;
2948 // Setup blank lines for later on.
2952 WebsiteList = &GeneralWebsiteList;
2953 WebsiteListType = &GeneralWebsiteListType;
2954 WebsiteListAltID = &GeneralWebsiteListAltID;
2955 WebsiteListPID = &GeneralWebsiteListPID;
2956 WebsiteListTokens = &GeneralWebsiteListTokens;
2957 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2958 WebsiteListPref = &GeneralWebsiteListPref;
2961 WebsiteList = &HomeWebsiteList;
2962 WebsiteListType = &HomeWebsiteListType;
2963 WebsiteListAltID = &HomeWebsiteListAltID;
2964 WebsiteListPID = &HomeWebsiteListPID;
2965 WebsiteListTokens = &HomeWebsiteListTokens;
2966 WebsiteListMediatype = &HomeWebsiteListMediatype;
2967 WebsiteListPref = &HomeWebsiteListPref;
2970 WebsiteList = &BusinessWebsiteList;
2971 WebsiteListType = &BusinessWebsiteListType;
2972 WebsiteListAltID = &BusinessWebsiteListAltID;
2973 WebsiteListPID = &BusinessWebsiteListPID;
2974 WebsiteListTokens = &BusinessWebsiteListTokens;
2975 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2976 WebsiteListPref = &BusinessWebsiteListPref;
2982 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2983 intiter != SplitPoints.end(); ++intiter){
2985 SLiter = SplitLength.find(intiter->first);
2987 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2989 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2990 PropertyName = PropertyElement.GetNextToken();
2991 PropertyValue = PropertyElement.GetNextToken();
2993 intPrevValue = intiter->second;
2995 // Process properties.
2997 size_t intPropertyValueLen = PropertyValue.Len();
2999 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3001 PropertyValue.Trim();
3002 PropertyValue.RemoveLast();
3006 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3008 PropertyValue.Remove(0, 1);
3012 CaptureString(&PropertyValue, FALSE);
3014 if (PropertyName == wxT("ALTID")){
3016 WebsiteListAltID->erase(*URLCount);
3017 WebsiteListAltID->insert(std::make_pair(*URLCount, PropertyValue));
3019 } else if (PropertyName == wxT("PID")){
3021 WebsiteListPID->erase(*URLCount);
3022 WebsiteListPID->insert(std::make_pair(*URLCount, PropertyValue));
3024 } else if (PropertyName == wxT("PREF")){
3026 int PriorityNumber = 0;
3027 bool ValidNumber = TRUE;
3030 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3033 catch(std::invalid_argument &e){
3034 ValidNumber = FALSE;
3037 if (ValidNumber == TRUE){
3039 WebsiteListPref->erase(*URLCount);
3040 WebsiteListPref->insert(std::make_pair(*URLCount, PriorityNumber));
3044 } else if (PropertyName == wxT("MEDIATYPE")){
3046 WebsiteListMediatype->erase(*URLCount);
3047 WebsiteListMediatype->insert(std::make_pair(*URLCount, PropertyValue));
3051 // Something else we don't know about so append
3052 // to the tokens variable.
3054 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3056 if (FirstToken == TRUE){
3058 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3063 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3073 // Add the data to the General/Home/Work address variables.
3075 CaptureString(&PropertySeg2, FALSE);
3077 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3079 if (!PropertyTokens.IsEmpty()){
3081 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3087 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3089 std::map<int, int> SplitPoints;
3090 std::map<int, int> SplitLength;
3091 std::map<int, int>::iterator SLiter;
3092 wxString PropertyData;
3093 wxString PropertyName;
3094 wxString PropertyValue;
3095 wxString PropertyTokens;
3096 bool FirstToken = TRUE;
3097 int intPrevValue = 7;
3102 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3106 PropertyType PropType = PROPERTY_NONE;
3108 // Look for type before continuing.
3110 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3112 // Setup the pointers.
3114 std::map<int, wxString> *TitleList = NULL;
3115 std::map<int, wxString> *TitleListAltID = NULL;
3116 std::map<int, wxString> *TitleListPID = NULL;
3117 std::map<int, wxString> *TitleListType = NULL;
3118 std::map<int, wxString> *TitleListTokens = NULL;
3119 std::map<int, wxString> *TitleListLanguage = NULL;
3120 std::map<int, int> *TitleListPref = NULL;
3122 // Setup blank lines for later on.
3126 TitleList = &GeneralTitleList;
3127 TitleListType = &GeneralTitleListType;
3128 TitleListAltID = &GeneralTitleListAltID;
3129 TitleListPID = &GeneralTitleListPID;
3130 TitleListTokens = &GeneralTitleListTokens;
3131 TitleListLanguage = &GeneralTitleListLanguage;
3132 TitleListPref = &GeneralTitleListPref;
3135 TitleList = &HomeTitleList;
3136 TitleListType = &HomeTitleListType;
3137 TitleListAltID = &HomeTitleListAltID;
3138 TitleListPID = &HomeTitleListPID;
3139 TitleListTokens = &HomeTitleListTokens;
3140 TitleListLanguage = &HomeTitleListLanguage;
3141 TitleListPref = &HomeTitleListPref;
3144 TitleList = &BusinessTitleList;
3145 TitleListType = &BusinessTitleListType;
3146 TitleListAltID = &BusinessTitleListAltID;
3147 TitleListPID = &BusinessTitleListPID;
3148 TitleListTokens = &BusinessTitleListTokens;
3149 TitleListLanguage = &BusinessTitleListLanguage;
3150 TitleListPref = &BusinessTitleListPref;
3156 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3157 intiter != SplitPoints.end(); ++intiter){
3159 SLiter = SplitLength.find(intiter->first);
3161 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3163 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3164 PropertyName = PropertyElement.GetNextToken();
3165 PropertyValue = PropertyElement.GetNextToken();
3167 intPrevValue = intiter->second;
3169 // Process properties.
3171 size_t intPropertyValueLen = PropertyValue.Len();
3173 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3175 PropertyValue.Trim();
3176 PropertyValue.RemoveLast();
3180 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3182 PropertyValue.Remove(0, 1);
3186 CaptureString(&PropertyValue, FALSE);
3188 if (PropertyName == wxT("ALTID")){
3190 TitleListAltID->erase(*TitleCount);
3191 TitleListAltID->insert(std::make_pair(*TitleCount, PropertyValue));
3193 } else if (PropertyName == wxT("PID")){
3195 TitleListPID->erase(*TitleCount);
3196 TitleListPID->insert(std::make_pair(*TitleCount, PropertyValue));
3198 } else if (PropertyName == wxT("PREF")){
3200 int PriorityNumber = 0;
3201 bool ValidNumber = TRUE;
3204 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3207 catch(std::invalid_argument &e){
3208 ValidNumber = FALSE;
3211 if (ValidNumber == TRUE){
3213 TitleListPref->erase(*TitleCount);
3214 TitleListPref->insert(std::make_pair(*TitleCount, PriorityNumber));
3218 } else if (PropertyName == wxT("LANGUAGE")){
3220 TitleListLanguage->erase(*TitleCount);
3221 TitleListLanguage->insert(std::make_pair(*TitleCount, PropertyValue));
3225 // Something else we don't know about so append
3226 // to the tokens variable.
3228 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3230 if (FirstToken == TRUE){
3232 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3237 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3247 // Add the data to the General/Home/Work address variables.
3249 CaptureString(&PropertySeg2, FALSE);
3251 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3253 if (!PropertyTokens.IsEmpty()){
3255 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3261 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3263 std::map<int, int> SplitPoints;
3264 std::map<int, int> SplitLength;
3265 std::map<int, int>::iterator SLiter;
3266 wxString PropertyData;
3267 wxString PropertyName;
3268 wxString PropertyValue;
3269 wxString PropertyTokens;
3270 bool FirstToken = TRUE;
3271 int intPrevValue = 6;
3276 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3280 PropertyType PropType = PROPERTY_NONE;
3282 // Look for type before continuing.
3284 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3286 // Setup the pointers.
3288 std::map<int, wxString> *RoleList = NULL;
3289 std::map<int, wxString> *RoleListAltID = NULL;
3290 std::map<int, wxString> *RoleListPID = NULL;
3291 std::map<int, wxString> *RoleListType = NULL;
3292 std::map<int, wxString> *RoleListTokens = NULL;
3293 std::map<int, wxString> *RoleListLanguage = NULL;
3294 std::map<int, int> *RoleListPref = NULL;
3296 // Setup blank lines for later on.
3300 RoleList = &GeneralRoleList;
3301 RoleListType = &GeneralRoleListType;
3302 RoleListAltID = &GeneralRoleListAltID;
3303 RoleListPID = &GeneralRoleListPID;
3304 RoleListTokens = &GeneralRoleListTokens;
3305 RoleListLanguage = &GeneralRoleListLanguage;
3306 RoleListPref = &GeneralRoleListPref;
3309 RoleList = &HomeRoleList;
3310 RoleListType = &HomeRoleListType;
3311 RoleListAltID = &HomeRoleListAltID;
3312 RoleListPID = &HomeRoleListPID;
3313 RoleListTokens = &HomeRoleListTokens;
3314 RoleListLanguage = &HomeRoleListLanguage;
3315 RoleListPref = &HomeRoleListPref;
3318 RoleList = &BusinessRoleList;
3319 RoleListType = &BusinessRoleListType;
3320 RoleListAltID = &BusinessRoleListAltID;
3321 RoleListPID = &BusinessRoleListPID;
3322 RoleListTokens = &BusinessRoleListTokens;
3323 RoleListLanguage = &BusinessRoleListLanguage;
3324 RoleListPref = &BusinessRoleListPref;
3330 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3331 intiter != SplitPoints.end(); ++intiter){
3333 SLiter = SplitLength.find(intiter->first);
3335 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3337 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3338 PropertyName = PropertyElement.GetNextToken();
3339 PropertyValue = PropertyElement.GetNextToken();
3341 intPrevValue = intiter->second;
3343 // Process properties.
3345 size_t intPropertyValueLen = PropertyValue.Len();
3347 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3349 PropertyValue.Trim();
3350 PropertyValue.RemoveLast();
3354 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3356 PropertyValue.Remove(0, 1);
3360 CaptureString(&PropertyValue, FALSE);
3362 if (PropertyName == wxT("ALTID")){
3364 RoleListAltID->erase(*RoleCount);
3365 RoleListAltID->insert(std::make_pair(*RoleCount, PropertyValue));
3367 } else if (PropertyName == wxT("PID")){
3369 RoleListPID->erase(*RoleCount);
3370 RoleListPID->insert(std::make_pair(*RoleCount, PropertyValue));
3372 } else if (PropertyName == wxT("PREF")){
3374 int PriorityNumber = 0;
3375 bool ValidNumber = TRUE;
3378 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3381 catch(std::invalid_argument &e){
3382 ValidNumber = FALSE;
3385 if (ValidNumber == TRUE){
3387 RoleListPref->erase(*RoleCount);
3388 RoleListPref->insert(std::make_pair(*RoleCount, PriorityNumber));
3392 } else if (PropertyName == wxT("LANGUAGE")){
3394 RoleListLanguage->erase(*RoleCount);
3395 RoleListLanguage->insert(std::make_pair(*RoleCount, PropertyValue));
3399 // Something else we don't know about so append
3400 // to the tokens variable.
3402 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3404 if (FirstToken == TRUE){
3406 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3411 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3421 // Add the data to the General/Home/Work address variables.
3423 CaptureString(&PropertySeg2, FALSE);
3425 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3427 if (!PropertyTokens.IsEmpty()){
3429 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3435 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3437 std::map<int, int> SplitPoints;
3438 std::map<int, int> SplitLength;
3439 std::map<int, int>::iterator SLiter;
3440 wxString PropertyData;
3441 wxString PropertyName;
3442 wxString PropertyValue;
3443 wxString PropertyTokens;
3444 bool FirstToken = TRUE;
3445 int intPrevValue = 5;
3450 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3454 PropertyType PropType = PROPERTY_NONE;
3456 // Look for type before continuing.
3458 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3460 // Setup the pointers.
3462 std::map<int, wxString> *OrganisationsList = NULL;
3463 std::map<int, wxString> *OrganisationsListAltID = NULL;
3464 std::map<int, wxString> *OrganisationsListPID = NULL;
3465 std::map<int, wxString> *OrganisationsListType = NULL;
3466 std::map<int, wxString> *OrganisationsListTokens = NULL;
3467 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3468 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3469 std::map<int, int> *OrganisationsListPref = NULL;
3471 // Setup blank lines for later on.
3475 OrganisationsList = &GeneralOrganisationsList;
3476 OrganisationsListType = &GeneralOrganisationsListType;
3477 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3478 OrganisationsListPID = &GeneralOrganisationsListPID;
3479 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3480 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3481 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3482 OrganisationsListPref = &GeneralOrganisationsListPref;
3485 OrganisationsList = &HomeOrganisationsList;
3486 OrganisationsListType = &HomeOrganisationsListType;
3487 OrganisationsListAltID = &HomeOrganisationsListAltID;
3488 OrganisationsListPID = &HomeOrganisationsListPID;
3489 OrganisationsListTokens = &HomeOrganisationsListTokens;
3490 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3491 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3492 OrganisationsListPref = &HomeOrganisationsListPref;
3495 OrganisationsList = &BusinessOrganisationsList;
3496 OrganisationsListType = &BusinessOrganisationsListType;
3497 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3498 OrganisationsListPID = &BusinessOrganisationsListPID;
3499 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3500 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3501 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3502 OrganisationsListPref = &BusinessOrganisationsListPref;
3508 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3509 intiter != SplitPoints.end(); ++intiter){
3511 SLiter = SplitLength.find(intiter->first);
3513 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3515 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3516 PropertyName = PropertyElement.GetNextToken();
3517 PropertyValue = PropertyElement.GetNextToken();
3519 intPrevValue = intiter->second;
3521 // Process properties.
3523 size_t intPropertyValueLen = PropertyValue.Len();
3525 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3527 PropertyValue.Trim();
3528 PropertyValue.RemoveLast();
3532 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3534 PropertyValue.Remove(0, 1);
3538 CaptureString(&PropertyValue, FALSE);
3540 if (PropertyName == wxT("ALTID")){
3542 OrganisationsListAltID->erase(*OrganisationCount);
3543 OrganisationsListAltID->insert(std::make_pair(*OrganisationCount, PropertyValue));
3545 } else if (PropertyName == wxT("PID")){
3547 OrganisationsListPID->erase(*OrganisationCount);
3548 OrganisationsListPID->insert(std::make_pair(*OrganisationCount, PropertyValue));
3550 } else if (PropertyName == wxT("SORT-AS")){
3552 OrganisationsListSortAs->erase(*OrganisationCount);
3553 OrganisationsListSortAs->insert(std::make_pair(*OrganisationCount, PropertyValue));
3555 } else if (PropertyName == wxT("PREF")){
3557 int PriorityNumber = 0;
3558 bool ValidNumber = TRUE;
3561 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3564 catch(std::invalid_argument &e){
3565 ValidNumber = FALSE;
3568 if (ValidNumber == TRUE){
3570 OrganisationsListPref->erase(*OrganisationCount);
3571 OrganisationsListPref->insert(std::make_pair(*OrganisationCount, PriorityNumber));
3575 } else if (PropertyName == wxT("LANGUAGE")){
3577 OrganisationsListLanguage->erase(*OrganisationCount);
3578 OrganisationsListLanguage->insert(std::make_pair(*OrganisationCount, PropertyValue));
3582 // Something else we don't know about so append
3583 // to the tokens variable.
3585 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3587 if (FirstToken == TRUE){
3589 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3594 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3604 // Add the data to the General/Home/Work address variables.
3606 CaptureString(&PropertySeg2, FALSE);
3608 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3610 if (!PropertyTokens.IsEmpty()){
3612 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3618 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3620 std::map<int, int> SplitPoints;
3621 std::map<int, int> SplitLength;
3622 std::map<int, int>::iterator SLiter;
3623 wxString PropertyData;
3624 wxString PropertyName;
3625 wxString PropertyValue;
3626 wxString PropertyTokens;
3627 bool FirstToken = TRUE;
3628 int intPrevValue = 6;
3633 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3637 PropertyType PropType = PROPERTY_NONE;
3639 // Look for type before continuing.
3641 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3643 // Setup the pointers.
3645 std::map<int, wxString> *NoteList = NULL;
3646 std::map<int, wxString> *NoteListAltID = NULL;
3647 std::map<int, wxString> *NoteListPID = NULL;
3648 std::map<int, wxString> *NoteListType = NULL;
3649 std::map<int, wxString> *NoteListTokens = NULL;
3650 std::map<int, wxString> *NoteListLanguage = NULL;
3651 std::map<int, int> *NoteListPref = NULL;
3653 // Setup blank lines for later on.
3657 NoteList = &GeneralNoteList;
3658 NoteListType = &GeneralNoteListType;
3659 NoteListAltID = &GeneralNoteListAltID;
3660 NoteListPID = &GeneralNoteListPID;
3661 NoteListTokens = &GeneralNoteListTokens;
3662 NoteListLanguage = &GeneralNoteListLanguage;
3663 NoteListPref = &GeneralNoteListPref;
3666 NoteList = &HomeNoteList;
3667 NoteListType = &HomeNoteListType;
3668 NoteListAltID = &HomeNoteListAltID;
3669 NoteListPID = &HomeNoteListPID;
3670 NoteListTokens = &HomeNoteListTokens;
3671 NoteListLanguage = &HomeNoteListLanguage;
3672 NoteListPref = &HomeNoteListPref;
3675 NoteList = &BusinessNoteList;
3676 NoteListType = &BusinessNoteListType;
3677 NoteListAltID = &BusinessNoteListAltID;
3678 NoteListPID = &BusinessNoteListPID;
3679 NoteListTokens = &BusinessNoteListTokens;
3680 NoteListLanguage = &BusinessNoteListLanguage;
3681 NoteListPref = &BusinessNoteListPref;
3687 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3688 intiter != SplitPoints.end(); ++intiter){
3690 SLiter = SplitLength.find(intiter->first);
3692 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3694 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3695 PropertyName = PropertyElement.GetNextToken();
3696 PropertyValue = PropertyElement.GetNextToken();
3698 intPrevValue = intiter->second;
3700 // Process properties.
3702 size_t intPropertyValueLen = PropertyValue.Len();
3704 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3706 PropertyValue.Trim();
3707 PropertyValue.RemoveLast();
3711 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3713 PropertyValue.Remove(0, 1);
3717 CaptureString(&PropertyValue, FALSE);
3719 if (PropertyName == wxT("ALTID")){
3721 NoteListAltID->erase(*NoteCount);
3722 NoteListAltID->insert(std::make_pair(*NoteCount, PropertyValue));
3724 } else if (PropertyName == wxT("PID")){
3726 NoteListPID->erase(*NoteCount);
3727 NoteListPID->insert(std::make_pair(*NoteCount, PropertyValue));
3729 } else if (PropertyName == wxT("PREF")){
3731 int PriorityNumber = 0;
3732 bool ValidNumber = TRUE;
3735 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3738 catch(std::invalid_argument &e){
3739 ValidNumber = FALSE;
3742 if (ValidNumber == TRUE){
3744 NoteListPref->erase(*NoteCount);
3745 NoteListPref->insert(std::make_pair(*NoteCount, PriorityNumber));
3749 } else if (PropertyName == wxT("LANGUAGE")){
3751 NoteListLanguage->erase(*NoteCount);
3752 NoteListLanguage->insert(std::make_pair(*NoteCount, PropertyValue));
3756 // Something else we don't know about so append
3757 // to the tokens variable.
3759 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3761 if (FirstToken == TRUE){
3763 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3768 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3778 // Add the data to the General/Home/Work address variables.
3780 CaptureString(&PropertySeg2, FALSE);
3782 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3784 if (!PropertyTokens.IsEmpty()){
3786 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3792 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3794 std::map<int, int> SplitPoints;
3795 std::map<int, int> SplitLength;
3796 std::map<int, int>::iterator SLiter;
3797 wxString PropertyData;
3798 wxString PropertyName;
3799 wxString PropertyValue;
3800 wxString PropertyTokens;
3801 bool FirstToken = TRUE;
3802 int intPrevValue = 12;
3807 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3811 PropertyType PropType = PROPERTY_NONE;
3813 // Look for type before continuing.
3815 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3817 // Setup blank lines for later on.
3823 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3826 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3832 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3833 intiter != SplitPoints.end(); ++intiter){
3835 SLiter = SplitLength.find(intiter->first);
3837 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3839 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3840 PropertyName = PropertyElement.GetNextToken();
3841 PropertyValue = PropertyElement.GetNextToken();
3843 intPrevValue = intiter->second;
3845 // Process properties.
3847 size_t intPropertyValueLen = PropertyValue.Len();
3849 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3851 PropertyValue.Trim();
3852 PropertyValue.RemoveLast();
3856 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3858 PropertyValue.Remove(0, 1);
3862 CaptureString(&PropertyValue, FALSE);
3864 if (PropertyName == wxT("ALTID")){
3866 CategoriesListAltID.erase(*CategoryCount);
3867 CategoriesListAltID.insert(std::make_pair(*CategoryCount, PropertyValue));
3869 } else if (PropertyName == wxT("PID")){
3871 CategoriesListPID.erase(*CategoryCount);
3872 CategoriesListPID.insert(std::make_pair(*CategoryCount, PropertyValue));
3874 } else if (PropertyName == wxT("PREF")){
3876 int PriorityNumber = 0;
3877 bool ValidNumber = TRUE;
3880 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3883 catch(std::invalid_argument &e){
3884 ValidNumber = FALSE;
3887 if (ValidNumber == TRUE){
3889 CategoriesListPref.erase(*CategoryCount);
3890 CategoriesListPref.insert(std::make_pair(*CategoryCount, PriorityNumber));
3894 } else if (PropertyName == wxT("LANGUAGE")){
3896 CategoriesListLanguage.erase(*CategoryCount);
3897 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, PropertyValue));
3901 // Something else we don't know about so append
3902 // to the tokens variable.
3904 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3906 if (FirstToken == TRUE){
3908 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3913 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3923 // Deal with multiple categories.
3925 int intOrigCatCount = *CategoryCount;
3926 bool FirstCategoryProcessed = TRUE;
3927 bool AfterFirstToken = FALSE;
3928 int intSplitSize = 0;
3929 int intSplitsFound = 0;
3930 int intSplitSeek = 0;
3931 int intPropertyLen = PropertySeg2.Len();
3933 SplitPoints.clear();
3934 SplitLength.clear();
3937 for (int i = 0; i <= intPropertyLen; i++){
3939 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3947 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3949 if (AfterFirstToken == TRUE){
3951 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3952 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3956 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3957 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3958 AfterFirstToken = TRUE;
3970 if (SplitPoints.size() > 0){
3972 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3973 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3977 if (SplitPoints.size() == 0){
3979 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3981 if (!PropertyTokens.IsEmpty()){
3983 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3989 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3990 intiter != SplitPoints.end(); ++intiter){
3992 SLiter = SplitLength.find(intiter->first);
3994 intPrevValue = intiter->second;
3996 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3998 // Add the data to the General/Home/Work address variables.
4000 // Trim any whitespace from the start and end.
4002 PropertyData = PropertyData.Trim(FALSE);
4003 PropertyData = PropertyData.Trim(TRUE);
4005 CaptureString(&PropertyData, FALSE);
4007 if (FirstCategoryProcessed == TRUE){
4009 FirstCategoryProcessed = FALSE;
4011 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
4013 if (!PropertyTokens.IsEmpty()){
4015 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4025 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
4027 if (!PropertyTokens.IsEmpty()){
4029 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4035 // Copy the properties to each of the categories (if it exists).
4037 if (!PropertyTokens.IsEmpty()){
4039 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
4043 // Check if ALTID was used.
4045 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
4047 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
4051 // Check if PID was used.
4053 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
4055 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
4059 // Check if PREF was used.
4061 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
4063 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
4067 // Check if LANGUAGE was used.
4069 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
4071 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
4075 // Check if TYPE was used.
4081 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
4084 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
4092 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
4094 size_t intPropertyLen = PropertySeg1.Len();
4095 std::map<int, int> SplitPoints;
4096 std::map<int, int> SplitLength;
4097 std::map<int, int>::iterator SLiter;
4098 wxString PropertyData;
4099 wxString PropertyName;
4100 wxString PropertyValue;
4101 wxString PropertyTokens;
4102 bool FirstToken = TRUE;
4103 int intSplitsFound = 0;
4104 int intSplitSize = 0;
4105 int intPrevValue = 7;
4109 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4113 PropertyType PropType = PROPERTY_NONE;
4115 // Look for type before continuing.
4117 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4121 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4122 intiter != SplitPoints.end(); ++intiter){
4124 SLiter = SplitLength.find(intiter->first);
4126 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4128 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4129 PropertyName = PropertyElement.GetNextToken();
4130 PropertyValue = PropertyElement.GetNextToken();
4132 intPrevValue = intiter->second;
4134 // Process properties.
4136 size_t intPropertyValueLen = PropertyValue.Len();
4138 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4140 PropertyValue.Trim();
4141 PropertyValue.RemoveLast();
4145 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4147 PropertyValue.Remove(0, 1);
4151 CaptureString(&PropertyValue, FALSE);
4153 if (PropertyName == wxT("ALTID")){
4155 PicturesListAltID.erase(*PhotoCount);
4156 PicturesListAltID.insert(std::make_pair(*PhotoCount, PropertyValue));
4158 } else if (PropertyName == wxT("PID")){
4160 PicturesListPID.erase(*PhotoCount);
4161 PicturesListPID.insert(std::make_pair(*PhotoCount, PropertyValue));
4163 } else if (PropertyName == wxT("PREF")){
4165 int PriorityNumber = 0;
4166 bool ValidNumber = TRUE;
4169 PriorityNumber = std::stoi(PropertyValue.ToStdString());
4172 catch(std::invalid_argument &e){
4173 ValidNumber = FALSE;
4176 if (ValidNumber == TRUE){
4178 PicturesListPref.erase(*PhotoCount);
4179 PicturesListPref.insert(std::make_pair(*PhotoCount, PriorityNumber));
4183 } else if (PropertyName == wxT("MEDIATYPE")){
4185 PicturesListMediatype.erase(*PhotoCount);
4186 PicturesListMediatype.insert(std::make_pair(*PhotoCount, PropertyValue));
4190 // Something else we don't know about so append
4191 // to the tokens variable.
4193 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4195 if (FirstToken == TRUE){
4197 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4202 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4212 intPropertyLen = PropertySeg2.Len();
4213 SplitPoints.clear();
4214 SplitLength.clear();
4219 CaptureString(&PropertySeg2, FALSE);
4221 for (int i = 0; i <= intPropertyLen; i++){
4225 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4228 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4230 if (intSplitsFound == 6){
4232 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4237 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4247 wxString wxSPhotoURI;
4248 wxString wxSPhotoMIME;
4249 wxString wxSPhotoEncoding;
4250 wxString wxSPhotoData;
4251 std::string base64enc;
4253 if (intSplitsFound == 0){
4257 std::map<int, int>::iterator striter;
4259 striter = SplitLength.find(1);
4261 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4263 while (wSTDataType.HasMoreTokens() == TRUE){
4265 wxSPhotoURI = wSTDataType.GetNextToken();
4266 wxSPhotoMIME = wSTDataType.GetNextToken();
4271 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4273 while (wSTDataInfo.HasMoreTokens() == TRUE){
4275 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4276 wxSPhotoData = wSTDataInfo.GetNextToken();
4277 base64enc = wxSPhotoData.mb_str();
4284 // Add the data to the General/Home/Work address variables.
4286 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
4287 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
4288 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
4294 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
4297 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
4301 if (!PropertyTokens.IsEmpty()){
4303 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
4309 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
4311 size_t intPropertyLen = PropertySeg1.Len();
4312 std::map<int, int> SplitPoints;
4313 std::map<int, int> SplitLength;
4314 std::map<int, int>::iterator SLiter;
4315 wxString PropertyData;
4316 wxString PropertyName;
4317 wxString PropertyValue;
4318 wxString PropertyTokens;
4319 bool FirstToken = TRUE;
4320 int intSplitsFound = 0;
4321 int intSplitSize = 0;
4322 int intPrevValue = 6;
4326 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4330 PropertyType PropType = PROPERTY_NONE;
4332 // Look for type before continuing.
4334 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4338 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4339 intiter != SplitPoints.end(); ++intiter){
4341 SLiter = SplitLength.find(intiter->first);
4343 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4345 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4346 PropertyName = PropertyElement.GetNextToken();
4347 PropertyValue = PropertyElement.GetNextToken();
4349 intPrevValue = intiter->second;
4351 // Process properties.
4353 size_t intPropertyValueLen = PropertyValue.Len();
4355 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4357 PropertyValue.Trim();
4358 PropertyValue.RemoveLast();
4362 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4364 PropertyValue.Remove(0, 1);
4368 CaptureString(&PropertyValue, FALSE);
4370 if (PropertyName == wxT("ALTID")){
4372 LogosListAltID.erase(*LogoCount);
4373 LogosListAltID.insert(std::make_pair(*LogoCount, PropertyValue));
4375 } else if (PropertyName == wxT("PID")){
4377 LogosListPID.erase(*LogoCount);
4378 LogosListPID.insert(std::make_pair(*LogoCount, PropertyValue));
4380 } else if (PropertyName == wxT("PREF")){
4382 int PriorityNumber = 0;
4383 bool ValidNumber = TRUE;
4386 PriorityNumber = std::stoi(PropertyValue.ToStdString());
4389 catch(std::invalid_argument &e){
4390 ValidNumber = FALSE;
4393 if (ValidNumber == TRUE){
4395 LogosListPref.erase(*LogoCount);
4396 LogosListPref.insert(std::make_pair(*LogoCount, PriorityNumber));
4400 } else if (PropertyName == wxT("MEDIATYPE")){
4402 LogosListMediatype.erase(*LogoCount);
4403 LogosListMediatype.insert(std::make_pair(*LogoCount, PropertyValue));
4407 // Something else we don't know about so append
4408 // to the tokens variable.
4410 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4412 if (FirstToken == TRUE){
4414 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4419 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4429 intPropertyLen = PropertySeg2.Len();
4430 SplitPoints.clear();
4431 SplitLength.clear();
4436 CaptureString(&PropertySeg2, FALSE);
4438 for (int i = 0; i <= intPropertyLen; i++){
4442 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4445 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4447 if (intSplitsFound == 6){
4449 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4454 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4464 wxString wxSPhotoURI;
4465 wxString wxSPhotoMIME;
4466 wxString wxSPhotoEncoding;
4467 wxString wxSPhotoData;
4468 std::string base64enc;
4470 if (intSplitsFound == 0){
4474 std::map<int, int>::iterator striter;
4476 striter = SplitLength.find(1);
4478 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4480 while (wSTDataType.HasMoreTokens() == TRUE){
4482 wxSPhotoURI = wSTDataType.GetNextToken();
4483 wxSPhotoMIME = wSTDataType.GetNextToken();
4488 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4490 while (wSTDataInfo.HasMoreTokens() == TRUE){
4492 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4493 wxSPhotoData = wSTDataInfo.GetNextToken();
4494 base64enc = wxSPhotoData.mb_str();
4501 // Add the data to the General/Home/Work address variables.
4503 LogosList.insert(std::make_pair(*LogoCount, base64enc));
4504 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
4505 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
4511 LogosListType.insert(std::make_pair(*LogoCount, "home"));
4514 LogosListType.insert(std::make_pair(*LogoCount, "work"));
4518 if (!PropertyTokens.IsEmpty()){
4520 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
4526 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
4528 size_t intPropertyLen = PropertySeg1.Len();
4529 std::map<int, int> SplitPoints;
4530 std::map<int, int> SplitLength;
4531 std::map<int, int>::iterator SLiter;
4532 wxString PropertyData;
4533 wxString PropertyName;
4534 wxString PropertyValue;
4535 wxString PropertyTokens;
4536 bool FirstToken = TRUE;
4537 int intSplitsFound = 0;
4538 int intSplitSize = 0;
4539 int intPrevValue = 7;
4543 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4547 PropertyType PropType = PROPERTY_NONE;
4549 // Look for type before continuing.
4551 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4555 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4556 intiter != SplitPoints.end(); ++intiter){
4558 SLiter = SplitLength.find(intiter->first);
4560 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4562 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4563 PropertyName = PropertyElement.GetNextToken();
4564 PropertyValue = PropertyElement.GetNextToken();
4566 intPrevValue = intiter->second;
4568 // Process properties.
4570 size_t intPropertyValueLen = PropertyValue.Len();
4572 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4574 PropertyValue.Trim();
4575 PropertyValue.RemoveLast();
4579 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4581 PropertyValue.Remove(0, 1);
4585 CaptureString(&PropertyValue, FALSE);
4587 if (PropertyName == wxT("ALTID")){
4589 SoundsListAltID.erase(*SoundCount);
4590 SoundsListAltID.insert(std::make_pair(*SoundCount, PropertyValue));
4592 } else if (PropertyName == wxT("PID")){
4594 SoundsListPID.erase(*SoundCount);
4595 SoundsListPID.insert(std::make_pair(*SoundCount, PropertyValue));
4597 } else if (PropertyName == wxT("PREF")){
4599 int PriorityNumber = 0;
4600 bool ValidNumber = TRUE;
4603 PriorityNumber = std::stoi(PropertyValue.ToStdString());
4606 catch(std::invalid_argument &e){
4607 ValidNumber = FALSE;
4610 if (ValidNumber == TRUE){
4612 SoundsListPref.erase(*SoundCount);
4613 SoundsListPref.insert(std::make_pair(*SoundCount, PriorityNumber));
4617 } else if (PropertyName == wxT("MEDIATYPE")){
4619 SoundsListMediatype.erase(*SoundCount);
4620 SoundsListMediatype.insert(std::make_pair(*SoundCount, PropertyValue));
4622 } else if (PropertyName == wxT("LANGUAGE")){
4624 SoundsListLanguage.erase(*SoundCount);
4625 SoundsListLanguage.insert(std::make_pair(*SoundCount, PropertyValue));
4629 // Something else we don't know about so append
4630 // to the tokens variable.
4632 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4634 if (FirstToken == TRUE){
4636 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4641 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4651 intPropertyLen = PropertySeg2.Len();
4652 SplitPoints.clear();
4653 SplitLength.clear();
4658 CaptureString(&PropertySeg2, FALSE);
4660 for (int i = 0; i <= intPropertyLen; i++){
4664 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4667 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4669 if (intSplitsFound == 6){
4671 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4676 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4686 wxString wxSSoundURI;
4687 wxString wxSSoundMIME;
4688 wxString wxSSoundEncoding;
4689 wxString wxSSoundData;
4690 std::string base64enc;
4692 if (intSplitsFound == 0){
4696 std::map<int, int>::iterator striter;
4698 striter = SplitLength.find(1);
4700 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4702 while (wSTDataType.HasMoreTokens() == TRUE){
4704 wxSSoundURI = wSTDataType.GetNextToken();
4705 wxSSoundMIME = wSTDataType.GetNextToken();
4710 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4712 while (wSTDataInfo.HasMoreTokens() == TRUE){
4714 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4715 wxSSoundData = wSTDataInfo.GetNextToken();
4716 base64enc = wxSSoundData.mb_str();
4723 // Add the data to the General/Home/Work address variables.
4729 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4732 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4736 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4737 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4738 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4740 if (!PropertyTokens.IsEmpty()){
4742 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4748 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4750 size_t intPropertyLen = PropertySeg1.Len();
4751 std::map<int, int> SplitPoints;
4752 std::map<int, int> SplitLength;
4753 std::map<int, int>::iterator SLiter;
4754 wxString PropertyData;
4755 wxString PropertyName;
4756 wxString PropertyValue;
4757 wxString PropertyTokens;
4758 bool FirstToken = TRUE;
4759 int intSplitsFound = 0;
4760 int intSplitSize = 0;
4761 int intPrevValue = 8;
4765 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4769 PropertyType PropType = PROPERTY_NONE;
4771 // Look for type before continuing.
4773 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4777 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4778 intiter != SplitPoints.end(); ++intiter){
4780 SLiter = SplitLength.find(intiter->first);
4782 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4784 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4785 PropertyName = PropertyElement.GetNextToken();
4786 PropertyValue = PropertyElement.GetNextToken();
4788 intPrevValue = intiter->second;
4790 // Process properties.
4792 size_t intPropertyValueLen = PropertyValue.Len();
4794 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4796 PropertyValue.Trim();
4797 PropertyValue.RemoveLast();
4801 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4803 PropertyValue.Remove(0, 1);
4807 CaptureString(&PropertyValue, FALSE);
4809 if (PropertyName == wxT("ALTID")){
4811 CalendarListAltID.erase(*CalURICount);
4812 CalendarListAltID.insert(std::make_pair(*CalURICount, PropertyValue));
4814 } else if (PropertyName == wxT("PID")){
4816 CalendarListPID.erase(*CalURICount);
4817 CalendarListPID.insert(std::make_pair(*CalURICount, PropertyValue));
4819 } else if (PropertyName == wxT("PREF")){
4821 int PriorityNumber = 0;
4822 bool ValidNumber = TRUE;
4825 PriorityNumber = std::stoi(PropertyValue.ToStdString());
4828 catch(std::invalid_argument &e){
4829 ValidNumber = FALSE;
4832 if (ValidNumber == TRUE){
4834 CalendarListPref.erase(*CalURICount);
4835 CalendarListPref.insert(std::make_pair(*CalURICount, PriorityNumber));
4839 } else if (PropertyName == wxT("MEDIATYPE")){
4841 CalendarListMediatype.erase(*CalURICount);
4842 CalendarListMediatype.insert(std::make_pair(*CalURICount, PropertyValue));
4846 // Something else we don't know about so append
4847 // to the tokens variable.
4849 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4851 if (FirstToken == TRUE){
4853 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4858 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4868 intPropertyLen = PropertySeg2.Len();
4869 SplitPoints.clear();
4870 SplitLength.clear();
4875 CaptureString(&PropertySeg2, FALSE);
4877 // Add the data to the General/Home/Work address variables.
4883 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4886 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4890 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4892 if (!PropertyTokens.IsEmpty()){
4894 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4900 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4902 size_t intPropertyLen = PropertySeg1.Len();
4903 std::map<int, int> SplitPoints;
4904 std::map<int, int> SplitLength;
4905 std::map<int, int>::iterator SLiter;
4906 wxString PropertyData;
4907 wxString PropertyName;
4908 wxString PropertyValue;
4909 wxString PropertyTokens;
4910 bool FirstToken = TRUE;
4911 int intSplitsFound = 0;
4912 int intSplitSize = 0;
4913 int intPrevValue = 8;
4917 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4921 PropertyType PropType = PROPERTY_NONE;
4923 // Look for type before continuing.
4925 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4929 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4930 intiter != SplitPoints.end(); ++intiter){
4932 SLiter = SplitLength.find(intiter->first);
4934 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4936 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4937 PropertyName = PropertyElement.GetNextToken();
4938 PropertyValue = PropertyElement.GetNextToken();
4940 intPrevValue = intiter->second;
4942 // Process properties.
4944 size_t intPropertyValueLen = PropertyValue.Len();
4946 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4948 PropertyValue.Trim();
4949 PropertyValue.RemoveLast();
4953 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4955 PropertyValue.Remove(0, 1);
4959 CaptureString(&PropertyValue, FALSE);
4961 if (PropertyName == wxT("ALTID")){
4963 CalendarRequestListAltID.erase(*CalAdrURICount);
4964 CalendarRequestListAltID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
4966 } else if (PropertyName == wxT("PID")){
4968 CalendarRequestListPID.erase(*CalAdrURICount);
4969 CalendarRequestListPID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
4971 } else if (PropertyName == wxT("PREF")){
4973 int PriorityNumber = 0;
4974 bool ValidNumber = TRUE;
4977 PriorityNumber = std::stoi(PropertyValue.ToStdString());
4980 catch(std::invalid_argument &e){
4981 ValidNumber = FALSE;
4984 if (ValidNumber == TRUE){
4986 CalendarRequestListPref.erase(*CalAdrURICount);
4987 CalendarRequestListPref.insert(std::make_pair(*CalAdrURICount, PriorityNumber));
4991 } else if (PropertyName == wxT("MEDIATYPE")){
4993 CalendarRequestListMediatype.erase(*CalAdrURICount);
4994 CalendarRequestListMediatype.insert(std::make_pair(*CalAdrURICount, PropertyValue));
4998 // Something else we don't know about so append
4999 // to the tokens variable.
5001 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5003 if (FirstToken == TRUE){
5005 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5010 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5020 intPropertyLen = PropertySeg2.Len();
5021 SplitPoints.clear();
5022 SplitLength.clear();
5027 CaptureString(&PropertySeg2, FALSE);
5029 // Add the data to the General/Home/Work address variables.
5035 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
5038 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
5042 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
5044 if (!PropertyTokens.IsEmpty()){
5046 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
5052 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
5054 size_t intPropertyLen = PropertySeg1.Len();
5055 std::map<int, int> SplitPoints;
5056 std::map<int, int> SplitLength;
5057 std::map<int, int>::iterator SLiter;
5058 wxString PropertyData;
5059 wxString PropertyName;
5060 wxString PropertyValue;
5061 wxString PropertyTokens;
5062 bool FirstToken = TRUE;
5063 int intSplitsFound = 0;
5064 int intSplitSize = 0;
5065 int intPrevValue = 7;
5069 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5073 PropertyType PropType = PROPERTY_NONE;
5075 // Look for type before continuing.
5077 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
5081 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5082 intiter != SplitPoints.end(); ++intiter){
5084 SLiter = SplitLength.find(intiter->first);
5086 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
5088 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5089 PropertyName = PropertyElement.GetNextToken();
5090 PropertyValue = PropertyElement.GetNextToken();
5092 intPrevValue = intiter->second;
5094 // Process properties.
5096 size_t intPropertyValueLen = PropertyValue.Len();
5098 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5100 PropertyValue.Trim();
5101 PropertyValue.RemoveLast();
5105 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5107 PropertyValue.Remove(0, 1);
5111 CaptureString(&PropertyValue, FALSE);
5113 if (PropertyName == wxT("ALTID")){
5115 FreeBusyListAltID.erase(*FreeBusyAddressCount);
5116 FreeBusyListAltID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5118 } else if (PropertyName == wxT("PID")){
5120 FreeBusyListPID.erase(*FreeBusyAddressCount);
5121 FreeBusyListPID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5123 } else if (PropertyName == wxT("PREF")){
5125 int PriorityNumber = 0;
5126 bool ValidNumber = TRUE;
5129 PriorityNumber = std::stoi(PropertyValue.ToStdString());
5132 catch(std::invalid_argument &e){
5133 ValidNumber = FALSE;
5136 if (ValidNumber == TRUE){
5138 FreeBusyListPref.erase(*FreeBusyAddressCount);
5139 FreeBusyListPref.insert(std::make_pair(*FreeBusyAddressCount, PriorityNumber));
5143 } else if (PropertyName == wxT("MEDIATYPE")){
5145 FreeBusyListMediatype.erase(*FreeBusyAddressCount);
5146 FreeBusyListMediatype.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5150 // Something else we don't know about so append
5151 // to the tokens variable.
5153 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5155 if (FirstToken == TRUE){
5157 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5162 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5172 intPropertyLen = PropertySeg2.Len();
5173 SplitPoints.clear();
5174 SplitLength.clear();
5179 CaptureString(&PropertySeg2, FALSE);
5181 // Add the data to the General/Home/Work address variables.
5187 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
5190 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
5194 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
5196 if (!PropertyTokens.IsEmpty()){
5198 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
5204 void SplitValues(wxString *PropertyLine,
5205 std::map<int,int> *SplitPoints,
5206 std::map<int,int> *SplitLength,
5209 size_t intPropertyLen = PropertyLine->Len();
5210 int intSplitsFound = 0;
5211 int intSplitSize = 0;
5212 int intSplitSeek = 0;
5214 for (int i = intSize; i <= intPropertyLen; i++){
5218 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5219 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5221 if (intSplitsFound == 0){
5223 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5227 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5231 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5241 if (intSplitsFound == 0){
5243 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5244 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5248 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5249 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5255 void CheckType(wxString *PropertySeg1,
5256 std::map<int,int> *SplitPoints,
5257 std::map<int,int> *SplitLength,
5259 PropertyType *PropType){
5261 wxString PropertyData;
5262 wxString PropertyName;
5263 wxString PropertyValue;
5264 std::map<int,int>::iterator SLiter;
5266 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5267 intiter != SplitPoints->end(); ++intiter){
5269 SLiter = SplitLength->find(intiter->first);
5271 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5273 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5274 PropertyName = PropertyElement.GetNextToken();
5275 PropertyValue = PropertyElement.GetNextToken();
5277 *intPrevValue = intiter->second;
5279 if (PropertyName == wxT("TYPE")){
5281 if (PropertyValue == wxT("work")){
5283 *PropType = PROPERTY_WORK;
5285 } else if (PropertyValue == wxT("home")){
5287 *PropType = PROPERTY_HOME;
5291 *PropType = PROPERTY_NONE;