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;
94 wxString PropertyLine;
95 wxString PropertySeg1;
96 wxString PropertySeg2;
97 wxString PropertyNextLine;
100 for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
101 iter != ContactFileLines.end(); ++iter){
103 ExtraLineSeek = TRUE;
109 PropertyLine.Clear();
110 PropertySeg1.Clear();
111 PropertySeg2.Clear();
114 ContactLine = iter->second;
116 while (ExtraLineSeek == TRUE){
118 // Check if there is extra data on the next line
119 // (indicated by space or tab at the start) and add data.
123 if (iter == ContactFileLines.end()){
130 PropertyNextLine = iter->second;
132 if (PropertyNextLine.Mid(0, 1) == wxT(" ") || PropertyNextLine.Mid(0, 1) == wxT("\t")){
134 PropertyNextLine.Remove(0, 1);
135 ContactLine.Append(PropertyNextLine);
140 ExtraLineSeek = FALSE;
146 ContactLineLen = ContactLine.Len();
148 // Make sure we are not in quotation mode.
149 // Make sure colon does not have \ or \\ before it.
151 for (int i = 0; i <= ContactLineLen; i++){
153 if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
155 PropertyFind = FALSE;
157 } else if (PropertyFind == TRUE){
159 Property.Append(ContactLine.Mid(i, 1));
163 if (ContactLine.Mid(i, 1) == wxT("\"")){
165 if (QuoteMode == TRUE){
177 if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
186 // Split that line at the point into two variables (ignore the colon).
188 PropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
189 PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
191 if (Property == wxT("KIND") && KindProcessed == FALSE){
193 ProcessKind(PropertySeg2);
195 } else if (Property == wxT("MEMBER")){
197 ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
200 } else if (Property == wxT("FN")){
202 ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
205 } else if (Property == wxT("N") && NameProcessed == FALSE){
207 ProcessN(PropertySeg1, PropertySeg2);
208 NameProcessed = TRUE;
210 } else if (Property == wxT("NICKNAME")){
212 ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
215 } else if (Property == wxT("GENDER") && GenderProcessed == FALSE){
217 ProcessGender(PropertySeg1, PropertySeg2);
218 GenderProcessed = TRUE;
220 } else if (Property == wxT("BDAY") && BirthdayProcessed == FALSE){
222 ProcessBirthday(PropertySeg1, PropertySeg2);
223 BirthdayProcessed = TRUE;
225 } else if (Property == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
227 ProcessAnniversary(PropertySeg1, PropertySeg2);
228 AnniversaryProcessed = TRUE;
230 } else if (Property == wxT("TZ")){
232 ProcessTimeZone(PropertySeg1, PropertySeg2, &TimeZoneCount);
235 } else if (Property == wxT("ADR")){
237 ProcessAddress(PropertySeg1, PropertySeg2, &AddressCount);
240 } else if (Property == wxT("EMAIL")){
242 ProcessEmail(PropertySeg1, PropertySeg2, &EmailCount);
245 } else if (Property == wxT("IMPP")){
247 ProcessIM(PropertySeg1, PropertySeg2, &IMCount);
250 } else if (Property == wxT("TEL")){
252 ProcessTelephone(PropertySeg1, PropertySeg2, &TelephoneCount);
255 } else if (Property == wxT("LANG")){
257 // See frmContactEditor-LoadLanguage.cpp
259 ProcessLanguage(PropertySeg1, PropertySeg2, &LanguageCount);
262 } else if (Property == wxT("GEO")){
264 // See frmContactEditor-LoadGeo.cpp
266 ProcessGeographic(PropertySeg1, PropertySeg2, &GeographicCount);
273 return CONTACTLOAD_OK;
277 void ContactDataObject::ProcessKind(wxString KindType){
279 if (KindType == wxT("individual")){
281 ContactKind = CONTACTKIND_INDIVIDUAL;
283 } else if (KindType == wxT("group")){
285 ContactKind = CONTACTKIND_GROUP;
287 } else if (KindType == wxT("org")){
289 ContactKind = CONTACTKIND_ORGANISATION;
291 } else if (KindType == wxT("location")){
293 ContactKind = CONTACTKIND_LOCATION;
297 ContactKind = CONTACTKIND_NONE;
302 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
304 std::map<int, int> SplitPoints;
305 std::map<int, int> SplitLength;
307 int intPrevValue = 8;
311 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
315 wxString PropertyName;
316 wxString PropertyValue;
317 wxString PropertyData;
318 wxString PropertyTokens;
319 std::map<int,int>::iterator SLiter;
320 bool FirstToken = TRUE;
322 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
323 intiter != SplitPoints.end(); ++intiter){
325 SLiter = SplitLength.find(intiter->first);
327 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
329 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
330 PropertyName = PropertyElement.GetNextToken();
331 PropertyValue = PropertyElement.GetNextToken();
333 intPrevValue = intiter->second;
335 CaptureString(&PropertyValue, FALSE);
337 if (PropertyName == wxT("ALTID")){
339 GroupsListAltID.erase(*GroupCount);
340 GroupsListAltID.insert(std::make_pair(*GroupCount, PropertyValue));
342 } else if (PropertyName == wxT("PID")){
344 GroupsListPID.erase(*GroupCount);
345 GroupsListPID.insert(std::make_pair(*GroupCount, PropertyValue));
347 } else if (PropertyName == wxT("PREF")){
349 int PriorityNumber = 0;
350 bool ValidNumber = TRUE;
353 PriorityNumber = std::stoi(PropertyValue.ToStdString());
356 catch(std::invalid_argument &e){
360 if (ValidNumber == TRUE){
362 GroupsListPref.erase(*GroupCount);
363 GroupsListPref.insert(std::make_pair(*GroupCount, PriorityNumber));
367 } else if (PropertyName == wxT("MEDIATYPE")){
369 GroupsListMediaType.erase(*GroupCount);
370 GroupsListMediaType.insert(std::make_pair(*GroupCount, PropertyValue));
372 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
374 if (FirstToken == TRUE){
376 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
381 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
389 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
391 if (!PropertyTokens.IsEmpty()){
393 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
400 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
402 std::map<int, int> SplitPoints;
403 std::map<int, int> SplitLength;
405 int intPrevValue = 4;
409 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
413 wxString PropertyName;
414 wxString PropertyValue;
415 wxString PropertyData;
416 wxString PropertyTokens;
417 std::map<int,int>::iterator SLiter;
418 bool FirstToken = TRUE;
420 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
421 intiter != SplitPoints.end(); ++intiter){
423 SLiter = SplitLength.find(intiter->first);
425 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
427 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
428 PropertyName = PropertyElement.GetNextToken();
429 PropertyValue = PropertyElement.GetNextToken();
431 intPrevValue = intiter->second;
433 CaptureString(&PropertyValue, FALSE);
435 if (PropertyName == wxT("TYPE")){
437 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
438 PropertyValue == wxT("work") ){
440 FullNamesListType.erase(*FNCount);
441 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
445 } else if (PropertyName == wxT("LANGUAGE")){
447 FullNamesListLanguage.erase(*FNCount);
448 FullNamesListLanguage.insert(std::make_pair(*FNCount, PropertyValue));
450 } else if (PropertyName == wxT("ALTID")){
452 FullNamesListAltID.erase(*FNCount);
453 FullNamesListAltID.insert(std::make_pair(*FNCount, PropertyValue));
455 } else if (PropertyName == wxT("PID")){
457 FullNamesListPID.erase(*FNCount);
458 FullNamesListPID.insert(std::make_pair(*FNCount, PropertyValue));
460 } else if (PropertyName == wxT("PREF")){
462 int PriorityNumber = 0;
463 bool ValidNumber = TRUE;
466 PriorityNumber = std::stoi(PropertyValue.ToStdString());
469 catch(std::invalid_argument &e){
473 if (ValidNumber == TRUE){
475 FullNamesListPref.erase(*FNCount);
476 FullNamesListPref.insert(std::make_pair(*FNCount, PriorityNumber));
480 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
482 if (FirstToken == TRUE){
484 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
489 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
497 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
499 if (!PropertyTokens.IsEmpty()){
501 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
507 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
509 std::map<int, int> SplitPoints;
510 std::map<int, int> SplitLength;
512 int intPrevValue = 3;
516 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
520 wxString PropertyName;
521 wxString PropertyValue;
522 wxString PropertyData;
523 wxString PropertyTokens;
524 std::map<int,int>::iterator SLiter;
525 bool FirstToken = TRUE;
527 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
528 intiter != SplitPoints.end(); ++intiter){
530 SLiter = SplitLength.find(intiter->first);
532 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
534 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
535 PropertyName = PropertyElement.GetNextToken();
536 PropertyValue = PropertyElement.GetNextToken();
538 intPrevValue = intiter->second;
540 CaptureString(&PropertyValue, FALSE);
542 if (PropertyName == wxT("ALTID")){
544 NameAltID = PropertyValue;
546 } else if (PropertyName == wxT("LANGUAGE")){
548 NameLanguage = PropertyValue;
550 } else if (PropertyName == wxT("SORT-AS")){
552 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
553 PropertyValue.Len() >= 3){
554 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
557 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
559 if (FirstToken == TRUE){
561 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
566 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
574 // Split the name data.
576 int intSplitSeek = 0;
577 int intSplitsFound = 0;
578 int intSplitSize = 0;
579 int intPropertyLen = PropertySeg2.Len();
581 std::map<int,wxString> NameValues;
584 for (int i = 0; i <= intPropertyLen; i++){
586 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
588 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
593 if (intSplitsFound == 4){
595 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
609 // Split the data into several parts.
611 for (std::map<int, wxString>::iterator iter = NameValues.begin();
612 iter != NameValues.end(); ++iter){
614 if (iter->first == 1){
616 // Deal with family name.
618 NameSurname = iter->second;
620 } else if (iter->first == 2){
622 // Deal with given names.
624 NameForename = iter->second;
626 } else if (iter->first == 3){
628 // Deal with additional names.
630 NameOtherNames = iter->second;
632 } else if (iter->first == 4){
634 // Deal with honorifix prefixes and suffixes.
636 NameTitle = iter->second;
640 if (iter == NameValues.end()){
646 NameSuffix = iter->second;
652 // Add the name token data.
654 if (!PropertyTokens.IsEmpty()){
656 NameTokens = PropertyTokens;
662 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
664 std::map<int, int> SplitPoints;
665 std::map<int, int> SplitLength;
667 int intPrevValue = 10;
670 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
674 PropertyType PropType = PROPERTY_NONE;
676 // Look for type before continuing.
678 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
682 std::map<int, wxString> *NicknamesList = NULL;
683 std::map<int, wxString> *NicknamesListType = NULL;
684 std::map<int, wxString> *NicknamesListLanguage = NULL;
685 std::map<int, wxString> *NicknamesListAltID = NULL;
686 std::map<int, wxString> *NicknamesListPID = NULL;
687 std::map<int, wxString> *NicknamesListTokens = NULL;
688 std::map<int, int> *NicknamesListPref = NULL;
692 NicknamesList = &GeneralNicknamesList;
693 NicknamesListType = &GeneralNicknamesListType;
694 NicknamesListLanguage = &GeneralNicknamesListLanguage;
695 NicknamesListAltID = &GeneralNicknamesListAltID;
696 NicknamesListPID = &GeneralNicknamesListPID;
697 NicknamesListTokens = &GeneralNicknamesListTokens;
698 NicknamesListPref = &GeneralNicknamesListPref;
701 NicknamesList = &HomeNicknamesList;
702 NicknamesListType = &HomeNicknamesListType;
703 NicknamesListLanguage = &HomeNicknamesListLanguage;
704 NicknamesListAltID = &HomeNicknamesListAltID;
705 NicknamesListPID = &HomeNicknamesListPID;
706 NicknamesListTokens = &HomeNicknamesListTokens;
707 NicknamesListPref = &HomeNicknamesListPref;
710 NicknamesList = &BusinessNicknamesList;
711 NicknamesListType = &BusinessNicknamesListType;
712 NicknamesListLanguage = &BusinessNicknamesListLanguage;
713 NicknamesListAltID = &BusinessNicknamesListAltID;
714 NicknamesListPID = &BusinessNicknamesListPID;
715 NicknamesListTokens = &BusinessNicknamesListTokens;
716 NicknamesListPref = &BusinessNicknamesListPref;
720 std::map<int, int>::iterator SLiter;
721 wxString PropertyData;
722 wxString PropertyName;
723 wxString PropertyValue;
724 wxString PropertyTokens;
725 bool FirstToken = TRUE;
727 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
728 intiter != SplitPoints.end(); ++intiter){
730 SLiter = SplitLength.find(intiter->first);
732 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
734 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
735 PropertyName = PropertyElement.GetNextToken();
736 PropertyValue = PropertyElement.GetNextToken();
738 intPrevValue = intiter->second;
740 CaptureString(&PropertyValue, FALSE);
742 if (PropertyName == wxT("ALTID")){
744 NicknamesListAltID->erase(*NicknameCount);
745 NicknamesListAltID->insert(std::make_pair(*NicknameCount, PropertyValue));
747 } else if (PropertyName == wxT("PID")){
749 NicknamesListPID->erase(*NicknameCount);
750 NicknamesListPID->insert(std::make_pair(*NicknameCount, PropertyValue));
752 } else if (PropertyName == wxT("PREF")){
754 int PriorityNumber = 0;
755 bool ValidNumber = TRUE;
758 PriorityNumber = std::stoi(PropertyValue.ToStdString());
761 catch(std::invalid_argument &e){
765 if (ValidNumber == TRUE){
767 NicknamesListPref->erase(*NicknameCount);
768 NicknamesListPref->insert(std::make_pair(*NicknameCount, PriorityNumber));
772 } else if (PropertyName == wxT("LANGUAGE")){
774 NicknamesListLanguage->erase(*NicknameCount);
775 NicknamesListLanguage->insert(std::make_pair(*NicknameCount, PropertyValue));
779 // Something else we don't know about so append
780 // to the tokens variable.
782 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
784 if (FirstToken == TRUE){
786 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
791 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
801 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
803 // Add the name token data.
805 if (!PropertyTokens.IsEmpty()){
807 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
813 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
815 std::map<int, int> SplitPoints;
816 std::map<int, int> SplitLength;
817 std::map<int, int>::iterator SLiter;
818 wxString PropertyData;
819 wxString PropertyName;
820 wxString PropertyValue;
821 wxString PropertyTokens;
822 bool FirstToken = TRUE;
823 int intPrevValue = 8;
825 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
829 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
830 intiter != SplitPoints.end(); ++intiter){
832 SLiter = SplitLength.find(intiter->first);
834 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
836 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
837 PropertyName = PropertyElement.GetNextToken();
838 PropertyValue = PropertyElement.GetNextToken();
840 intPrevValue = intiter->second;
842 // Process properties.
844 size_t intPropertyValueLen = PropertyValue.Len();
846 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
848 PropertyValue.Trim();
849 PropertyValue.RemoveLast();
853 if (PropertyValue.Mid(0, 1) == wxT("\"")){
855 PropertyValue.Remove(0, 1);
859 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
861 if (FirstToken == TRUE){
863 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
868 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
876 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
878 wxString GenderComponent;
880 if (GenderData.CountTokens() >= 2){
882 Gender = GenderData.GetNextToken();
883 GenderDetails = GenderData.GetString();
885 CaptureString(&GenderDetails, FALSE);
889 Gender = GenderData.GetNextToken();
893 if (!PropertyTokens.IsEmpty()){
895 GenderTokens = PropertyTokens;
901 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
903 // Process date. Preserve the remainder in the string.
905 std::map<int, int> SplitPoints;
906 std::map<int, int> SplitLength;
907 std::map<int, int>::iterator SLiter;
908 wxString PropertyData;
909 wxString PropertyName;
910 wxString PropertyValue;
911 wxString PropertyTokens;
912 bool BirthdayText = FALSE;
913 int intPrevValue = 6;
915 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
919 // Look for type before continuing.
921 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
922 intiter != SplitPoints.end(); ++intiter){
924 SLiter = SplitLength.find(intiter->first);
926 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
928 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
929 PropertyName = PropertyElement.GetNextToken();
930 PropertyValue = PropertyElement.GetNextToken();
932 intPrevValue = intiter->second;
934 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
936 CaptureString(&PropertySeg2, FALSE);
937 Birthday = PropertySeg2;
944 // Setup blank lines for later on.
947 bool FirstToken = TRUE;
949 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
950 intiter != SplitPoints.end(); ++intiter){
952 SLiter = SplitLength.find(intiter->first);
954 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
956 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
957 PropertyName = PropertyElement.GetNextToken();
958 PropertyValue = PropertyElement.GetNextToken();
960 intPrevValue = intiter->second;
962 // Process properties.
964 CaptureString(&PropertyValue, FALSE);
966 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
968 PropertyValue.Trim();
969 PropertyValue.RemoveLast();
973 if (PropertyValue.Mid(0, 1) == wxT("\"")){
975 PropertyValue.Remove(0, 1);
979 if (PropertyName == wxT("ALTID")){
981 BirthdayAltID = PropertyValue;
983 } else if (PropertyName == wxT("CALSCALE")){
985 BirthdayCalScale = PropertyValue;
987 } else if (PropertyName != wxT("VALUE")) {
989 // Something else we don't know about so append
990 // to the tokens variable.
992 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
994 if (FirstToken == TRUE){
996 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1001 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1011 // Add the data to the variables and form.
1013 if (BirthdayText == FALSE){
1015 Birthday = PropertySeg2;
1019 if (!PropertyTokens.IsEmpty()){
1021 BirthdayTokens = PropertyTokens;
1027 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1029 // Process date. Preserve the remainder in the string.
1031 std::map<int, int> SplitPoints;
1032 std::map<int, int> SplitLength;
1033 std::map<int, int>::iterator SLiter;
1034 wxString PropertyData;
1035 wxString PropertyName;
1036 wxString PropertyValue;
1037 wxString PropertyTokens;
1038 bool AnniversaryText = FALSE;
1039 int intPrevValue = 13;
1041 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1045 // Look for type before continuing.
1047 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1048 intiter != SplitPoints.end(); ++intiter){
1050 SLiter = SplitLength.find(intiter->first);
1052 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1054 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1055 PropertyName = PropertyElement.GetNextToken();
1056 PropertyValue = PropertyElement.GetNextToken();
1058 intPrevValue = intiter->second;
1060 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1062 CaptureString(&PropertySeg2, FALSE);
1063 Anniversary = PropertySeg2;
1064 AnniversaryText = TRUE;
1070 // Setup blank lines for later on.
1073 bool FirstToken = TRUE;
1075 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1076 intiter != SplitPoints.end(); ++intiter){
1078 SLiter = SplitLength.find(intiter->first);
1080 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1082 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1083 PropertyName = PropertyElement.GetNextToken();
1084 PropertyValue = PropertyElement.GetNextToken();
1086 intPrevValue = intiter->second;
1088 // Process properties.
1090 CaptureString(&PropertyValue, FALSE);
1092 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1094 PropertyValue.Trim();
1095 PropertyValue.RemoveLast();
1099 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1101 PropertyValue.Remove(0, 1);
1105 if (PropertyName == wxT("ALTID")){
1107 AnniversaryAltID = PropertyValue;
1109 } else if (PropertyName == wxT("CALSCALE")){
1111 AnniversaryCalScale = PropertyValue;
1113 } else if (PropertyName != wxT("VALUE")) {
1115 // Something else we don't know about so append
1116 // to the tokens variable.
1118 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1120 if (FirstToken == TRUE){
1122 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1127 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1137 // Add the data to the variables and form.
1139 if (AnniversaryText == FALSE){
1141 Anniversary = PropertySeg2;
1145 if (!PropertyTokens.IsEmpty()){
1147 AnniversaryTokens = PropertyTokens;
1153 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1155 std::map<int, int> SplitPoints;
1156 std::map<int, int> SplitLength;
1158 int intPrevValue = 4;
1161 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1165 PropertyType PropType = PROPERTY_NONE;
1167 // Look for type before continuing.
1169 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1173 std::map<int, wxString> *TZList = NULL;
1174 std::map<int, wxString> *TZListType = NULL;
1175 std::map<int, wxString> *TZListMediatype = NULL;
1176 std::map<int, wxString> *TZListAltID = NULL;
1177 std::map<int, wxString> *TZListPID = NULL;
1178 std::map<int, wxString> *TZListTokens = NULL;
1179 std::map<int, int> *TZListPref = NULL;
1183 TZList = &GeneralTZList;
1184 TZListType = &GeneralTZListType;
1185 TZListMediatype = &GeneralTZListMediatype;
1186 TZListAltID = &GeneralTZListAltID;
1187 TZListPID = &GeneralTZListPID;
1188 TZListTokens = &GeneralTZListTokens;
1189 TZListPref = &GeneralTZListPref;
1192 TZList = &HomeTZList;
1193 TZListType = &HomeTZListType;
1194 TZListMediatype = &HomeTZListMediatype;
1195 TZListAltID = &HomeTZListAltID;
1196 TZListPID = &HomeTZListPID;
1197 TZListTokens = &HomeTZListTokens;
1198 TZListPref = &HomeTZListPref;
1201 TZList = &BusinessTZList;
1202 TZListType = &BusinessTZListType;
1203 TZListMediatype = &BusinessTZListMediatype;
1204 TZListAltID = &BusinessTZListAltID;
1205 TZListPID = &BusinessTZListPID;
1206 TZListTokens = &BusinessTZListTokens;
1207 TZListPref = &BusinessTZListPref;
1211 std::map<int, int>::iterator SLiter;
1212 wxString PropertyData;
1213 wxString PropertyName;
1214 wxString PropertyValue;
1215 wxString PropertyTokens;
1216 bool FirstToken = TRUE;
1218 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1219 intiter != SplitPoints.end(); ++intiter){
1221 SLiter = SplitLength.find(intiter->first);
1223 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1225 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1226 PropertyName = PropertyElement.GetNextToken();
1227 PropertyValue = PropertyElement.GetNextToken();
1229 intPrevValue = intiter->second;
1231 CaptureString(&PropertyValue, FALSE);
1233 if (PropertyName == wxT("ALTID")){
1235 TZListAltID->erase(*TimeZoneCount);
1236 TZListAltID->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1238 } else if (PropertyName == wxT("PID")){
1240 TZListPID->erase(*TimeZoneCount);
1241 TZListPID->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1243 } else if (PropertyName == wxT("PREF")){
1245 int PriorityNumber = 0;
1246 bool ValidNumber = TRUE;
1249 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1252 catch(std::invalid_argument &e){
1253 ValidNumber = FALSE;
1256 if (ValidNumber == TRUE){
1258 TZListPref->erase(*TimeZoneCount);
1259 TZListPref->insert(std::make_pair(*TimeZoneCount, PriorityNumber));
1263 } else if (PropertyName == wxT("MEDIATYPE")){
1265 TZListMediatype->erase(*TimeZoneCount);
1266 TZListMediatype->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1270 // Something else we don't know about so append
1271 // to the tokens variable.
1273 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1275 if (FirstToken == TRUE){
1277 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1282 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1292 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1294 // Add the name token data.
1296 if (!PropertyTokens.IsEmpty()){
1298 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1305 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1307 size_t intPropertyLen = PropertySeg1.Len();
1308 std::map<int, int> SplitPoints;
1309 std::map<int, int> SplitLength;
1310 std::map<int, int>::iterator SLiter;
1311 wxString PropertyData;
1312 wxString PropertyName;
1313 wxString PropertyValue;
1314 wxString PropertyTokens;
1315 wxString AddressLabel;
1316 wxString AddressLang;
1317 wxString AddressAltID;
1318 wxString AddressPID;
1319 wxString AddressTokens;
1320 wxString AddressGeo;
1321 wxString AddressTimezone;
1322 wxString AddressType;
1323 wxString AddressMediatype;
1324 wxString AddressPOBox;
1325 wxString AddressExtended;
1326 wxString AddressStreet;
1327 wxString AddressLocality;
1328 wxString AddressCity;
1329 wxString AddressRegion;
1330 wxString AddressPostalCode;
1331 wxString AddressCountry;
1332 bool FirstToken = TRUE;
1333 int intSplitsFound = 0;
1334 int intSplitSize = 0;
1335 int intPrevValue = 5;
1340 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1344 PropertyType PropType = PROPERTY_NONE;
1346 // Look for type before continuing.
1348 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1352 std::map<int, wxString> *AddressList = NULL;
1353 std::map<int, wxString> *AddressListTown = NULL;
1354 std::map<int, wxString> *AddressListCounty = NULL;
1355 std::map<int, wxString> *AddressListPostCode = NULL;
1356 std::map<int, wxString> *AddressListCountry = NULL;
1357 std::map<int, wxString> *AddressListLabel = NULL;
1358 std::map<int, wxString> *AddressListLang = NULL;
1359 std::map<int, wxString> *AddressListAltID = NULL;
1360 std::map<int, wxString> *AddressListPID = NULL;
1361 std::map<int, wxString> *AddressListTokens = NULL;
1362 std::map<int, wxString> *AddressListGeo = NULL;
1363 std::map<int, wxString> *AddressListTimezone = NULL;
1364 std::map<int, wxString> *AddressListType = NULL;
1365 std::map<int, wxString> *AddressListMediatype = NULL;
1366 std::map<int, int> *AddressListPref = NULL;
1370 AddressList = &GeneralAddressList;
1371 AddressListTown = &GeneralAddressListTown;
1372 AddressListCounty = &GeneralAddressListCounty;
1373 AddressListPostCode = &GeneralAddressListPostCode;
1374 AddressListCountry = &GeneralAddressListCountry;
1375 AddressListLabel = &GeneralAddressListLabel;
1376 AddressListLang = &GeneralAddressListLang;
1377 AddressListAltID = &GeneralAddressListAltID;
1378 AddressListPID = &GeneralAddressListPID;
1379 AddressListTokens = &GeneralAddressListTokens;
1380 AddressListGeo = &GeneralAddressListGeo;
1381 AddressListTimezone = &GeneralAddressListTimezone;
1382 AddressListType = &GeneralAddressListType;
1383 AddressListMediatype = &GeneralAddressListMediatype;
1384 AddressListPref = &GeneralAddressListPref;
1387 AddressList = &HomeAddressList;
1388 AddressListTown = &HomeAddressListTown;
1389 AddressListCounty = &HomeAddressListCounty;
1390 AddressListPostCode = &HomeAddressListPostCode;
1391 AddressListCountry = &HomeAddressListCountry;
1392 AddressListLabel = &HomeAddressListLabel;
1393 AddressListLang = &HomeAddressListLang;
1394 AddressListAltID = &HomeAddressListAltID;
1395 AddressListPID = &HomeAddressListPID;
1396 AddressListTokens = &HomeAddressListTokens;
1397 AddressListGeo = &HomeAddressListGeo;
1398 AddressListTimezone = &HomeAddressListTimezone;
1399 AddressListType = &HomeAddressListType;
1400 AddressListMediatype = &HomeAddressListMediatype;
1401 AddressListPref = &HomeAddressListPref;
1404 AddressList = &BusinessAddressList;
1405 AddressListTown = &BusinessAddressListTown;
1406 AddressListCounty = &BusinessAddressListCounty;
1407 AddressListPostCode = &BusinessAddressListPostCode;
1408 AddressListCountry = &BusinessAddressListCountry;
1409 AddressListLabel = &BusinessAddressListLabel;
1410 AddressListLang = &BusinessAddressListLang;
1411 AddressListAltID = &BusinessAddressListAltID;
1412 AddressListPID = &BusinessAddressListPID;
1413 AddressListTokens = &BusinessAddressListTokens;
1414 AddressListGeo = &BusinessAddressListGeo;
1415 AddressListTimezone = &BusinessAddressListTimezone;
1416 AddressListType = &BusinessAddressListType;
1417 AddressListMediatype = &BusinessAddressListMediatype;
1418 AddressListPref = &BusinessAddressListPref;
1424 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1425 intiter != SplitPoints.end(); ++intiter){
1427 SLiter = SplitLength.find(intiter->first);
1429 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1431 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1432 PropertyName = PropertyElement.GetNextToken();
1433 PropertyValue = PropertyElement.GetNextToken();
1435 intPrevValue = intiter->second;
1437 CaptureString(&PropertyValue, FALSE);
1439 // Process properties.
1441 if (PropertyName == wxT("LABEL")){
1443 AddressListLabel->erase(*AddressCount);
1444 AddressListLabel->insert(std::make_pair(*AddressCount, PropertyValue));
1446 } else if (PropertyName == wxT("LANGUAGE")){
1448 AddressListLang->erase(*AddressCount);
1449 AddressListLang->insert(std::make_pair(*AddressCount, PropertyValue));
1451 } else if (PropertyName == wxT("ALTID")){
1453 AddressListAltID->erase(*AddressCount);
1454 AddressListAltID->insert(std::make_pair(*AddressCount, PropertyValue));
1456 } else if (PropertyName == wxT("PID")){
1458 AddressListPID->erase(*AddressCount);
1459 AddressListPID->insert(std::make_pair(*AddressCount, PropertyValue));
1461 } else if (PropertyName == wxT("GEO")){
1463 AddressListGeo->erase(*AddressCount);
1464 AddressListGeo->insert(std::make_pair(*AddressCount, PropertyValue));
1466 } else if (PropertyName == wxT("TZ")){
1468 AddressListTimezone->erase(*AddressCount);
1469 AddressListTimezone->insert(std::make_pair(*AddressCount, PropertyValue));
1471 } else if (PropertyName == wxT("MEDIATYPE")){
1473 AddressListMediatype->erase(*AddressCount);
1474 AddressListMediatype->insert(std::make_pair(*AddressCount, PropertyValue));
1476 } else if (PropertyName == wxT("PREF")){
1478 int PriorityNumber = 0;
1479 bool ValidNumber = TRUE;
1482 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1485 catch(std::invalid_argument &e){
1486 ValidNumber = FALSE;
1489 if (ValidNumber == TRUE){
1491 AddressListPref->erase(*AddressCount);
1492 AddressListPref->insert(std::make_pair(*AddressCount, PriorityNumber));
1498 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1500 if (FirstToken == TRUE){
1502 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1507 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1517 // Split the address.
1519 //std::map<int, int>::iterator SLiter;
1520 intPropertyLen = PropertySeg2.Len();
1521 SplitPoints.clear();
1522 SplitLength.clear();
1527 for (int i = 0; i <= intPropertyLen; i++){
1531 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1534 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1536 if (intSplitsFound == 6){
1538 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1543 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1553 // Split the data into several parts.
1555 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1556 intiter != SplitPoints.end(); ++intiter){
1558 if (intiter->first == 1){
1560 // Deal with PO Box.
1562 SLiter = SplitLength.find(1);
1564 //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
1565 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1566 intPrevValue = intiter->second;
1568 } else if (intiter->first == 2){
1570 // Deal with extended address.
1572 SLiter = SplitLength.find(2);
1574 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1575 //txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1576 intPrevValue = intiter->second;
1578 } else if (intiter->first == 3){
1580 // Deal with street address.
1582 SLiter = SplitLength.find(3);
1584 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1585 //txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1586 intPrevValue = intiter->second;
1588 } else if (intiter->first == 4){
1590 // Deal with locality
1592 SLiter = SplitLength.find(4);
1594 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1595 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1596 intPrevValue = intiter->second;
1598 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1600 } else if (intiter->first == 5){
1602 // Deal with region.
1604 SLiter = SplitLength.find(5);
1606 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1607 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1608 intPrevValue = intiter->second;
1610 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1612 } else if (intiter->first == 6){
1614 // Deal with post code.
1616 SLiter = SplitLength.find(6);
1618 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1619 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1620 intPrevValue = intiter->second;
1622 // Deal with country.
1624 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1625 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1633 // Add the data to the General/Home/Work address variables.
1635 CaptureString(&AddressStreet, FALSE);
1636 CaptureString(&AddressLocality, FALSE);
1637 CaptureString(&AddressRegion, FALSE);
1638 CaptureString(&AddressPostalCode, FALSE);
1639 CaptureString(&AddressCountry, FALSE);
1641 if (!PropertyTokens.IsEmpty()){
1643 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1647 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1648 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1649 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1650 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1651 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1655 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1658 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1661 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1665 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1669 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1671 std::map<int, int> SplitPoints;
1672 std::map<int, int> SplitLength;
1674 int intPrevValue = 7;
1677 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1681 PropertyType PropType = PROPERTY_NONE;
1683 // Look for type before continuing.
1685 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1687 std::map<int, wxString> *EmailList = NULL;
1688 std::map<int, wxString> *EmailListType = NULL;
1689 std::map<int, wxString> *EmailListAltID = NULL;
1690 std::map<int, wxString> *EmailListPID = NULL;
1691 std::map<int, wxString> *EmailListTokens = NULL;
1692 std::map<int, int> *EmailListPref = NULL;
1696 EmailList = &GeneralEmailList;
1697 EmailListType = &GeneralEmailListType;
1698 EmailListAltID = &GeneralEmailListAltID;
1699 EmailListPID = &GeneralEmailListPID;
1700 EmailListTokens = &GeneralEmailListTokens;
1701 EmailListPref = &GeneralEmailListPref;
1704 EmailList = &HomeEmailList;
1705 EmailListType = &HomeEmailListType;
1706 EmailListAltID = &HomeEmailListAltID;
1707 EmailListPID = &HomeEmailListPID;
1708 EmailListTokens = &HomeEmailListTokens;
1709 EmailListPref = &HomeEmailListPref;
1712 EmailList = &BusinessEmailList;
1713 EmailListType = &BusinessEmailListType;
1714 EmailListAltID = &BusinessEmailListAltID;
1715 EmailListPID = &BusinessEmailListPID;
1716 EmailListTokens = &BusinessEmailListTokens;
1717 EmailListPref = &BusinessEmailListPref;
1723 std::map<int,int>::iterator SLiter;
1724 wxString PropertyData;
1725 wxString PropertyName;
1726 wxString PropertyValue;
1727 wxString PropertyTokens;
1728 bool FirstToken = TRUE;
1730 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1731 intiter != SplitPoints.end(); ++intiter){
1733 SLiter = SplitLength.find(intiter->first);
1735 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1737 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1738 PropertyName = PropertyElement.GetNextToken();
1739 PropertyValue = PropertyElement.GetNextToken();
1741 intPrevValue = intiter->second;
1743 CaptureString(&PropertyValue, FALSE);
1745 // Process properties.
1747 if (PropertyName == wxT("ALTID")){
1749 EmailListAltID->erase(*EmailCount);
1750 EmailListAltID->insert(std::make_pair(*EmailCount, PropertyValue));
1752 } else if (PropertyName == wxT("PID")){
1754 EmailListPID->erase(*EmailCount);
1755 EmailListPID->insert(std::make_pair(*EmailCount, PropertyValue));
1757 } else if (PropertyName == wxT("PREF")){
1759 int PriorityNumber = 0;
1760 bool ValidNumber = TRUE;
1763 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1766 catch(std::invalid_argument &e){
1767 ValidNumber = FALSE;
1770 if (ValidNumber == TRUE){
1772 EmailListPref->erase(*EmailCount);
1773 EmailListPref->insert(std::make_pair(*EmailCount, PriorityNumber));
1779 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1781 if (FirstToken == TRUE){
1783 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1788 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1798 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1800 // Add the name token data.
1802 if (!PropertyTokens.IsEmpty()){
1804 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1811 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1813 std::map<int, int> SplitPoints;
1814 std::map<int, int> SplitLength;
1816 int intPrevValue = 6;
1819 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1823 PropertyType PropType = PROPERTY_NONE;
1825 // Look for type before continuing.
1827 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1829 std::map<int, wxString> *IMList = NULL;
1830 std::map<int, wxString> *IMListType = NULL;
1831 std::map<int, wxString> *IMListAltID = NULL;
1832 std::map<int, wxString> *IMListPID = NULL;
1833 std::map<int, wxString> *IMListTokens = NULL;
1834 std::map<int, wxString> *IMListMediatype = NULL;
1835 std::map<int, int> *IMListPref = NULL;
1839 IMList = &GeneralIMList;
1840 IMListType = &GeneralIMListType;
1841 IMListAltID = &GeneralIMListAltID;
1842 IMListPID = &GeneralIMListPID;
1843 IMListTokens = &GeneralIMListTokens;
1844 IMListMediatype = &GeneralIMListMediatype;
1845 IMListPref = &GeneralIMListPref;
1848 IMList = &HomeIMList;
1849 IMListType = &HomeIMListType;
1850 IMListAltID = &HomeIMListAltID;
1851 IMListPID = &HomeIMListPID;
1852 IMListTokens = &HomeIMListTokens;
1853 IMListMediatype = &HomeIMListMediatype;
1854 IMListPref = &HomeIMListPref;
1857 IMList = &BusinessIMList;
1858 IMListType = &BusinessIMListType;
1859 IMListAltID = &BusinessIMListAltID;
1860 IMListPID = &BusinessIMListPID;
1861 IMListTokens = &BusinessIMListTokens;
1862 IMListMediatype = &BusinessIMListMediatype;
1863 IMListPref = &BusinessIMListPref;
1869 std::map<int,int>::iterator SLiter;
1870 wxString PropertyData;
1871 wxString PropertyName;
1872 wxString PropertyValue;
1873 wxString PropertyTokens;
1874 bool FirstToken = TRUE;
1876 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1877 intiter != SplitPoints.end(); ++intiter){
1879 SLiter = SplitLength.find(intiter->first);
1881 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1883 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1884 PropertyName = PropertyElement.GetNextToken();
1885 PropertyValue = PropertyElement.GetNextToken();
1887 intPrevValue = intiter->second;
1889 CaptureString(&PropertyValue, FALSE);
1891 // Process properties.
1893 if (PropertyName == wxT("ALTID")){
1895 IMListAltID->erase(*IMCount);
1896 IMListAltID->insert(std::make_pair(*IMCount, PropertyValue));
1898 } else if (PropertyName == wxT("PID")){
1900 IMListPID->erase(*IMCount);
1901 IMListPID->insert(std::make_pair(*IMCount, PropertyValue));
1903 } else if (PropertyName == wxT("MEDIATYPE")){
1905 IMListMediatype->erase(*IMCount);
1906 IMListMediatype->insert(std::make_pair(*IMCount, PropertyValue));
1908 } else if (PropertyName == wxT("PREF")){
1910 int PriorityNumber = 0;
1911 bool ValidNumber = TRUE;
1914 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1917 catch(std::invalid_argument &e){
1918 ValidNumber = FALSE;
1921 if (ValidNumber == TRUE){
1923 IMListPref->erase(*IMCount);
1924 IMListPref->insert(std::make_pair(*IMCount, PriorityNumber));
1930 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1932 if (FirstToken == TRUE){
1934 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1939 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1949 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
1951 // Add the name token data.
1953 if (!PropertyTokens.IsEmpty()){
1955 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
1961 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
1963 std::map<int, int> SplitPoints;
1964 std::map<int, int> SplitLength;
1965 std::map<int, int>::iterator SLiter;
1969 PropertyType PropType = PROPERTY_NONE;
1971 // Look for type before continuing.
1974 wxString TelTypeDetail;
1975 wxString PropertyData;
1976 wxString PropertyName;
1977 wxString PropertyValue;
1978 wxString PropertyTokens;
1980 std::map<int,int> TypeSplitPoints;
1981 std::map<int,int> TypeSplitLength;
1982 std::map<int,int>::iterator TSLiter;
1984 int intSplitSize = 0;
1985 int intSplitsFound = 0;
1986 int intSplitPoint = 0;
1988 int intPrevValue = 5;
1990 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1994 // Look for type before continuing.
1996 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1997 intiter != SplitPoints.end(); ++intiter){
1999 SLiter = SplitLength.find(intiter->first);
2001 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2003 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2004 PropertyName = PropertyElement.GetNextToken();
2005 PropertyValue = PropertyElement.GetNextToken();
2007 intPrevValue = intiter->second;
2009 if (PropertyName == wxT("TYPE")){
2011 // Process each value in type and translate each
2014 // Strip out the quotes if they are there.
2016 size_t intPropertyValueLen = PropertyValue.Len();
2018 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2020 PropertyValue.Trim();
2021 PropertyValue.RemoveLast();
2025 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2027 PropertyValue.Remove(0, 1);
2031 TelTypeDetail = PropertyValue;
2037 for (int i = 0; i <= intPropertyValueLen; i++){
2041 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2043 if (intSplitsFound == 0){
2045 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2046 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2050 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2051 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2064 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2065 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2067 int intTypeSeek = 0;
2069 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2070 typeiter != TypeSplitPoints.end(); ++typeiter){
2072 wxString TypePropertyName;
2074 TSLiter = TypeSplitLength.find(typeiter->first);
2076 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2078 if (intTypeSeek == 0){
2083 TelTypeUI.Append(wxT(","));
2087 if (TypePropertyName == wxT("home")){
2089 PropType = PROPERTY_HOME;
2091 } else if (TypePropertyName == wxT("work")){
2093 PropType = PROPERTY_WORK;
2098 if (TypePropertyName == wxT("text")){
2100 TelTypeUI.Append(_("text"));
2103 } else if (TypePropertyName == wxT("voice")){
2105 TelTypeUI.Append(_("voice"));
2108 } else if (TypePropertyName == wxT("fax")){
2110 TelTypeUI.Append(_("fax"));
2113 } else if (TypePropertyName == wxT("cell")){
2115 TelTypeUI.Append(_("mobile"));
2118 } else if (TypePropertyName == wxT("video")){
2120 TelTypeUI.Append(_("video"));
2123 } else if (TypePropertyName == wxT("pager")){
2125 TelTypeUI.Append(_("pager"));
2128 } else if (TypePropertyName == wxT("textphone")){
2130 TelTypeUI.Append(_("textphone"));
2141 std::map<int, wxString> *TelephoneList = NULL;
2142 std::map<int, wxString> *TelephoneListType = NULL;
2143 std::map<int, wxString> *TelephoneListAltID = NULL;
2144 std::map<int, wxString> *TelephoneListPID = NULL;
2145 std::map<int, wxString> *TelephoneListTokens = NULL;
2146 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2147 std::map<int, int> *TelephoneListPref = NULL;
2151 TelephoneList = &GeneralTelephoneList;
2152 TelephoneListType = &GeneralTelephoneListType;
2153 TelephoneListAltID = &GeneralTelephoneListAltID;
2154 TelephoneListPID = &GeneralTelephoneListPID;
2155 TelephoneListTokens = &GeneralTelephoneListTokens;
2156 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2157 TelephoneListPref = &GeneralTelephoneListPref;
2160 TelephoneList = &HomeTelephoneList;
2161 TelephoneListType = &HomeTelephoneListType;
2162 TelephoneListAltID = &HomeTelephoneListAltID;
2163 TelephoneListPID = &HomeTelephoneListPID;
2164 TelephoneListTokens = &HomeTelephoneListTokens;
2165 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2166 TelephoneListPref = &HomeTelephoneListPref;
2169 TelephoneList = &BusinessTelephoneList;
2170 TelephoneListType = &BusinessTelephoneListType;
2171 TelephoneListAltID = &BusinessTelephoneListAltID;
2172 TelephoneListPID = &BusinessTelephoneListPID;
2173 TelephoneListTokens = &BusinessTelephoneListTokens;
2174 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2175 TelephoneListPref = &BusinessTelephoneListPref;
2179 // Process the properties.
2181 bool FirstToken = TRUE;
2184 SplitPoints.clear();
2185 SplitLength.clear();
2187 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2191 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2192 intiter != SplitPoints.end(); ++intiter){
2194 SLiter = SplitLength.find(intiter->first);
2196 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2198 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2199 PropertyName = PropertyElement.GetNextToken();
2200 PropertyValue = PropertyElement.GetNextToken();
2202 intPrevValue = intiter->second;
2204 CaptureString(&PropertyValue, FALSE);
2206 // Process properties.
2208 if (PropertyName == wxT("ALTID")){
2210 TelephoneListAltID->erase(*TelephoneCount);
2211 TelephoneListAltID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2213 } else if (PropertyName == wxT("PID")){
2215 TelephoneListPID->erase(*TelephoneCount);
2216 TelephoneListPID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2218 } else if (PropertyName == wxT("PREF")){
2220 int PriorityNumber = 0;
2221 bool ValidNumber = TRUE;
2224 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2227 catch(std::invalid_argument &e){
2228 ValidNumber = FALSE;
2231 if (ValidNumber == TRUE){
2233 TelephoneListPref->erase(*TelephoneCount);
2234 TelephoneListPref->insert(std::make_pair(*TelephoneCount, PriorityNumber));
2240 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2242 if (FirstToken == TRUE){
2244 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2249 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2259 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2260 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2262 // Add the name token data.
2264 if (!PropertyTokens.IsEmpty()){
2266 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2272 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2274 std::map<int, int> SplitPoints;
2275 std::map<int, int> SplitLength;
2277 int intPrevValue = 6;
2280 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2284 PropertyType PropType = PROPERTY_NONE;
2286 // Look for type before continuing.
2288 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2290 std::map<int, wxString> *LanguageList = NULL;
2291 std::map<int, wxString> *LanguageListType = NULL;
2292 std::map<int, wxString> *LanguageListAltID = NULL;
2293 std::map<int, wxString> *LanguageListPID = NULL;
2294 std::map<int, wxString> *LanguageListTokens = NULL;
2295 std::map<int, int> *LanguageListPref = NULL;
2299 LanguageList = &GeneralLanguageList;
2300 LanguageListType = &GeneralLanguageListType;
2301 LanguageListAltID = &GeneralLanguageListAltID;
2302 LanguageListPID = &GeneralLanguageListPID;
2303 LanguageListTokens = &GeneralLanguageListTokens;
2304 LanguageListPref = &GeneralLanguageListPref;
2307 LanguageList = &HomeLanguageList;
2308 LanguageListType = &HomeLanguageListType;
2309 LanguageListAltID = &HomeLanguageListAltID;
2310 LanguageListPID = &HomeLanguageListPID;
2311 LanguageListTokens = &HomeLanguageListTokens;
2312 LanguageListPref = &HomeLanguageListPref;
2315 LanguageList = &BusinessLanguageList;
2316 LanguageListType = &BusinessLanguageListType;
2317 LanguageListAltID = &BusinessLanguageListAltID;
2318 LanguageListPID = &BusinessLanguageListPID;
2319 LanguageListTokens = &BusinessLanguageListTokens;
2320 LanguageListPref = &BusinessLanguageListPref;
2326 std::map<int,int>::iterator SLiter;
2327 wxString PropertyData;
2328 wxString PropertyName;
2329 wxString PropertyValue;
2330 wxString PropertyTokens;
2331 bool FirstToken = TRUE;
2333 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2334 intiter != SplitPoints.end(); ++intiter){
2336 SLiter = SplitLength.find(intiter->first);
2338 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2340 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2341 PropertyName = PropertyElement.GetNextToken();
2342 PropertyValue = PropertyElement.GetNextToken();
2344 intPrevValue = intiter->second;
2346 CaptureString(&PropertyValue, FALSE);
2348 // Process properties.
2350 if (PropertyName == wxT("ALTID")){
2352 LanguageListAltID->erase(*LanguageCount);
2353 LanguageListAltID->insert(std::make_pair(*LanguageCount, PropertyValue));
2355 } else if (PropertyName == wxT("PID")){
2357 LanguageListPID->erase(*LanguageCount);
2358 LanguageListPID->insert(std::make_pair(*LanguageCount, PropertyValue));
2360 } else if (PropertyName == wxT("PREF")){
2362 int PriorityNumber = 0;
2363 bool ValidNumber = TRUE;
2366 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2369 catch(std::invalid_argument &e){
2370 ValidNumber = FALSE;
2373 if (ValidNumber == TRUE){
2375 LanguageListPref->erase(*LanguageCount);
2376 LanguageListPref->insert(std::make_pair(*LanguageCount, PriorityNumber));
2382 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2384 if (FirstToken == TRUE){
2386 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2391 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2401 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2403 // Add the name token data.
2405 if (!PropertyTokens.IsEmpty()){
2407 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2413 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2415 std::map<int, int> SplitPoints;
2416 std::map<int, int> SplitLength;
2418 int intPrevValue = 5;
2421 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2425 PropertyType PropType = PROPERTY_NONE;
2427 // Look for type before continuing.
2429 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2431 std::map<int, wxString> *GeopositionList = NULL;
2432 std::map<int, wxString> *GeopositionListType = NULL;
2433 std::map<int, wxString> *GeopositionListAltID = NULL;
2434 std::map<int, wxString> *GeopositionListPID = NULL;
2435 std::map<int, wxString> *GeopositionListTokens = NULL;
2436 std::map<int, wxString> *GeopositionListMediatype = NULL;
2437 std::map<int, int> *GeopositionListPref = NULL;
2441 GeopositionList = &GeneralGeographyList;
2442 GeopositionListType = &GeneralGeographyListType;
2443 GeopositionListAltID = &GeneralGeographyListAltID;
2444 GeopositionListPID = &GeneralGeographyListPID;
2445 GeopositionListTokens = &GeneralGeographyListTokens;
2446 GeopositionListMediatype = &GeneralGeographyListMediatype;
2447 GeopositionListPref = &GeneralGeographyListPref;
2450 GeopositionList = &HomeGeographyList;
2451 GeopositionListType = &HomeGeographyListType;
2452 GeopositionListAltID = &HomeGeographyListAltID;
2453 GeopositionListPID = &HomeGeographyListPID;
2454 GeopositionListTokens = &HomeGeographyListTokens;
2455 GeopositionListMediatype = &HomeGeographyListMediatype;
2456 GeopositionListPref = &HomeGeographyListPref;
2459 GeopositionList = &BusinessGeographyList;
2460 GeopositionListType = &BusinessGeographyListType;
2461 GeopositionListAltID = &BusinessGeographyListAltID;
2462 GeopositionListPID = &BusinessGeographyListPID;
2463 GeopositionListTokens = &BusinessGeographyListTokens;
2464 GeopositionListMediatype = &BusinessGeographyListMediatype;
2465 GeopositionListPref = &BusinessGeographyListPref;
2471 std::map<int,int>::iterator SLiter;
2472 wxString PropertyData;
2473 wxString PropertyName;
2474 wxString PropertyValue;
2475 wxString PropertyTokens;
2476 bool FirstToken = TRUE;
2478 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2479 intiter != SplitPoints.end(); ++intiter){
2481 SLiter = SplitLength.find(intiter->first);
2483 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2485 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2486 PropertyName = PropertyElement.GetNextToken();
2487 PropertyValue = PropertyElement.GetNextToken();
2489 intPrevValue = intiter->second;
2491 CaptureString(&PropertyValue, FALSE);
2493 // Process properties.
2495 if (PropertyName == wxT("ALTID")){
2497 GeopositionListAltID->erase(*GeographicCount);
2498 GeopositionListAltID->insert(std::make_pair(*GeographicCount, PropertyValue));
2500 } else if (PropertyName == wxT("PID")){
2502 GeopositionListPID->erase(*GeographicCount);
2503 GeopositionListPID->insert(std::make_pair(*GeographicCount, PropertyValue));
2505 } else if (PropertyName == wxT("MEDIATYPE")){
2507 GeopositionListMediatype->erase(*GeographicCount);
2508 GeopositionListMediatype->insert(std::make_pair(*GeographicCount, PropertyValue));
2510 } else if (PropertyName == wxT("PREF")){
2512 int PriorityNumber = 0;
2513 bool ValidNumber = TRUE;
2516 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2519 catch(std::invalid_argument &e){
2520 ValidNumber = FALSE;
2523 if (ValidNumber == TRUE){
2525 GeopositionListPref->erase(*GeographicCount);
2526 GeopositionListPref->insert(std::make_pair(*GeographicCount, PriorityNumber));
2532 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2534 if (FirstToken == TRUE){
2536 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2541 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2551 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2553 // Add the name token data.
2555 if (!PropertyTokens.IsEmpty()){
2557 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2563 void SplitValues(wxString *PropertyLine,
2564 std::map<int,int> *SplitPoints,
2565 std::map<int,int> *SplitLength,
2568 size_t intPropertyLen = PropertyLine->Len();
2569 int intSplitsFound = 0;
2570 int intSplitSize = 0;
2571 int intSplitSeek = 0;
2573 for (int i = intSize; i <= intPropertyLen; i++){
2577 if (PropertyLine->Mid(i, 1) == wxT(";") &&
2578 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
2580 if (intSplitsFound == 0){
2582 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
2586 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2590 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
2600 if (intSplitsFound == 0){
2602 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
2603 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
2607 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
2608 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
2614 void CheckType(wxString *PropertySeg1,
2615 std::map<int,int> *SplitPoints,
2616 std::map<int,int> *SplitLength,
2618 PropertyType *PropType){
2620 wxString PropertyData;
2621 wxString PropertyName;
2622 wxString PropertyValue;
2623 std::map<int,int>::iterator SLiter;
2625 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
2626 intiter != SplitPoints->end(); ++intiter){
2628 SLiter = SplitLength->find(intiter->first);
2630 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
2632 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2633 PropertyName = PropertyElement.GetNextToken();
2634 PropertyValue = PropertyElement.GetNextToken();
2636 *intPrevValue = intiter->second;
2638 if (PropertyName == wxT("TYPE")){
2640 if (PropertyValue == wxT("work")){
2642 *PropType = PROPERTY_WORK;
2644 } else if (PropertyValue == wxT("home")){
2646 *PropType = PROPERTY_HOME;
2650 *PropType = PROPERTY_NONE;