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;
98 wxString PropertyLine;
99 wxString PropertySeg1;
100 wxString PropertySeg2;
101 wxString PropertyNextLine;
104 for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
105 iter != ContactFileLines.end(); ++iter){
107 ExtraLineSeek = TRUE;
113 PropertyLine.Clear();
114 PropertySeg1.Clear();
115 PropertySeg2.Clear();
118 ContactLine = iter->second;
120 while (ExtraLineSeek == TRUE){
122 // Check if there is extra data on the next line
123 // (indicated by space or tab at the start) and add data.
127 if (iter == ContactFileLines.end()){
134 PropertyNextLine = iter->second;
136 if (PropertyNextLine.Mid(0, 1) == wxT(" ") || PropertyNextLine.Mid(0, 1) == wxT("\t")){
138 PropertyNextLine.Remove(0, 1);
139 ContactLine.Append(PropertyNextLine);
144 ExtraLineSeek = FALSE;
150 ContactLineLen = ContactLine.Len();
152 // Make sure we are not in quotation mode.
153 // Make sure colon does not have \ or \\ before it.
155 for (int i = 0; i <= ContactLineLen; i++){
157 if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
159 PropertyFind = FALSE;
161 } else if (PropertyFind == TRUE){
163 Property.Append(ContactLine.Mid(i, 1));
167 if (ContactLine.Mid(i, 1) == wxT("\"")){
169 if (QuoteMode == TRUE){
181 if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
190 // Split that line at the point into two variables (ignore the colon).
192 PropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
193 PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
195 if (Property == wxT("KIND") && KindProcessed == FALSE){
197 ProcessKind(PropertySeg2);
199 } else if (Property == wxT("MEMBER")){
201 ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
204 } else if (Property == wxT("FN")){
206 ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
209 } else if (Property == wxT("N") && NameProcessed == FALSE){
211 ProcessN(PropertySeg1, PropertySeg2);
212 NameProcessed = TRUE;
214 } else if (Property == wxT("NICKNAME")){
216 ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
219 } else if (Property == wxT("GENDER") && GenderProcessed == FALSE){
221 ProcessGender(PropertySeg1, PropertySeg2);
222 GenderProcessed = TRUE;
224 } else if (Property == wxT("BDAY") && BirthdayProcessed == FALSE){
226 ProcessBirthday(PropertySeg1, PropertySeg2);
227 BirthdayProcessed = TRUE;
229 } else if (Property == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
231 ProcessAnniversary(PropertySeg1, PropertySeg2);
232 AnniversaryProcessed = TRUE;
234 } else if (Property == wxT("TZ")){
236 ProcessTimeZone(PropertySeg1, PropertySeg2, &TimeZoneCount);
239 } else if (Property == wxT("ADR")){
241 ProcessAddress(PropertySeg1, PropertySeg2, &AddressCount);
244 } else if (Property == wxT("EMAIL")){
246 ProcessEmail(PropertySeg1, PropertySeg2, &EmailCount);
249 } else if (Property == wxT("IMPP")){
251 ProcessIM(PropertySeg1, PropertySeg2, &IMCount);
254 } else if (Property == wxT("TEL")){
256 ProcessTelephone(PropertySeg1, PropertySeg2, &TelephoneCount);
259 } else if (Property == wxT("LANG")){
261 // See frmContactEditor-LoadLanguage.cpp
263 ProcessLanguage(PropertySeg1, PropertySeg2, &LanguageCount);
266 } else if (Property == wxT("GEO")){
268 // See frmContactEditor-LoadGeo.cpp
270 ProcessGeographic(PropertySeg1, PropertySeg2, &GeographicCount);
273 } else if (Property == wxT("RELATED")){
275 // See fromContactEditor-LoadRelated.cpp
277 ProcessRelated(PropertySeg1, PropertySeg2, &RelatedCount);
280 } else if (Property == wxT("URL")){
282 // See frmContactEditor-LoadURL.cpp
284 ProcessURL(PropertySeg1, PropertySeg2, &URLCount);
287 } else if (Property == wxT("TITLE")) {
289 // See frmContactEditor-LoadTitle.cpp
291 ProcessTitle(PropertySeg1, PropertySeg2, &TitleCount);
294 } else if (Property == wxT("ROLE")) {
296 // See frmContactEditor-LoadTitle.cpp
298 ProcessRole(PropertySeg1, PropertySeg2, &RoleCount);
305 return CONTACTLOAD_OK;
309 void ContactDataObject::ProcessKind(wxString KindType){
311 if (KindType == wxT("individual")){
313 ContactKind = CONTACTKIND_INDIVIDUAL;
315 } else if (KindType == wxT("group")){
317 ContactKind = CONTACTKIND_GROUP;
319 } else if (KindType == wxT("org")){
321 ContactKind = CONTACTKIND_ORGANISATION;
323 } else if (KindType == wxT("location")){
325 ContactKind = CONTACTKIND_LOCATION;
329 ContactKind = CONTACTKIND_NONE;
334 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
336 std::map<int, int> SplitPoints;
337 std::map<int, int> SplitLength;
339 int intPrevValue = 8;
343 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
347 wxString PropertyName;
348 wxString PropertyValue;
349 wxString PropertyData;
350 wxString PropertyTokens;
351 std::map<int,int>::iterator SLiter;
352 bool FirstToken = TRUE;
354 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
355 intiter != SplitPoints.end(); ++intiter){
357 SLiter = SplitLength.find(intiter->first);
359 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
361 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
362 PropertyName = PropertyElement.GetNextToken();
363 PropertyValue = PropertyElement.GetNextToken();
365 intPrevValue = intiter->second;
367 CaptureString(&PropertyValue, FALSE);
369 if (PropertyName == wxT("ALTID")){
371 GroupsListAltID.erase(*GroupCount);
372 GroupsListAltID.insert(std::make_pair(*GroupCount, PropertyValue));
374 } else if (PropertyName == wxT("PID")){
376 GroupsListPID.erase(*GroupCount);
377 GroupsListPID.insert(std::make_pair(*GroupCount, PropertyValue));
379 } else if (PropertyName == wxT("PREF")){
381 int PriorityNumber = 0;
382 bool ValidNumber = TRUE;
385 PriorityNumber = std::stoi(PropertyValue.ToStdString());
388 catch(std::invalid_argument &e){
392 if (ValidNumber == TRUE){
394 GroupsListPref.erase(*GroupCount);
395 GroupsListPref.insert(std::make_pair(*GroupCount, PriorityNumber));
399 } else if (PropertyName == wxT("MEDIATYPE")){
401 GroupsListMediaType.erase(*GroupCount);
402 GroupsListMediaType.insert(std::make_pair(*GroupCount, PropertyValue));
404 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
406 if (FirstToken == TRUE){
408 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
413 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
421 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
423 if (!PropertyTokens.IsEmpty()){
425 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
432 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
434 std::map<int, int> SplitPoints;
435 std::map<int, int> SplitLength;
437 int intPrevValue = 4;
441 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
445 wxString PropertyName;
446 wxString PropertyValue;
447 wxString PropertyData;
448 wxString PropertyTokens;
449 std::map<int,int>::iterator SLiter;
450 bool FirstToken = TRUE;
452 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
453 intiter != SplitPoints.end(); ++intiter){
455 SLiter = SplitLength.find(intiter->first);
457 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
459 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
460 PropertyName = PropertyElement.GetNextToken();
461 PropertyValue = PropertyElement.GetNextToken();
463 intPrevValue = intiter->second;
465 CaptureString(&PropertyValue, FALSE);
467 if (PropertyName == wxT("TYPE")){
469 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
470 PropertyValue == wxT("work") ){
472 FullNamesListType.erase(*FNCount);
473 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
477 } else if (PropertyName == wxT("LANGUAGE")){
479 FullNamesListLanguage.erase(*FNCount);
480 FullNamesListLanguage.insert(std::make_pair(*FNCount, PropertyValue));
482 } else if (PropertyName == wxT("ALTID")){
484 FullNamesListAltID.erase(*FNCount);
485 FullNamesListAltID.insert(std::make_pair(*FNCount, PropertyValue));
487 } else if (PropertyName == wxT("PID")){
489 FullNamesListPID.erase(*FNCount);
490 FullNamesListPID.insert(std::make_pair(*FNCount, PropertyValue));
492 } else if (PropertyName == wxT("PREF")){
494 int PriorityNumber = 0;
495 bool ValidNumber = TRUE;
498 PriorityNumber = std::stoi(PropertyValue.ToStdString());
501 catch(std::invalid_argument &e){
505 if (ValidNumber == TRUE){
507 FullNamesListPref.erase(*FNCount);
508 FullNamesListPref.insert(std::make_pair(*FNCount, PriorityNumber));
512 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
514 if (FirstToken == TRUE){
516 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
521 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
529 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
531 if (!PropertyTokens.IsEmpty()){
533 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
539 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
541 std::map<int, int> SplitPoints;
542 std::map<int, int> SplitLength;
544 int intPrevValue = 3;
548 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
552 wxString PropertyName;
553 wxString PropertyValue;
554 wxString PropertyData;
555 wxString PropertyTokens;
556 std::map<int,int>::iterator SLiter;
557 bool FirstToken = TRUE;
559 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
560 intiter != SplitPoints.end(); ++intiter){
562 SLiter = SplitLength.find(intiter->first);
564 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
566 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
567 PropertyName = PropertyElement.GetNextToken();
568 PropertyValue = PropertyElement.GetNextToken();
570 intPrevValue = intiter->second;
572 CaptureString(&PropertyValue, FALSE);
574 if (PropertyName == wxT("ALTID")){
576 NameAltID = PropertyValue;
578 } else if (PropertyName == wxT("LANGUAGE")){
580 NameLanguage = PropertyValue;
582 } else if (PropertyName == wxT("SORT-AS")){
584 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
585 PropertyValue.Len() >= 3){
586 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
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 // Split the name data.
608 int intSplitSeek = 0;
609 int intSplitsFound = 0;
610 int intSplitSize = 0;
611 int intPropertyLen = PropertySeg2.Len();
613 std::map<int,wxString> NameValues;
616 for (int i = 0; i <= intPropertyLen; i++){
618 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
620 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
625 if (intSplitsFound == 4){
627 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
641 // Split the data into several parts.
643 for (std::map<int, wxString>::iterator iter = NameValues.begin();
644 iter != NameValues.end(); ++iter){
646 if (iter->first == 1){
648 // Deal with family name.
650 NameSurname = iter->second;
652 } else if (iter->first == 2){
654 // Deal with given names.
656 NameForename = iter->second;
658 } else if (iter->first == 3){
660 // Deal with additional names.
662 NameOtherNames = iter->second;
664 } else if (iter->first == 4){
666 // Deal with honorifix prefixes and suffixes.
668 NameTitle = iter->second;
672 if (iter == NameValues.end()){
678 NameSuffix = iter->second;
684 // Add the name token data.
686 if (!PropertyTokens.IsEmpty()){
688 NameTokens = PropertyTokens;
694 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
696 std::map<int, int> SplitPoints;
697 std::map<int, int> SplitLength;
699 int intPrevValue = 10;
702 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
706 PropertyType PropType = PROPERTY_NONE;
708 // Look for type before continuing.
710 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
714 std::map<int, wxString> *NicknamesList = NULL;
715 std::map<int, wxString> *NicknamesListType = NULL;
716 std::map<int, wxString> *NicknamesListLanguage = NULL;
717 std::map<int, wxString> *NicknamesListAltID = NULL;
718 std::map<int, wxString> *NicknamesListPID = NULL;
719 std::map<int, wxString> *NicknamesListTokens = NULL;
720 std::map<int, int> *NicknamesListPref = NULL;
724 NicknamesList = &GeneralNicknamesList;
725 NicknamesListType = &GeneralNicknamesListType;
726 NicknamesListLanguage = &GeneralNicknamesListLanguage;
727 NicknamesListAltID = &GeneralNicknamesListAltID;
728 NicknamesListPID = &GeneralNicknamesListPID;
729 NicknamesListTokens = &GeneralNicknamesListTokens;
730 NicknamesListPref = &GeneralNicknamesListPref;
733 NicknamesList = &HomeNicknamesList;
734 NicknamesListType = &HomeNicknamesListType;
735 NicknamesListLanguage = &HomeNicknamesListLanguage;
736 NicknamesListAltID = &HomeNicknamesListAltID;
737 NicknamesListPID = &HomeNicknamesListPID;
738 NicknamesListTokens = &HomeNicknamesListTokens;
739 NicknamesListPref = &HomeNicknamesListPref;
742 NicknamesList = &BusinessNicknamesList;
743 NicknamesListType = &BusinessNicknamesListType;
744 NicknamesListLanguage = &BusinessNicknamesListLanguage;
745 NicknamesListAltID = &BusinessNicknamesListAltID;
746 NicknamesListPID = &BusinessNicknamesListPID;
747 NicknamesListTokens = &BusinessNicknamesListTokens;
748 NicknamesListPref = &BusinessNicknamesListPref;
752 std::map<int, int>::iterator SLiter;
753 wxString PropertyData;
754 wxString PropertyName;
755 wxString PropertyValue;
756 wxString PropertyTokens;
757 bool FirstToken = TRUE;
759 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
760 intiter != SplitPoints.end(); ++intiter){
762 SLiter = SplitLength.find(intiter->first);
764 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
766 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
767 PropertyName = PropertyElement.GetNextToken();
768 PropertyValue = PropertyElement.GetNextToken();
770 intPrevValue = intiter->second;
772 CaptureString(&PropertyValue, FALSE);
774 if (PropertyName == wxT("ALTID")){
776 NicknamesListAltID->erase(*NicknameCount);
777 NicknamesListAltID->insert(std::make_pair(*NicknameCount, PropertyValue));
779 } else if (PropertyName == wxT("PID")){
781 NicknamesListPID->erase(*NicknameCount);
782 NicknamesListPID->insert(std::make_pair(*NicknameCount, PropertyValue));
784 } else if (PropertyName == wxT("PREF")){
786 int PriorityNumber = 0;
787 bool ValidNumber = TRUE;
790 PriorityNumber = std::stoi(PropertyValue.ToStdString());
793 catch(std::invalid_argument &e){
797 if (ValidNumber == TRUE){
799 NicknamesListPref->erase(*NicknameCount);
800 NicknamesListPref->insert(std::make_pair(*NicknameCount, PriorityNumber));
804 } else if (PropertyName == wxT("LANGUAGE")){
806 NicknamesListLanguage->erase(*NicknameCount);
807 NicknamesListLanguage->insert(std::make_pair(*NicknameCount, PropertyValue));
811 // Something else we don't know about so append
812 // to the tokens variable.
814 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
816 if (FirstToken == TRUE){
818 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
823 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
833 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
835 // Add the name token data.
837 if (!PropertyTokens.IsEmpty()){
839 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
845 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
847 std::map<int, int> SplitPoints;
848 std::map<int, int> SplitLength;
849 std::map<int, int>::iterator SLiter;
850 wxString PropertyData;
851 wxString PropertyName;
852 wxString PropertyValue;
853 wxString PropertyTokens;
854 bool FirstToken = TRUE;
855 int intPrevValue = 8;
857 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
861 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
862 intiter != SplitPoints.end(); ++intiter){
864 SLiter = SplitLength.find(intiter->first);
866 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
868 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
869 PropertyName = PropertyElement.GetNextToken();
870 PropertyValue = PropertyElement.GetNextToken();
872 intPrevValue = intiter->second;
874 // Process properties.
876 size_t intPropertyValueLen = PropertyValue.Len();
878 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
880 PropertyValue.Trim();
881 PropertyValue.RemoveLast();
885 if (PropertyValue.Mid(0, 1) == wxT("\"")){
887 PropertyValue.Remove(0, 1);
891 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
893 if (FirstToken == TRUE){
895 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
900 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
908 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
910 wxString GenderComponent;
912 if (GenderData.CountTokens() >= 2){
914 Gender = GenderData.GetNextToken();
915 GenderDetails = GenderData.GetString();
917 CaptureString(&GenderDetails, FALSE);
921 Gender = GenderData.GetNextToken();
925 if (!PropertyTokens.IsEmpty()){
927 GenderTokens = PropertyTokens;
933 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
935 // Process date. Preserve the remainder in the string.
937 std::map<int, int> SplitPoints;
938 std::map<int, int> SplitLength;
939 std::map<int, int>::iterator SLiter;
940 wxString PropertyData;
941 wxString PropertyName;
942 wxString PropertyValue;
943 wxString PropertyTokens;
944 bool BirthdayText = FALSE;
945 int intPrevValue = 6;
947 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
951 // Look for type before continuing.
953 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
954 intiter != SplitPoints.end(); ++intiter){
956 SLiter = SplitLength.find(intiter->first);
958 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
960 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
961 PropertyName = PropertyElement.GetNextToken();
962 PropertyValue = PropertyElement.GetNextToken();
964 intPrevValue = intiter->second;
966 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
968 CaptureString(&PropertySeg2, FALSE);
969 Birthday = PropertySeg2;
976 // Setup blank lines for later on.
979 bool FirstToken = TRUE;
981 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
982 intiter != SplitPoints.end(); ++intiter){
984 SLiter = SplitLength.find(intiter->first);
986 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
988 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
989 PropertyName = PropertyElement.GetNextToken();
990 PropertyValue = PropertyElement.GetNextToken();
992 intPrevValue = intiter->second;
994 // Process properties.
996 CaptureString(&PropertyValue, FALSE);
998 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1000 PropertyValue.Trim();
1001 PropertyValue.RemoveLast();
1005 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1007 PropertyValue.Remove(0, 1);
1011 if (PropertyName == wxT("ALTID")){
1013 BirthdayAltID = PropertyValue;
1015 } else if (PropertyName == wxT("CALSCALE")){
1017 BirthdayCalScale = PropertyValue;
1019 } else if (PropertyName != wxT("VALUE")) {
1021 // Something else we don't know about so append
1022 // to the tokens variable.
1024 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1026 if (FirstToken == TRUE){
1028 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1033 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1043 // Add the data to the variables and form.
1045 if (BirthdayText == FALSE){
1047 Birthday = PropertySeg2;
1051 if (!PropertyTokens.IsEmpty()){
1053 BirthdayTokens = PropertyTokens;
1059 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1061 // Process date. Preserve the remainder in the string.
1063 std::map<int, int> SplitPoints;
1064 std::map<int, int> SplitLength;
1065 std::map<int, int>::iterator SLiter;
1066 wxString PropertyData;
1067 wxString PropertyName;
1068 wxString PropertyValue;
1069 wxString PropertyTokens;
1070 bool AnniversaryText = FALSE;
1071 int intPrevValue = 13;
1073 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1077 // Look for type before continuing.
1079 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1080 intiter != SplitPoints.end(); ++intiter){
1082 SLiter = SplitLength.find(intiter->first);
1084 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1086 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1087 PropertyName = PropertyElement.GetNextToken();
1088 PropertyValue = PropertyElement.GetNextToken();
1090 intPrevValue = intiter->second;
1092 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1094 CaptureString(&PropertySeg2, FALSE);
1095 Anniversary = PropertySeg2;
1096 AnniversaryText = TRUE;
1102 // Setup blank lines for later on.
1105 bool FirstToken = TRUE;
1107 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1108 intiter != SplitPoints.end(); ++intiter){
1110 SLiter = SplitLength.find(intiter->first);
1112 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1114 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1115 PropertyName = PropertyElement.GetNextToken();
1116 PropertyValue = PropertyElement.GetNextToken();
1118 intPrevValue = intiter->second;
1120 // Process properties.
1122 CaptureString(&PropertyValue, FALSE);
1124 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1126 PropertyValue.Trim();
1127 PropertyValue.RemoveLast();
1131 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1133 PropertyValue.Remove(0, 1);
1137 if (PropertyName == wxT("ALTID")){
1139 AnniversaryAltID = PropertyValue;
1141 } else if (PropertyName == wxT("CALSCALE")){
1143 AnniversaryCalScale = PropertyValue;
1145 } else if (PropertyName != wxT("VALUE")) {
1147 // Something else we don't know about so append
1148 // to the tokens variable.
1150 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1152 if (FirstToken == TRUE){
1154 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1159 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1169 // Add the data to the variables and form.
1171 if (AnniversaryText == FALSE){
1173 Anniversary = PropertySeg2;
1177 if (!PropertyTokens.IsEmpty()){
1179 AnniversaryTokens = PropertyTokens;
1185 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1187 std::map<int, int> SplitPoints;
1188 std::map<int, int> SplitLength;
1190 int intPrevValue = 4;
1193 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1197 PropertyType PropType = PROPERTY_NONE;
1199 // Look for type before continuing.
1201 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1205 std::map<int, wxString> *TZList = NULL;
1206 std::map<int, wxString> *TZListType = NULL;
1207 std::map<int, wxString> *TZListMediatype = NULL;
1208 std::map<int, wxString> *TZListAltID = NULL;
1209 std::map<int, wxString> *TZListPID = NULL;
1210 std::map<int, wxString> *TZListTokens = NULL;
1211 std::map<int, int> *TZListPref = NULL;
1215 TZList = &GeneralTZList;
1216 TZListType = &GeneralTZListType;
1217 TZListMediatype = &GeneralTZListMediatype;
1218 TZListAltID = &GeneralTZListAltID;
1219 TZListPID = &GeneralTZListPID;
1220 TZListTokens = &GeneralTZListTokens;
1221 TZListPref = &GeneralTZListPref;
1224 TZList = &HomeTZList;
1225 TZListType = &HomeTZListType;
1226 TZListMediatype = &HomeTZListMediatype;
1227 TZListAltID = &HomeTZListAltID;
1228 TZListPID = &HomeTZListPID;
1229 TZListTokens = &HomeTZListTokens;
1230 TZListPref = &HomeTZListPref;
1233 TZList = &BusinessTZList;
1234 TZListType = &BusinessTZListType;
1235 TZListMediatype = &BusinessTZListMediatype;
1236 TZListAltID = &BusinessTZListAltID;
1237 TZListPID = &BusinessTZListPID;
1238 TZListTokens = &BusinessTZListTokens;
1239 TZListPref = &BusinessTZListPref;
1243 std::map<int, int>::iterator SLiter;
1244 wxString PropertyData;
1245 wxString PropertyName;
1246 wxString PropertyValue;
1247 wxString PropertyTokens;
1248 bool FirstToken = TRUE;
1250 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1251 intiter != SplitPoints.end(); ++intiter){
1253 SLiter = SplitLength.find(intiter->first);
1255 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1257 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1258 PropertyName = PropertyElement.GetNextToken();
1259 PropertyValue = PropertyElement.GetNextToken();
1261 intPrevValue = intiter->second;
1263 CaptureString(&PropertyValue, FALSE);
1265 if (PropertyName == wxT("ALTID")){
1267 TZListAltID->erase(*TimeZoneCount);
1268 TZListAltID->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1270 } else if (PropertyName == wxT("PID")){
1272 TZListPID->erase(*TimeZoneCount);
1273 TZListPID->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1275 } else if (PropertyName == wxT("PREF")){
1277 int PriorityNumber = 0;
1278 bool ValidNumber = TRUE;
1281 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1284 catch(std::invalid_argument &e){
1285 ValidNumber = FALSE;
1288 if (ValidNumber == TRUE){
1290 TZListPref->erase(*TimeZoneCount);
1291 TZListPref->insert(std::make_pair(*TimeZoneCount, PriorityNumber));
1295 } else if (PropertyName == wxT("MEDIATYPE")){
1297 TZListMediatype->erase(*TimeZoneCount);
1298 TZListMediatype->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1302 // Something else we don't know about so append
1303 // to the tokens variable.
1305 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1307 if (FirstToken == TRUE){
1309 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1314 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1324 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1326 // Add the name token data.
1328 if (!PropertyTokens.IsEmpty()){
1330 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1337 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1339 size_t intPropertyLen = PropertySeg1.Len();
1340 std::map<int, int> SplitPoints;
1341 std::map<int, int> SplitLength;
1342 std::map<int, int>::iterator SLiter;
1343 wxString PropertyData;
1344 wxString PropertyName;
1345 wxString PropertyValue;
1346 wxString PropertyTokens;
1347 wxString AddressLabel;
1348 wxString AddressLang;
1349 wxString AddressAltID;
1350 wxString AddressPID;
1351 wxString AddressTokens;
1352 wxString AddressGeo;
1353 wxString AddressTimezone;
1354 wxString AddressType;
1355 wxString AddressMediatype;
1356 wxString AddressPOBox;
1357 wxString AddressExtended;
1358 wxString AddressStreet;
1359 wxString AddressLocality;
1360 wxString AddressCity;
1361 wxString AddressRegion;
1362 wxString AddressPostalCode;
1363 wxString AddressCountry;
1364 bool FirstToken = TRUE;
1365 int intSplitsFound = 0;
1366 int intSplitSize = 0;
1367 int intPrevValue = 5;
1372 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1376 PropertyType PropType = PROPERTY_NONE;
1378 // Look for type before continuing.
1380 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1384 std::map<int, wxString> *AddressList = NULL;
1385 std::map<int, wxString> *AddressListTown = NULL;
1386 std::map<int, wxString> *AddressListCounty = NULL;
1387 std::map<int, wxString> *AddressListPostCode = NULL;
1388 std::map<int, wxString> *AddressListCountry = NULL;
1389 std::map<int, wxString> *AddressListLabel = NULL;
1390 std::map<int, wxString> *AddressListLang = NULL;
1391 std::map<int, wxString> *AddressListAltID = NULL;
1392 std::map<int, wxString> *AddressListPID = NULL;
1393 std::map<int, wxString> *AddressListTokens = NULL;
1394 std::map<int, wxString> *AddressListGeo = NULL;
1395 std::map<int, wxString> *AddressListTimezone = NULL;
1396 std::map<int, wxString> *AddressListType = NULL;
1397 std::map<int, wxString> *AddressListMediatype = NULL;
1398 std::map<int, int> *AddressListPref = NULL;
1402 AddressList = &GeneralAddressList;
1403 AddressListTown = &GeneralAddressListTown;
1404 AddressListCounty = &GeneralAddressListCounty;
1405 AddressListPostCode = &GeneralAddressListPostCode;
1406 AddressListCountry = &GeneralAddressListCountry;
1407 AddressListLabel = &GeneralAddressListLabel;
1408 AddressListLang = &GeneralAddressListLang;
1409 AddressListAltID = &GeneralAddressListAltID;
1410 AddressListPID = &GeneralAddressListPID;
1411 AddressListTokens = &GeneralAddressListTokens;
1412 AddressListGeo = &GeneralAddressListGeo;
1413 AddressListTimezone = &GeneralAddressListTimezone;
1414 AddressListType = &GeneralAddressListType;
1415 AddressListMediatype = &GeneralAddressListMediatype;
1416 AddressListPref = &GeneralAddressListPref;
1419 AddressList = &HomeAddressList;
1420 AddressListTown = &HomeAddressListTown;
1421 AddressListCounty = &HomeAddressListCounty;
1422 AddressListPostCode = &HomeAddressListPostCode;
1423 AddressListCountry = &HomeAddressListCountry;
1424 AddressListLabel = &HomeAddressListLabel;
1425 AddressListLang = &HomeAddressListLang;
1426 AddressListAltID = &HomeAddressListAltID;
1427 AddressListPID = &HomeAddressListPID;
1428 AddressListTokens = &HomeAddressListTokens;
1429 AddressListGeo = &HomeAddressListGeo;
1430 AddressListTimezone = &HomeAddressListTimezone;
1431 AddressListType = &HomeAddressListType;
1432 AddressListMediatype = &HomeAddressListMediatype;
1433 AddressListPref = &HomeAddressListPref;
1436 AddressList = &BusinessAddressList;
1437 AddressListTown = &BusinessAddressListTown;
1438 AddressListCounty = &BusinessAddressListCounty;
1439 AddressListPostCode = &BusinessAddressListPostCode;
1440 AddressListCountry = &BusinessAddressListCountry;
1441 AddressListLabel = &BusinessAddressListLabel;
1442 AddressListLang = &BusinessAddressListLang;
1443 AddressListAltID = &BusinessAddressListAltID;
1444 AddressListPID = &BusinessAddressListPID;
1445 AddressListTokens = &BusinessAddressListTokens;
1446 AddressListGeo = &BusinessAddressListGeo;
1447 AddressListTimezone = &BusinessAddressListTimezone;
1448 AddressListType = &BusinessAddressListType;
1449 AddressListMediatype = &BusinessAddressListMediatype;
1450 AddressListPref = &BusinessAddressListPref;
1456 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1457 intiter != SplitPoints.end(); ++intiter){
1459 SLiter = SplitLength.find(intiter->first);
1461 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1463 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1464 PropertyName = PropertyElement.GetNextToken();
1465 PropertyValue = PropertyElement.GetNextToken();
1467 intPrevValue = intiter->second;
1469 CaptureString(&PropertyValue, FALSE);
1471 // Process properties.
1473 if (PropertyName == wxT("LABEL")){
1475 AddressListLabel->erase(*AddressCount);
1476 AddressListLabel->insert(std::make_pair(*AddressCount, PropertyValue));
1478 } else if (PropertyName == wxT("LANGUAGE")){
1480 AddressListLang->erase(*AddressCount);
1481 AddressListLang->insert(std::make_pair(*AddressCount, PropertyValue));
1483 } else if (PropertyName == wxT("ALTID")){
1485 AddressListAltID->erase(*AddressCount);
1486 AddressListAltID->insert(std::make_pair(*AddressCount, PropertyValue));
1488 } else if (PropertyName == wxT("PID")){
1490 AddressListPID->erase(*AddressCount);
1491 AddressListPID->insert(std::make_pair(*AddressCount, PropertyValue));
1493 } else if (PropertyName == wxT("GEO")){
1495 AddressListGeo->erase(*AddressCount);
1496 AddressListGeo->insert(std::make_pair(*AddressCount, PropertyValue));
1498 } else if (PropertyName == wxT("TZ")){
1500 AddressListTimezone->erase(*AddressCount);
1501 AddressListTimezone->insert(std::make_pair(*AddressCount, PropertyValue));
1503 } else if (PropertyName == wxT("MEDIATYPE")){
1505 AddressListMediatype->erase(*AddressCount);
1506 AddressListMediatype->insert(std::make_pair(*AddressCount, PropertyValue));
1508 } else if (PropertyName == wxT("PREF")){
1510 int PriorityNumber = 0;
1511 bool ValidNumber = TRUE;
1514 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1517 catch(std::invalid_argument &e){
1518 ValidNumber = FALSE;
1521 if (ValidNumber == TRUE){
1523 AddressListPref->erase(*AddressCount);
1524 AddressListPref->insert(std::make_pair(*AddressCount, PriorityNumber));
1530 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1532 if (FirstToken == TRUE){
1534 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1539 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1549 // Split the address.
1551 //std::map<int, int>::iterator SLiter;
1552 intPropertyLen = PropertySeg2.Len();
1553 SplitPoints.clear();
1554 SplitLength.clear();
1559 for (int i = 0; i <= intPropertyLen; i++){
1563 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1566 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1568 if (intSplitsFound == 6){
1570 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1575 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1585 // Split the data into several parts.
1587 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1588 intiter != SplitPoints.end(); ++intiter){
1590 if (intiter->first == 1){
1592 // Deal with PO Box.
1594 SLiter = SplitLength.find(1);
1596 //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
1597 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1598 intPrevValue = intiter->second;
1600 } else if (intiter->first == 2){
1602 // Deal with extended address.
1604 SLiter = SplitLength.find(2);
1606 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1607 //txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1608 intPrevValue = intiter->second;
1610 } else if (intiter->first == 3){
1612 // Deal with street address.
1614 SLiter = SplitLength.find(3);
1616 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1617 //txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1618 intPrevValue = intiter->second;
1620 } else if (intiter->first == 4){
1622 // Deal with locality
1624 SLiter = SplitLength.find(4);
1626 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1627 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1628 intPrevValue = intiter->second;
1630 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1632 } else if (intiter->first == 5){
1634 // Deal with region.
1636 SLiter = SplitLength.find(5);
1638 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1639 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1640 intPrevValue = intiter->second;
1642 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1644 } else if (intiter->first == 6){
1646 // Deal with post code.
1648 SLiter = SplitLength.find(6);
1650 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1651 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1652 intPrevValue = intiter->second;
1654 // Deal with country.
1656 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1657 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1665 // Add the data to the General/Home/Work address variables.
1667 CaptureString(&AddressStreet, FALSE);
1668 CaptureString(&AddressLocality, FALSE);
1669 CaptureString(&AddressRegion, FALSE);
1670 CaptureString(&AddressPostalCode, FALSE);
1671 CaptureString(&AddressCountry, FALSE);
1673 if (!PropertyTokens.IsEmpty()){
1675 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1679 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1680 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1681 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1682 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1683 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1687 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1690 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1693 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1697 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1701 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1703 std::map<int, int> SplitPoints;
1704 std::map<int, int> SplitLength;
1706 int intPrevValue = 7;
1709 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1713 PropertyType PropType = PROPERTY_NONE;
1715 // Look for type before continuing.
1717 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1719 std::map<int, wxString> *EmailList = NULL;
1720 std::map<int, wxString> *EmailListType = NULL;
1721 std::map<int, wxString> *EmailListAltID = NULL;
1722 std::map<int, wxString> *EmailListPID = NULL;
1723 std::map<int, wxString> *EmailListTokens = NULL;
1724 std::map<int, int> *EmailListPref = NULL;
1728 EmailList = &GeneralEmailList;
1729 EmailListType = &GeneralEmailListType;
1730 EmailListAltID = &GeneralEmailListAltID;
1731 EmailListPID = &GeneralEmailListPID;
1732 EmailListTokens = &GeneralEmailListTokens;
1733 EmailListPref = &GeneralEmailListPref;
1736 EmailList = &HomeEmailList;
1737 EmailListType = &HomeEmailListType;
1738 EmailListAltID = &HomeEmailListAltID;
1739 EmailListPID = &HomeEmailListPID;
1740 EmailListTokens = &HomeEmailListTokens;
1741 EmailListPref = &HomeEmailListPref;
1744 EmailList = &BusinessEmailList;
1745 EmailListType = &BusinessEmailListType;
1746 EmailListAltID = &BusinessEmailListAltID;
1747 EmailListPID = &BusinessEmailListPID;
1748 EmailListTokens = &BusinessEmailListTokens;
1749 EmailListPref = &BusinessEmailListPref;
1755 std::map<int,int>::iterator SLiter;
1756 wxString PropertyData;
1757 wxString PropertyName;
1758 wxString PropertyValue;
1759 wxString PropertyTokens;
1760 bool FirstToken = TRUE;
1762 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1763 intiter != SplitPoints.end(); ++intiter){
1765 SLiter = SplitLength.find(intiter->first);
1767 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1769 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1770 PropertyName = PropertyElement.GetNextToken();
1771 PropertyValue = PropertyElement.GetNextToken();
1773 intPrevValue = intiter->second;
1775 CaptureString(&PropertyValue, FALSE);
1777 // Process properties.
1779 if (PropertyName == wxT("ALTID")){
1781 EmailListAltID->erase(*EmailCount);
1782 EmailListAltID->insert(std::make_pair(*EmailCount, PropertyValue));
1784 } else if (PropertyName == wxT("PID")){
1786 EmailListPID->erase(*EmailCount);
1787 EmailListPID->insert(std::make_pair(*EmailCount, PropertyValue));
1789 } else if (PropertyName == wxT("PREF")){
1791 int PriorityNumber = 0;
1792 bool ValidNumber = TRUE;
1795 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1798 catch(std::invalid_argument &e){
1799 ValidNumber = FALSE;
1802 if (ValidNumber == TRUE){
1804 EmailListPref->erase(*EmailCount);
1805 EmailListPref->insert(std::make_pair(*EmailCount, PriorityNumber));
1811 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1813 if (FirstToken == TRUE){
1815 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1820 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1830 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1832 // Add the name token data.
1834 if (!PropertyTokens.IsEmpty()){
1836 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1843 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1845 std::map<int, int> SplitPoints;
1846 std::map<int, int> SplitLength;
1848 int intPrevValue = 6;
1851 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1855 PropertyType PropType = PROPERTY_NONE;
1857 // Look for type before continuing.
1859 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1861 std::map<int, wxString> *IMList = NULL;
1862 std::map<int, wxString> *IMListType = NULL;
1863 std::map<int, wxString> *IMListAltID = NULL;
1864 std::map<int, wxString> *IMListPID = NULL;
1865 std::map<int, wxString> *IMListTokens = NULL;
1866 std::map<int, wxString> *IMListMediatype = NULL;
1867 std::map<int, int> *IMListPref = NULL;
1871 IMList = &GeneralIMList;
1872 IMListType = &GeneralIMListType;
1873 IMListAltID = &GeneralIMListAltID;
1874 IMListPID = &GeneralIMListPID;
1875 IMListTokens = &GeneralIMListTokens;
1876 IMListMediatype = &GeneralIMListMediatype;
1877 IMListPref = &GeneralIMListPref;
1880 IMList = &HomeIMList;
1881 IMListType = &HomeIMListType;
1882 IMListAltID = &HomeIMListAltID;
1883 IMListPID = &HomeIMListPID;
1884 IMListTokens = &HomeIMListTokens;
1885 IMListMediatype = &HomeIMListMediatype;
1886 IMListPref = &HomeIMListPref;
1889 IMList = &BusinessIMList;
1890 IMListType = &BusinessIMListType;
1891 IMListAltID = &BusinessIMListAltID;
1892 IMListPID = &BusinessIMListPID;
1893 IMListTokens = &BusinessIMListTokens;
1894 IMListMediatype = &BusinessIMListMediatype;
1895 IMListPref = &BusinessIMListPref;
1901 std::map<int,int>::iterator SLiter;
1902 wxString PropertyData;
1903 wxString PropertyName;
1904 wxString PropertyValue;
1905 wxString PropertyTokens;
1906 bool FirstToken = TRUE;
1908 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1909 intiter != SplitPoints.end(); ++intiter){
1911 SLiter = SplitLength.find(intiter->first);
1913 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1915 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1916 PropertyName = PropertyElement.GetNextToken();
1917 PropertyValue = PropertyElement.GetNextToken();
1919 intPrevValue = intiter->second;
1921 CaptureString(&PropertyValue, FALSE);
1923 // Process properties.
1925 if (PropertyName == wxT("ALTID")){
1927 IMListAltID->erase(*IMCount);
1928 IMListAltID->insert(std::make_pair(*IMCount, PropertyValue));
1930 } else if (PropertyName == wxT("PID")){
1932 IMListPID->erase(*IMCount);
1933 IMListPID->insert(std::make_pair(*IMCount, PropertyValue));
1935 } else if (PropertyName == wxT("MEDIATYPE")){
1937 IMListMediatype->erase(*IMCount);
1938 IMListMediatype->insert(std::make_pair(*IMCount, PropertyValue));
1940 } else if (PropertyName == wxT("PREF")){
1942 int PriorityNumber = 0;
1943 bool ValidNumber = TRUE;
1946 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1949 catch(std::invalid_argument &e){
1950 ValidNumber = FALSE;
1953 if (ValidNumber == TRUE){
1955 IMListPref->erase(*IMCount);
1956 IMListPref->insert(std::make_pair(*IMCount, PriorityNumber));
1962 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1964 if (FirstToken == TRUE){
1966 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1971 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1981 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
1983 // Add the name token data.
1985 if (!PropertyTokens.IsEmpty()){
1987 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
1993 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
1995 std::map<int, int> SplitPoints;
1996 std::map<int, int> SplitLength;
1997 std::map<int, int>::iterator SLiter;
2001 PropertyType PropType = PROPERTY_NONE;
2003 // Look for type before continuing.
2006 wxString TelTypeDetail;
2007 wxString PropertyData;
2008 wxString PropertyName;
2009 wxString PropertyValue;
2010 wxString PropertyTokens;
2012 std::map<int,int> TypeSplitPoints;
2013 std::map<int,int> TypeSplitLength;
2014 std::map<int,int>::iterator TSLiter;
2016 int intSplitSize = 0;
2017 int intSplitsFound = 0;
2018 int intSplitPoint = 0;
2020 int intPrevValue = 5;
2022 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2026 // Look for type before continuing.
2028 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2029 intiter != SplitPoints.end(); ++intiter){
2031 SLiter = SplitLength.find(intiter->first);
2033 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2035 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2036 PropertyName = PropertyElement.GetNextToken();
2037 PropertyValue = PropertyElement.GetNextToken();
2039 intPrevValue = intiter->second;
2041 if (PropertyName == wxT("TYPE")){
2043 // Process each value in type and translate each
2046 // Strip out the quotes if they are there.
2048 size_t intPropertyValueLen = PropertyValue.Len();
2050 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2052 PropertyValue.Trim();
2053 PropertyValue.RemoveLast();
2057 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2059 PropertyValue.Remove(0, 1);
2063 TelTypeDetail = PropertyValue;
2069 for (int i = 0; i <= intPropertyValueLen; i++){
2073 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2075 if (intSplitsFound == 0){
2077 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2078 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2082 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2083 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2096 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2097 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2099 int intTypeSeek = 0;
2101 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2102 typeiter != TypeSplitPoints.end(); ++typeiter){
2104 wxString TypePropertyName;
2106 TSLiter = TypeSplitLength.find(typeiter->first);
2108 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2110 if (intTypeSeek == 0){
2115 TelTypeUI.Append(wxT(","));
2119 if (TypePropertyName == wxT("home")){
2121 PropType = PROPERTY_HOME;
2123 } else if (TypePropertyName == wxT("work")){
2125 PropType = PROPERTY_WORK;
2130 if (TypePropertyName == wxT("text")){
2132 TelTypeUI.Append(_("text"));
2135 } else if (TypePropertyName == wxT("voice")){
2137 TelTypeUI.Append(_("voice"));
2140 } else if (TypePropertyName == wxT("fax")){
2142 TelTypeUI.Append(_("fax"));
2145 } else if (TypePropertyName == wxT("cell")){
2147 TelTypeUI.Append(_("mobile"));
2150 } else if (TypePropertyName == wxT("video")){
2152 TelTypeUI.Append(_("video"));
2155 } else if (TypePropertyName == wxT("pager")){
2157 TelTypeUI.Append(_("pager"));
2160 } else if (TypePropertyName == wxT("textphone")){
2162 TelTypeUI.Append(_("textphone"));
2173 std::map<int, wxString> *TelephoneList = NULL;
2174 std::map<int, wxString> *TelephoneListType = NULL;
2175 std::map<int, wxString> *TelephoneListAltID = NULL;
2176 std::map<int, wxString> *TelephoneListPID = NULL;
2177 std::map<int, wxString> *TelephoneListTokens = NULL;
2178 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2179 std::map<int, int> *TelephoneListPref = NULL;
2183 TelephoneList = &GeneralTelephoneList;
2184 TelephoneListType = &GeneralTelephoneListType;
2185 TelephoneListAltID = &GeneralTelephoneListAltID;
2186 TelephoneListPID = &GeneralTelephoneListPID;
2187 TelephoneListTokens = &GeneralTelephoneListTokens;
2188 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2189 TelephoneListPref = &GeneralTelephoneListPref;
2192 TelephoneList = &HomeTelephoneList;
2193 TelephoneListType = &HomeTelephoneListType;
2194 TelephoneListAltID = &HomeTelephoneListAltID;
2195 TelephoneListPID = &HomeTelephoneListPID;
2196 TelephoneListTokens = &HomeTelephoneListTokens;
2197 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2198 TelephoneListPref = &HomeTelephoneListPref;
2201 TelephoneList = &BusinessTelephoneList;
2202 TelephoneListType = &BusinessTelephoneListType;
2203 TelephoneListAltID = &BusinessTelephoneListAltID;
2204 TelephoneListPID = &BusinessTelephoneListPID;
2205 TelephoneListTokens = &BusinessTelephoneListTokens;
2206 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2207 TelephoneListPref = &BusinessTelephoneListPref;
2211 // Process the properties.
2213 bool FirstToken = TRUE;
2216 SplitPoints.clear();
2217 SplitLength.clear();
2219 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2223 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2224 intiter != SplitPoints.end(); ++intiter){
2226 SLiter = SplitLength.find(intiter->first);
2228 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2230 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2231 PropertyName = PropertyElement.GetNextToken();
2232 PropertyValue = PropertyElement.GetNextToken();
2234 intPrevValue = intiter->second;
2236 CaptureString(&PropertyValue, FALSE);
2238 // Process properties.
2240 if (PropertyName == wxT("ALTID")){
2242 TelephoneListAltID->erase(*TelephoneCount);
2243 TelephoneListAltID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2245 } else if (PropertyName == wxT("PID")){
2247 TelephoneListPID->erase(*TelephoneCount);
2248 TelephoneListPID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2250 } else if (PropertyName == wxT("PREF")){
2252 int PriorityNumber = 0;
2253 bool ValidNumber = TRUE;
2256 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2259 catch(std::invalid_argument &e){
2260 ValidNumber = FALSE;
2263 if (ValidNumber == TRUE){
2265 TelephoneListPref->erase(*TelephoneCount);
2266 TelephoneListPref->insert(std::make_pair(*TelephoneCount, PriorityNumber));
2272 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2274 if (FirstToken == TRUE){
2276 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2281 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2291 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2292 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2294 // Add the name token data.
2296 if (!PropertyTokens.IsEmpty()){
2298 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2304 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2306 std::map<int, int> SplitPoints;
2307 std::map<int, int> SplitLength;
2309 int intPrevValue = 6;
2312 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2316 PropertyType PropType = PROPERTY_NONE;
2318 // Look for type before continuing.
2320 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2322 std::map<int, wxString> *LanguageList = NULL;
2323 std::map<int, wxString> *LanguageListType = NULL;
2324 std::map<int, wxString> *LanguageListAltID = NULL;
2325 std::map<int, wxString> *LanguageListPID = NULL;
2326 std::map<int, wxString> *LanguageListTokens = NULL;
2327 std::map<int, int> *LanguageListPref = NULL;
2331 LanguageList = &GeneralLanguageList;
2332 LanguageListType = &GeneralLanguageListType;
2333 LanguageListAltID = &GeneralLanguageListAltID;
2334 LanguageListPID = &GeneralLanguageListPID;
2335 LanguageListTokens = &GeneralLanguageListTokens;
2336 LanguageListPref = &GeneralLanguageListPref;
2339 LanguageList = &HomeLanguageList;
2340 LanguageListType = &HomeLanguageListType;
2341 LanguageListAltID = &HomeLanguageListAltID;
2342 LanguageListPID = &HomeLanguageListPID;
2343 LanguageListTokens = &HomeLanguageListTokens;
2344 LanguageListPref = &HomeLanguageListPref;
2347 LanguageList = &BusinessLanguageList;
2348 LanguageListType = &BusinessLanguageListType;
2349 LanguageListAltID = &BusinessLanguageListAltID;
2350 LanguageListPID = &BusinessLanguageListPID;
2351 LanguageListTokens = &BusinessLanguageListTokens;
2352 LanguageListPref = &BusinessLanguageListPref;
2358 std::map<int,int>::iterator SLiter;
2359 wxString PropertyData;
2360 wxString PropertyName;
2361 wxString PropertyValue;
2362 wxString PropertyTokens;
2363 bool FirstToken = TRUE;
2365 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2366 intiter != SplitPoints.end(); ++intiter){
2368 SLiter = SplitLength.find(intiter->first);
2370 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2372 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2373 PropertyName = PropertyElement.GetNextToken();
2374 PropertyValue = PropertyElement.GetNextToken();
2376 intPrevValue = intiter->second;
2378 CaptureString(&PropertyValue, FALSE);
2380 // Process properties.
2382 if (PropertyName == wxT("ALTID")){
2384 LanguageListAltID->erase(*LanguageCount);
2385 LanguageListAltID->insert(std::make_pair(*LanguageCount, PropertyValue));
2387 } else if (PropertyName == wxT("PID")){
2389 LanguageListPID->erase(*LanguageCount);
2390 LanguageListPID->insert(std::make_pair(*LanguageCount, PropertyValue));
2392 } else if (PropertyName == wxT("PREF")){
2394 int PriorityNumber = 0;
2395 bool ValidNumber = TRUE;
2398 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2401 catch(std::invalid_argument &e){
2402 ValidNumber = FALSE;
2405 if (ValidNumber == TRUE){
2407 LanguageListPref->erase(*LanguageCount);
2408 LanguageListPref->insert(std::make_pair(*LanguageCount, PriorityNumber));
2414 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2416 if (FirstToken == TRUE){
2418 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2423 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2433 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2435 // Add the name token data.
2437 if (!PropertyTokens.IsEmpty()){
2439 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2445 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2447 std::map<int, int> SplitPoints;
2448 std::map<int, int> SplitLength;
2450 int intPrevValue = 5;
2453 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2457 PropertyType PropType = PROPERTY_NONE;
2459 // Look for type before continuing.
2461 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2463 std::map<int, wxString> *GeopositionList = NULL;
2464 std::map<int, wxString> *GeopositionListType = NULL;
2465 std::map<int, wxString> *GeopositionListAltID = NULL;
2466 std::map<int, wxString> *GeopositionListPID = NULL;
2467 std::map<int, wxString> *GeopositionListTokens = NULL;
2468 std::map<int, wxString> *GeopositionListMediatype = NULL;
2469 std::map<int, int> *GeopositionListPref = NULL;
2473 GeopositionList = &GeneralGeographyList;
2474 GeopositionListType = &GeneralGeographyListType;
2475 GeopositionListAltID = &GeneralGeographyListAltID;
2476 GeopositionListPID = &GeneralGeographyListPID;
2477 GeopositionListTokens = &GeneralGeographyListTokens;
2478 GeopositionListMediatype = &GeneralGeographyListMediatype;
2479 GeopositionListPref = &GeneralGeographyListPref;
2482 GeopositionList = &HomeGeographyList;
2483 GeopositionListType = &HomeGeographyListType;
2484 GeopositionListAltID = &HomeGeographyListAltID;
2485 GeopositionListPID = &HomeGeographyListPID;
2486 GeopositionListTokens = &HomeGeographyListTokens;
2487 GeopositionListMediatype = &HomeGeographyListMediatype;
2488 GeopositionListPref = &HomeGeographyListPref;
2491 GeopositionList = &BusinessGeographyList;
2492 GeopositionListType = &BusinessGeographyListType;
2493 GeopositionListAltID = &BusinessGeographyListAltID;
2494 GeopositionListPID = &BusinessGeographyListPID;
2495 GeopositionListTokens = &BusinessGeographyListTokens;
2496 GeopositionListMediatype = &BusinessGeographyListMediatype;
2497 GeopositionListPref = &BusinessGeographyListPref;
2503 std::map<int,int>::iterator SLiter;
2504 wxString PropertyData;
2505 wxString PropertyName;
2506 wxString PropertyValue;
2507 wxString PropertyTokens;
2508 bool FirstToken = TRUE;
2510 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2511 intiter != SplitPoints.end(); ++intiter){
2513 SLiter = SplitLength.find(intiter->first);
2515 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2517 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2518 PropertyName = PropertyElement.GetNextToken();
2519 PropertyValue = PropertyElement.GetNextToken();
2521 intPrevValue = intiter->second;
2523 CaptureString(&PropertyValue, FALSE);
2525 // Process properties.
2527 if (PropertyName == wxT("ALTID")){
2529 GeopositionListAltID->erase(*GeographicCount);
2530 GeopositionListAltID->insert(std::make_pair(*GeographicCount, PropertyValue));
2532 } else if (PropertyName == wxT("PID")){
2534 GeopositionListPID->erase(*GeographicCount);
2535 GeopositionListPID->insert(std::make_pair(*GeographicCount, PropertyValue));
2537 } else if (PropertyName == wxT("MEDIATYPE")){
2539 GeopositionListMediatype->erase(*GeographicCount);
2540 GeopositionListMediatype->insert(std::make_pair(*GeographicCount, PropertyValue));
2542 } else if (PropertyName == wxT("PREF")){
2544 int PriorityNumber = 0;
2545 bool ValidNumber = TRUE;
2548 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2551 catch(std::invalid_argument &e){
2552 ValidNumber = FALSE;
2555 if (ValidNumber == TRUE){
2557 GeopositionListPref->erase(*GeographicCount);
2558 GeopositionListPref->insert(std::make_pair(*GeographicCount, PriorityNumber));
2564 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2566 if (FirstToken == TRUE){
2568 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2573 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2583 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2585 // Add the name token data.
2587 if (!PropertyTokens.IsEmpty()){
2589 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2595 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2597 size_t intPropertyLen = PropertySeg1.Len();
2598 std::map<int, int> SplitPoints;
2599 std::map<int, int> SplitLength;
2600 std::map<int, int>::iterator SLiter;
2601 wxString PropertyData;
2602 wxString PropertyName;
2603 wxString PropertyValue;
2604 wxString PropertyTokens;
2605 wxString RelatedType;
2606 wxString RelatedTypeOriginal;
2607 wxString RelatedName;
2608 bool FirstToken = TRUE;
2609 int intSplitsFound = 0;
2610 int intSplitSize = 0;
2611 int intPrevValue = 9;
2615 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2619 // Look for type before continuing.
2621 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2622 intiter != SplitPoints.end(); ++intiter){
2624 SLiter = SplitLength.find(intiter->first);
2626 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2628 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2629 PropertyName = PropertyElement.GetNextToken();
2630 PropertyValue = PropertyElement.GetNextToken();
2632 intPrevValue = intiter->second;
2636 RelatedTypeOriginal = PropertyValue;
2638 if (PropertyName == wxT("TYPE")){
2640 if (PropertyValue == wxT("contact")){
2642 RelatedType = _("Contact");
2644 } else if (PropertyValue == wxT("acquaintance")){
2646 RelatedType = _("Acquaintance");
2648 } else if (PropertyValue == wxT("friend")){
2650 RelatedType = _("Friend");
2652 } else if (PropertyValue == wxT("met")){
2654 RelatedType = _("Met");
2656 } else if (PropertyValue == wxT("co-worker")){
2658 RelatedType = _("Co-worker");
2660 } else if (PropertyValue == wxT("colleague")){
2662 RelatedType = _("Colleague");
2664 } else if (PropertyValue == wxT("co-resident")){
2666 RelatedType = _("Co-resident");
2668 } else if (PropertyValue == wxT("neighbor")){
2670 RelatedType = _("Neighbour");
2672 } else if (PropertyValue == wxT("child")){
2674 RelatedType = _("Child");
2676 } else if (PropertyValue == wxT("parent")){
2678 RelatedType = _("Parent");
2680 } else if (PropertyValue == wxT("sibling")){
2682 RelatedType = _("Sibling");
2684 } else if (PropertyValue == wxT("spouse")){
2686 RelatedType = _("Spouse");
2688 } else if (PropertyValue == wxT("kin")){
2690 RelatedType = _("Kin");
2692 } else if (PropertyValue == wxT("muse")){
2694 RelatedType = _("Muse");
2696 } else if (PropertyValue == wxT("crush")){
2698 RelatedType = _("Crush");
2700 } else if (PropertyValue == wxT("date")){
2702 RelatedType = _("Date");
2704 } else if (PropertyValue == wxT("sweetheart")){
2706 RelatedType = _("Sweetheart");
2708 } else if (PropertyValue == wxT("me")){
2710 RelatedType = _("Me");
2712 } else if (PropertyValue == wxT("agent")){
2714 RelatedType = _("Agent");
2716 } else if (PropertyValue == wxT("emergency")){
2718 RelatedType = _("Emergency");
2722 RelatedType = PropertyValue;
2732 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2733 intiter != SplitPoints.end(); ++intiter){
2735 SLiter = SplitLength.find(intiter->first);
2737 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2739 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2740 PropertyName = PropertyElement.GetNextToken();
2741 PropertyValue = PropertyElement.GetNextToken();
2743 intPrevValue = intiter->second;
2745 // Process properties.
2747 size_t intPropertyValueLen = PropertyValue.Len();
2749 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2751 PropertyValue.Trim();
2752 PropertyValue.RemoveLast();
2756 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2758 PropertyValue.Remove(0, 1);
2762 CaptureString(&PropertyValue, FALSE);
2764 if (PropertyName == wxT("ALTID")){
2766 GeneralRelatedListAltID.erase(*RelatedCount);
2767 GeneralRelatedListAltID.insert(std::make_pair(*RelatedCount, PropertyValue));
2769 } else if (PropertyName == wxT("PID")){
2771 GeneralRelatedListPID.erase(*RelatedCount);
2772 GeneralRelatedListPID.insert(std::make_pair(*RelatedCount, PropertyValue));
2774 } else if (PropertyName == wxT("PREF")){
2776 int PriorityNumber = 0;
2777 bool ValidNumber = TRUE;
2780 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2783 catch(std::invalid_argument &e){
2784 ValidNumber = FALSE;
2787 if (ValidNumber == TRUE){
2789 GeneralRelatedListPref.erase(*RelatedCount);
2790 GeneralRelatedListPref.insert(std::make_pair(*RelatedCount, PriorityNumber));
2794 } else if (PropertyName == wxT("LANGUAGE")){
2796 GeneralRelatedListLanguage.erase(*RelatedCount);
2797 GeneralRelatedListLanguage.insert(std::make_pair(*RelatedCount, PropertyValue));
2799 } else if (PropertyName != wxT("TYPE")) {
2801 // Something else we don't know about so append
2802 // to the tokens variable.
2804 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2806 if (FirstToken == TRUE){
2808 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2813 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2823 // Add the data to the General/Home/Work address variables.
2825 GeneralRelatedList.erase(*RelatedCount);
2826 GeneralRelatedListRelType.erase(*RelatedCount);
2827 GeneralRelatedListType.erase(*RelatedCount);
2828 GeneralRelatedListTokens.erase(*RelatedCount);
2829 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2830 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2831 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2832 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2836 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2838 std::map<int, int> SplitPoints;
2839 std::map<int, int> SplitLength;
2840 std::map<int, int>::iterator SLiter;
2841 wxString PropertyData;
2842 wxString PropertyName;
2843 wxString PropertyValue;
2844 wxString PropertyTokens;
2845 bool FirstToken = TRUE;
2846 int intPrevValue = 5;
2851 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2855 PropertyType PropType = PROPERTY_NONE;
2857 // Look for type before continuing.
2859 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2861 // Setup the pointers.
2863 std::map<int, wxString> *WebsiteList = NULL;
2864 std::map<int, wxString> *WebsiteListAltID = NULL;
2865 std::map<int, wxString> *WebsiteListPID = NULL;
2866 std::map<int, wxString> *WebsiteListType = NULL;
2867 std::map<int, wxString> *WebsiteListTokens = NULL;
2868 std::map<int, wxString> *WebsiteListMediatype = NULL;
2869 std::map<int, int> *WebsiteListPref = NULL;
2871 // Setup blank lines for later on.
2875 WebsiteList = &GeneralWebsiteList;
2876 WebsiteListType = &GeneralWebsiteListType;
2877 WebsiteListAltID = &GeneralWebsiteListAltID;
2878 WebsiteListPID = &GeneralWebsiteListPID;
2879 WebsiteListTokens = &GeneralWebsiteListTokens;
2880 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2881 WebsiteListPref = &GeneralWebsiteListPref;
2884 WebsiteList = &HomeWebsiteList;
2885 WebsiteListType = &HomeWebsiteListType;
2886 WebsiteListAltID = &HomeWebsiteListAltID;
2887 WebsiteListPID = &HomeWebsiteListPID;
2888 WebsiteListTokens = &HomeWebsiteListTokens;
2889 WebsiteListMediatype = &HomeWebsiteListMediatype;
2890 WebsiteListPref = &HomeWebsiteListPref;
2893 WebsiteList = &BusinessWebsiteList;
2894 WebsiteListType = &BusinessWebsiteListType;
2895 WebsiteListAltID = &BusinessWebsiteListAltID;
2896 WebsiteListPID = &BusinessWebsiteListPID;
2897 WebsiteListTokens = &BusinessWebsiteListTokens;
2898 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2899 WebsiteListPref = &BusinessWebsiteListPref;
2905 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2906 intiter != SplitPoints.end(); ++intiter){
2908 SLiter = SplitLength.find(intiter->first);
2910 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2912 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2913 PropertyName = PropertyElement.GetNextToken();
2914 PropertyValue = PropertyElement.GetNextToken();
2916 intPrevValue = intiter->second;
2918 // Process properties.
2920 size_t intPropertyValueLen = PropertyValue.Len();
2922 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2924 PropertyValue.Trim();
2925 PropertyValue.RemoveLast();
2929 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2931 PropertyValue.Remove(0, 1);
2935 CaptureString(&PropertyValue, FALSE);
2937 if (PropertyName == wxT("ALTID")){
2939 WebsiteListAltID->erase(*URLCount);
2940 WebsiteListAltID->insert(std::make_pair(*URLCount, PropertyValue));
2942 } else if (PropertyName == wxT("PID")){
2944 WebsiteListPID->erase(*URLCount);
2945 WebsiteListPID->insert(std::make_pair(*URLCount, PropertyValue));
2947 } else if (PropertyName == wxT("PREF")){
2949 int PriorityNumber = 0;
2950 bool ValidNumber = TRUE;
2953 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2956 catch(std::invalid_argument &e){
2957 ValidNumber = FALSE;
2960 if (ValidNumber == TRUE){
2962 WebsiteListPref->erase(*URLCount);
2963 WebsiteListPref->insert(std::make_pair(*URLCount, PriorityNumber));
2967 } else if (PropertyName == wxT("MEDIATYPE")){
2969 WebsiteListMediatype->erase(*URLCount);
2970 WebsiteListMediatype->insert(std::make_pair(*URLCount, PropertyValue));
2974 // Something else we don't know about so append
2975 // to the tokens variable.
2977 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2979 if (FirstToken == TRUE){
2981 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2986 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2996 // Add the data to the General/Home/Work address variables.
2998 CaptureString(&PropertySeg2, FALSE);
3000 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3002 if (!PropertyTokens.IsEmpty()){
3004 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3010 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3012 std::map<int, int> SplitPoints;
3013 std::map<int, int> SplitLength;
3014 std::map<int, int>::iterator SLiter;
3015 wxString PropertyData;
3016 wxString PropertyName;
3017 wxString PropertyValue;
3018 wxString PropertyTokens;
3019 bool FirstToken = TRUE;
3020 int intPrevValue = 7;
3025 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3029 PropertyType PropType = PROPERTY_NONE;
3031 // Look for type before continuing.
3033 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3035 // Setup the pointers.
3037 std::map<int, wxString> *TitleList = NULL;
3038 std::map<int, wxString> *TitleListAltID = NULL;
3039 std::map<int, wxString> *TitleListPID = NULL;
3040 std::map<int, wxString> *TitleListType = NULL;
3041 std::map<int, wxString> *TitleListTokens = NULL;
3042 std::map<int, wxString> *TitleListLanguage = NULL;
3043 std::map<int, int> *TitleListPref = NULL;
3045 // Setup blank lines for later on.
3049 TitleList = &GeneralTitleList;
3050 TitleListType = &GeneralTitleListType;
3051 TitleListAltID = &GeneralTitleListAltID;
3052 TitleListPID = &GeneralTitleListPID;
3053 TitleListTokens = &GeneralTitleListTokens;
3054 TitleListLanguage = &GeneralTitleListLanguage;
3055 TitleListPref = &GeneralTitleListPref;
3058 TitleList = &HomeTitleList;
3059 TitleListType = &HomeTitleListType;
3060 TitleListAltID = &HomeTitleListAltID;
3061 TitleListPID = &HomeTitleListPID;
3062 TitleListTokens = &HomeTitleListTokens;
3063 TitleListLanguage = &HomeTitleListLanguage;
3064 TitleListPref = &HomeTitleListPref;
3067 TitleList = &BusinessTitleList;
3068 TitleListType = &BusinessTitleListType;
3069 TitleListAltID = &BusinessTitleListAltID;
3070 TitleListPID = &BusinessTitleListPID;
3071 TitleListTokens = &BusinessTitleListTokens;
3072 TitleListLanguage = &BusinessTitleListLanguage;
3073 TitleListPref = &BusinessTitleListPref;
3079 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3080 intiter != SplitPoints.end(); ++intiter){
3082 SLiter = SplitLength.find(intiter->first);
3084 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3086 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3087 PropertyName = PropertyElement.GetNextToken();
3088 PropertyValue = PropertyElement.GetNextToken();
3090 intPrevValue = intiter->second;
3092 // Process properties.
3094 size_t intPropertyValueLen = PropertyValue.Len();
3096 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3098 PropertyValue.Trim();
3099 PropertyValue.RemoveLast();
3103 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3105 PropertyValue.Remove(0, 1);
3109 CaptureString(&PropertyValue, FALSE);
3111 if (PropertyName == wxT("ALTID")){
3113 TitleListAltID->erase(*TitleCount);
3114 TitleListAltID->insert(std::make_pair(*TitleCount, PropertyValue));
3116 } else if (PropertyName == wxT("PID")){
3118 TitleListPID->erase(*TitleCount);
3119 TitleListPID->insert(std::make_pair(*TitleCount, PropertyValue));
3121 } else if (PropertyName == wxT("PREF")){
3123 int PriorityNumber = 0;
3124 bool ValidNumber = TRUE;
3127 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3130 catch(std::invalid_argument &e){
3131 ValidNumber = FALSE;
3134 if (ValidNumber == TRUE){
3136 TitleListPref->erase(*TitleCount);
3137 TitleListPref->insert(std::make_pair(*TitleCount, PriorityNumber));
3141 } else if (PropertyName == wxT("LANGUAGE")){
3143 TitleListLanguage->erase(*TitleCount);
3144 TitleListLanguage->insert(std::make_pair(*TitleCount, PropertyValue));
3148 // Something else we don't know about so append
3149 // to the tokens variable.
3151 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3153 if (FirstToken == TRUE){
3155 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3160 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3170 // Add the data to the General/Home/Work address variables.
3172 CaptureString(&PropertySeg2, FALSE);
3174 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3176 if (!PropertyTokens.IsEmpty()){
3178 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3184 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3186 std::map<int, int> SplitPoints;
3187 std::map<int, int> SplitLength;
3188 std::map<int, int>::iterator SLiter;
3189 wxString PropertyData;
3190 wxString PropertyName;
3191 wxString PropertyValue;
3192 wxString PropertyTokens;
3193 bool FirstToken = TRUE;
3194 int intPrevValue = 6;
3199 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3203 PropertyType PropType = PROPERTY_NONE;
3205 // Look for type before continuing.
3207 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3209 // Setup the pointers.
3211 std::map<int, wxString> *RoleList = NULL;
3212 std::map<int, wxString> *RoleListAltID = NULL;
3213 std::map<int, wxString> *RoleListPID = NULL;
3214 std::map<int, wxString> *RoleListType = NULL;
3215 std::map<int, wxString> *RoleListTokens = NULL;
3216 std::map<int, wxString> *RoleListLanguage = NULL;
3217 std::map<int, int> *RoleListPref = NULL;
3219 // Setup blank lines for later on.
3223 RoleList = &GeneralRoleList;
3224 RoleListType = &GeneralRoleListType;
3225 RoleListAltID = &GeneralRoleListAltID;
3226 RoleListPID = &GeneralRoleListPID;
3227 RoleListTokens = &GeneralRoleListTokens;
3228 RoleListLanguage = &GeneralRoleListLanguage;
3229 RoleListPref = &GeneralRoleListPref;
3232 RoleList = &HomeRoleList;
3233 RoleListType = &HomeRoleListType;
3234 RoleListAltID = &HomeRoleListAltID;
3235 RoleListPID = &HomeRoleListPID;
3236 RoleListTokens = &HomeRoleListTokens;
3237 RoleListLanguage = &HomeRoleListLanguage;
3238 RoleListPref = &HomeRoleListPref;
3241 RoleList = &BusinessRoleList;
3242 RoleListType = &BusinessRoleListType;
3243 RoleListAltID = &BusinessRoleListAltID;
3244 RoleListPID = &BusinessRoleListPID;
3245 RoleListTokens = &BusinessRoleListTokens;
3246 RoleListLanguage = &BusinessRoleListLanguage;
3247 RoleListPref = &BusinessRoleListPref;
3253 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3254 intiter != SplitPoints.end(); ++intiter){
3256 SLiter = SplitLength.find(intiter->first);
3258 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3260 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3261 PropertyName = PropertyElement.GetNextToken();
3262 PropertyValue = PropertyElement.GetNextToken();
3264 intPrevValue = intiter->second;
3266 // Process properties.
3268 size_t intPropertyValueLen = PropertyValue.Len();
3270 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3272 PropertyValue.Trim();
3273 PropertyValue.RemoveLast();
3277 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3279 PropertyValue.Remove(0, 1);
3283 CaptureString(&PropertyValue, FALSE);
3285 if (PropertyName == wxT("ALTID")){
3287 RoleListAltID->erase(*RoleCount);
3288 RoleListAltID->insert(std::make_pair(*RoleCount, PropertyValue));
3290 } else if (PropertyName == wxT("PID")){
3292 RoleListPID->erase(*RoleCount);
3293 RoleListPID->insert(std::make_pair(*RoleCount, PropertyValue));
3295 } else if (PropertyName == wxT("PREF")){
3297 int PriorityNumber = 0;
3298 bool ValidNumber = TRUE;
3301 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3304 catch(std::invalid_argument &e){
3305 ValidNumber = FALSE;
3308 if (ValidNumber == TRUE){
3310 RoleListPref->erase(*RoleCount);
3311 RoleListPref->insert(std::make_pair(*RoleCount, PriorityNumber));
3315 } else if (PropertyName == wxT("LANGUAGE")){
3317 RoleListLanguage->erase(*RoleCount);
3318 RoleListLanguage->insert(std::make_pair(*RoleCount, PropertyValue));
3322 // Something else we don't know about so append
3323 // to the tokens variable.
3325 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3327 if (FirstToken == TRUE){
3329 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3334 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3344 // Add the data to the General/Home/Work address variables.
3346 CaptureString(&PropertySeg2, FALSE);
3348 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3350 if (!PropertyTokens.IsEmpty()){
3352 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3358 void SplitValues(wxString *PropertyLine,
3359 std::map<int,int> *SplitPoints,
3360 std::map<int,int> *SplitLength,
3363 size_t intPropertyLen = PropertyLine->Len();
3364 int intSplitsFound = 0;
3365 int intSplitSize = 0;
3366 int intSplitSeek = 0;
3368 for (int i = intSize; i <= intPropertyLen; i++){
3372 if (PropertyLine->Mid(i, 1) == wxT(";") &&
3373 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
3375 if (intSplitsFound == 0){
3377 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
3381 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3385 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
3395 if (intSplitsFound == 0){
3397 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
3398 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
3402 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3403 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
3409 void CheckType(wxString *PropertySeg1,
3410 std::map<int,int> *SplitPoints,
3411 std::map<int,int> *SplitLength,
3413 PropertyType *PropType){
3415 wxString PropertyData;
3416 wxString PropertyName;
3417 wxString PropertyValue;
3418 std::map<int,int>::iterator SLiter;
3420 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
3421 intiter != SplitPoints->end(); ++intiter){
3423 SLiter = SplitLength->find(intiter->first);
3425 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
3427 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3428 PropertyName = PropertyElement.GetNextToken();
3429 PropertyValue = PropertyElement.GetNextToken();
3431 *intPrevValue = intiter->second;
3433 if (PropertyName == wxT("TYPE")){
3435 if (PropertyValue == wxT("work")){
3437 *PropType = PROPERTY_WORK;
3439 } else if (PropertyValue == wxT("home")){
3441 *PropType = PROPERTY_HOME;
3445 *PropType = PROPERTY_NONE;