1 // ContactDataObject.cpp - Client Data Object.
3 // (c) 2012-2016 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 bool UIDProcessed = FALSE;
82 bool RevisionProcessed = FALSE;
83 int ContactLineLen = 0;
84 int QuoteBreakPoint = 0;
88 int NicknameCount = 0;
89 int TimeZoneCount = 0;
93 int TelephoneCount = 0;
94 int LanguageCount = 0;
95 int GeographicCount = 0;
100 int OrganisationCount = 0;
102 int CategoryCount = 0;
106 int CalendarCount = 0;
107 int CalendarAddressCount = 0;
108 int FreeBusyAddressCount = 0;
113 int ClientPIDCount = 0;
114 wxString ContactLine;
115 wxString PropertyLine;
116 wxString PropertySeg1;
117 wxString PropertySeg2;
118 wxString PropertyNextLine;
121 for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
122 iter != ContactFileLines.end(); ++iter){
124 ExtraLineSeek = TRUE;
130 PropertyLine.Clear();
131 PropertySeg1.Clear();
132 PropertySeg2.Clear();
135 ContactLine = iter->second;
137 while (ExtraLineSeek == TRUE){
139 // Check if there is extra data on the next line
140 // (indicated by space or tab at the start) and add data.
144 if (iter == ContactFileLines.end()){
151 PropertyNextLine = iter->second;
153 if (PropertyNextLine.Mid(0, 1) == wxT(" ") || PropertyNextLine.Mid(0, 1) == wxT("\t")){
155 PropertyNextLine.Remove(0, 1);
156 ContactLine.Append(PropertyNextLine);
161 ExtraLineSeek = FALSE;
167 ContactLineLen = ContactLine.Len();
169 // Make sure we are not in quotation mode.
170 // Make sure colon does not have \ or \\ before it.
172 for (int i = 0; i <= ContactLineLen; i++){
174 if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
176 PropertyFind = FALSE;
178 } else if (PropertyFind == TRUE){
180 Property.Append(ContactLine.Mid(i, 1));
184 if (ContactLine.Mid(i, 1) == wxT("\"")){
186 if (QuoteMode == TRUE){
198 if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
207 // Split that line at the point into two variables (ignore the colon).
209 PropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
210 PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
212 if (Property == wxT("KIND") && KindProcessed == FALSE){
214 ProcessKind(PropertySeg2);
216 } else if (Property == wxT("UID") && UIDProcessed == FALSE){
218 UIDToken = PropertySeg2;
221 } else if (Property == wxT("SOURCE")){
223 ProcessSource(PropertySeg1, PropertySeg2, &SourceCount);
226 } else if (Property == wxT("XML")){
228 ProcessXML(PropertySeg1, PropertySeg2, &XMLCount);
231 } else if (Property == wxT("REV") && RevisionProcessed == FALSE){
233 ProcessRevision(PropertySeg1, PropertySeg2);
234 RevisionProcessed = TRUE;
236 } else if (Property == wxT("MEMBER")){
238 ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
241 } else if (Property == wxT("FN")){
243 ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
246 } else if (Property == wxT("N") && NameProcessed == FALSE){
248 ProcessN(PropertySeg1, PropertySeg2);
249 NameProcessed = TRUE;
251 } else if (Property == wxT("CLIENTPIDMAP")){
253 ProcessClientPIDMap(PropertySeg1, PropertySeg2, &ClientPIDCount);
256 } else if (Property == wxT("NICKNAME")){
258 ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
261 } else if (Property == wxT("GENDER") && GenderProcessed == FALSE){
263 ProcessGender(PropertySeg1, PropertySeg2);
264 GenderProcessed = TRUE;
266 } else if (Property == wxT("BDAY") && BirthdayProcessed == FALSE){
268 ProcessBirthday(PropertySeg1, PropertySeg2);
269 BirthdayProcessed = TRUE;
271 } else if (Property == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
273 ProcessAnniversary(PropertySeg1, PropertySeg2);
274 AnniversaryProcessed = TRUE;
276 } else if (Property == wxT("TZ")){
278 ProcessTimeZone(PropertySeg1, PropertySeg2, &TimeZoneCount);
281 } else if (Property == wxT("ADR")){
283 ProcessAddress(PropertySeg1, PropertySeg2, &AddressCount);
286 } else if (Property == wxT("EMAIL")){
288 ProcessEmail(PropertySeg1, PropertySeg2, &EmailCount);
291 } else if (Property == wxT("IMPP")){
293 ProcessIM(PropertySeg1, PropertySeg2, &IMCount);
296 } else if (Property == wxT("TEL")){
298 ProcessTelephone(PropertySeg1, PropertySeg2, &TelephoneCount);
301 } else if (Property == wxT("LANG")){
303 // See frmContactEditor-LoadLanguage.cpp
305 ProcessLanguage(PropertySeg1, PropertySeg2, &LanguageCount);
308 } else if (Property == wxT("GEO")){
310 // See frmContactEditor-LoadGeo.cpp
312 ProcessGeographic(PropertySeg1, PropertySeg2, &GeographicCount);
315 } else if (Property == wxT("RELATED")){
317 // See fromContactEditor-LoadRelated.cpp
319 ProcessRelated(PropertySeg1, PropertySeg2, &RelatedCount);
322 } else if (Property == wxT("URL")){
324 // See frmContactEditor-LoadURL.cpp
326 ProcessURL(PropertySeg1, PropertySeg2, &URLCount);
329 } else if (Property == wxT("TITLE")) {
331 // See frmContactEditor-LoadTitle.cpp
333 ProcessTitle(PropertySeg1, PropertySeg2, &TitleCount);
336 } else if (Property == wxT("ROLE")) {
338 // See frmContactEditor-LoadTitle.cpp
340 ProcessRole(PropertySeg1, PropertySeg2, &RoleCount);
343 } else if (Property == wxT("ORG")) {
345 // See frmContactEditor-LoadOrg.cpp
347 ProcessOrganisation(PropertySeg1, PropertySeg2, &OrganisationCount);
350 } else if (Property == wxT("NOTE")) {
352 // See frmContactEditor-LoadNote.cpp
354 ProcessNote(PropertySeg1, PropertySeg2, &NoteCount);
357 } else if (Property == wxT("CATEGORIES")) {
359 // See frmContactEditor-LoadCategory.cpp
361 ProcessCategory(PropertySeg1, PropertySeg2, &CategoryCount);
364 } else if (Property == wxT("PHOTO")) {
366 // See frmContactEditor-LoadPhoto.cpp
368 ProcessPhoto(PropertySeg1, PropertySeg2, &PhotoCount);
371 } else if (Property == wxT("LOGO")) {
373 // See frmContactEditor-LoadPhoto.cpp
375 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
378 } else if (Property == wxT("SOUND")) {
380 // See frmContactEditor-LoadSound.cpp
382 ProcessSound(PropertySeg1, PropertySeg2, &SoundCount);
385 } else if (Property == wxT("CALURI")){
387 // See frmContactEditor-LoadCalendar.cpp
389 ProcessCalendarURI(PropertySeg1, PropertySeg2, &CalendarCount);
392 } else if (Property == wxT("CALADRURI")){
394 ProcessCalendarAddressURI(PropertySeg1, PropertySeg2, &CalendarAddressCount);
395 CalendarAddressCount++;
397 } else if (Property == wxT("FBURL")){
399 // See frmContactEditor-LoadCalendar.cpp
401 ProcessCalendarFreeBusy(PropertySeg1, PropertySeg2, &FreeBusyAddressCount);
402 FreeBusyAddressCount++;
404 } else if (Property == wxT("KEY")){
406 // See frmContactEditor-LoadKey.cpp
408 ProcessKey(PropertySeg1, PropertySeg2, &KeyCount);
411 } else if (Property.Mid(0, 3) == wxT("VND")){
413 ProcessVendor(PropertySeg1, PropertySeg2, &VendorCount);
416 } else if (Property.Mid(0, 2) == wxT("X-")){
418 XTokenList.insert(std::make_pair(XTokenCount, PropertySeg2));
419 XTokenListTokens.insert(std::make_pair(XTokenCount, PropertySeg1.Mid(2)));
426 return CONTACTLOAD_OK;
430 void ContactDataObject::ProcessKind(wxString KindType){
432 if (KindType == wxT("individual")){
434 ContactKind = CONTACTKIND_INDIVIDUAL;
436 } else if (KindType == wxT("group")){
438 ContactKind = CONTACTKIND_GROUP;
440 } else if (KindType == wxT("org")){
442 ContactKind = CONTACTKIND_ORGANISATION;
444 } else if (KindType == wxT("location")){
446 ContactKind = CONTACTKIND_LOCATION;
450 ContactKind = CONTACTKIND_NONE;
455 void ContactDataObject::ProcessRevision(wxString PropertySeg1, wxString PropertySeg2){
457 size_t intPropertyLen = PropertySeg1.Len();
458 std::map<int, int> SplitPoints;
459 std::map<int, int> SplitLength;
460 std::map<int, int>::iterator SLiter;
461 wxString PropertyData;
462 wxString PropertyName;
463 wxString PropertyValue;
464 wxString PropertyTokens;
465 bool FirstToken = TRUE;
466 int intSplitsFound = 0;
467 int intSplitSize = 0;
468 int intPrevValue = 5;
470 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
474 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
475 intiter != SplitPoints.end(); ++intiter){
477 SLiter = SplitLength.find(intiter->first);
478 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
479 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
480 intPrevValue = intiter->second;
482 // Process properties.
484 size_t intPropertyValueLen = PropertyValue.Len();
486 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
488 PropertyValue.Trim();
489 PropertyValue.RemoveLast();
493 if (PropertyValue.Mid(0, 1) == wxT("\"")){
495 PropertyValue.Remove(0, 1);
499 CaptureString(&PropertyValue, FALSE);
501 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
505 CaptureString(&PropertySeg2, FALSE);
507 Revision = PropertySeg2;
509 if (!PropertyTokens.IsEmpty()){
511 RevisionTokens = PropertyTokens;
518 void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySeg2, int *SourceCount){
520 size_t intPropertyLen = PropertySeg1.Len();
521 std::map<int, int> SplitPoints;
522 std::map<int, int> SplitLength;
523 std::map<int, int>::iterator SLiter;
524 wxString PropertyData;
525 wxString PropertyName;
526 wxString PropertyValue;
527 wxString PropertyTokens;
528 bool FirstToken = TRUE;
529 bool PropertyMatched = FALSE;
530 int intSplitsFound = 0;
531 int intSplitSize = 0;
532 int intPrevValue = 8;
534 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
538 PropertyType PropType = PROPERTY_NONE;
540 // Look for type before continuing.
542 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
546 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
547 intiter != SplitPoints.end(); ++intiter){
549 SLiter = SplitLength.find(intiter->first);
551 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
553 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
555 intPrevValue = intiter->second;
557 // Process properties.
559 size_t intPropertyValueLen = PropertyValue.Len();
561 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
563 PropertyValue.Trim();
564 PropertyValue.RemoveLast();
568 if (PropertyValue.Mid(0, 1) == wxT("\"")){
570 PropertyValue.Remove(0, 1);
574 CaptureString(&PropertyValue, FALSE);
576 ProcessStringValue(&PropertyName, "ALTID", &SourceListAltID, &PropertyValue, SourceCount, &PropertyMatched);
577 ProcessStringValue(&PropertyName, "PID", &SourceListPID, &PropertyValue, SourceCount, &PropertyMatched);
578 ProcessStringValue(&PropertyName, "MEDIATYPE", &SourceListMediatype, &PropertyValue, SourceCount, &PropertyMatched);
579 ProcessIntegerValue(&PropertyName, "PREF", &SourceListPref, &PropertyValue, SourceCount, &PropertyMatched);
581 if (PropertyMatched == TRUE){
583 PropertyMatched = FALSE;
588 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
592 intPropertyLen = PropertySeg2.Len();
599 CaptureString(&PropertySeg2, FALSE);
601 // Add the data to the General/Home/Work address variables.
607 SourceListType.insert(std::make_pair(*SourceCount, "home"));
610 SourceListType.insert(std::make_pair(*SourceCount, "work"));
614 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
616 if (!PropertyTokens.IsEmpty()){
618 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
624 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
626 std::map<int, int> SplitPoints;
627 std::map<int, int> SplitLength;
629 int intPrevValue = 5;
631 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
635 wxString PropertyName;
636 wxString PropertyValue;
637 wxString PropertyData;
638 wxString PropertyTokens;
639 std::map<int,int>::iterator SLiter;
640 bool FirstToken = TRUE;
641 bool PropertyMatched = FALSE;
643 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
644 intiter != SplitPoints.end(); ++intiter){
646 SLiter = SplitLength.find(intiter->first);
647 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
648 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
649 intPrevValue = intiter->second;
651 CaptureString(&PropertyValue, FALSE);
653 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
655 if (PropertyMatched == TRUE){
657 PropertyMatched = FALSE;
664 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
668 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
670 std::map<int, int> SplitPoints;
671 std::map<int, int> SplitLength;
673 int intPrevValue = 8;
675 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
679 wxString PropertyName;
680 wxString PropertyValue;
681 wxString PropertyData;
682 wxString PropertyTokens;
683 std::map<int,int>::iterator SLiter;
684 bool FirstToken = TRUE;
685 bool PropertyMatched = FALSE;
687 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
688 intiter != SplitPoints.end(); ++intiter){
690 SLiter = SplitLength.find(intiter->first);
691 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
692 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
693 intPrevValue = intiter->second;
695 CaptureString(&PropertyValue, FALSE);
697 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
698 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
699 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
700 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
702 if (PropertyMatched == TRUE){
704 PropertyMatched = FALSE;
709 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
713 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
715 if (!PropertyTokens.IsEmpty()){
717 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
724 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
726 std::map<int, int> SplitPoints;
727 std::map<int, int> SplitLength;
729 int intPrevValue = 4;
731 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
735 wxString PropertyName;
736 wxString PropertyValue;
737 wxString PropertyData;
738 wxString PropertyTokens;
739 std::map<int,int>::iterator SLiter;
740 bool FirstToken = TRUE;
741 bool PropertyMatched = FALSE;
743 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
744 intiter != SplitPoints.end(); ++intiter){
746 SLiter = SplitLength.find(intiter->first);
747 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
748 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
749 intPrevValue = intiter->second;
751 CaptureString(&PropertyValue, FALSE);
753 if (PropertyName == wxT("TYPE")){
755 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
756 PropertyValue == wxT("work") ){
758 FullNamesListType.erase(*FNCount);
759 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
763 PropertyMatched = TRUE;
767 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
768 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
769 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
770 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
772 if (PropertyMatched == TRUE){
774 PropertyMatched = FALSE;
779 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
783 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
785 if (!PropertyTokens.IsEmpty()){
787 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
793 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
795 std::map<int, int> SplitPoints;
796 std::map<int, int> SplitLength;
798 int intPrevValue = 3;
800 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
804 wxString PropertyName;
805 wxString PropertyValue;
806 wxString PropertyData;
807 wxString PropertyTokens;
808 std::map<int,int>::iterator SLiter;
809 bool FirstToken = TRUE;
811 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
812 intiter != SplitPoints.end(); ++intiter){
814 SLiter = SplitLength.find(intiter->first);
815 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
816 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
817 intPrevValue = intiter->second;
819 CaptureString(&PropertyValue, FALSE);
821 if (PropertyName == wxT("ALTID")){
823 NameAltID = PropertyValue;
825 } else if (PropertyName == wxT("LANGUAGE")){
827 NameLanguage = PropertyValue;
829 } else if (PropertyName == wxT("SORT-AS")){
831 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
832 PropertyValue.Len() >= 3){
833 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
836 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
838 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
844 // Split the name data.
846 int intSplitSeek = 0;
847 int intSplitsFound = 0;
848 int intSplitSize = 0;
849 int intPropertyLen = PropertySeg2.Len();
851 std::map<int,wxString> NameValues;
854 for (int i = 0; i <= intPropertyLen; i++){
856 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
858 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
863 if (intSplitsFound == 4){
865 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
879 // Split the data into several parts.
881 for (std::map<int, wxString>::iterator iter = NameValues.begin();
882 iter != NameValues.end(); ++iter){
884 if (iter->first == 1){
886 // Deal with family name.
888 NameSurname = iter->second;
890 } else if (iter->first == 2){
892 // Deal with given names.
894 NameForename = iter->second;
896 } else if (iter->first == 3){
898 // Deal with additional names.
900 NameOtherNames = iter->second;
902 } else if (iter->first == 4){
904 // Deal with honorifix prefixes and suffixes.
906 NameTitle = iter->second;
910 if (iter == NameValues.end()){
916 NameSuffix = iter->second;
922 // Add the name token data.
924 if (!PropertyTokens.IsEmpty()){
926 NameTokens = PropertyTokens;
932 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
934 size_t intPropertyLen = PropertySeg1.Len();
935 std::map<int, int> SplitPoints;
936 std::map<int, int> SplitLength;
937 std::map<int, int>::iterator SLiter;
938 wxString PropertyData;
939 wxString PropertyName;
940 wxString PropertyValue;
941 wxString PropertyTokens;
942 bool FirstToken = TRUE;
943 int intSplitsFound = 0;
944 int intSplitSize = 0;
945 int intPrevValue = 14;
947 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
951 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
952 intiter != SplitPoints.end(); ++intiter){
954 SLiter = SplitLength.find(intiter->first);
955 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
956 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
957 intPrevValue = intiter->second;
959 // Process properties.
961 CaptureString(&PropertyValue, FALSE);
963 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
967 CaptureString(&PropertySeg2, FALSE);
969 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
971 if (!PropertyTokens.IsEmpty()){
973 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
979 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
981 std::map<int, int> SplitPoints;
982 std::map<int, int> SplitLength;
984 int intPrevValue = 10;
986 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
990 PropertyType PropType = PROPERTY_NONE;
992 // Look for type before continuing.
994 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
998 std::map<int, wxString> *NicknamesList = NULL;
999 std::map<int, wxString> *NicknamesListType = NULL;
1000 std::map<int, wxString> *NicknamesListLanguage = NULL;
1001 std::map<int, wxString> *NicknamesListAltID = NULL;
1002 std::map<int, wxString> *NicknamesListPID = NULL;
1003 std::map<int, wxString> *NicknamesListTokens = NULL;
1004 std::map<int, int> *NicknamesListPref = NULL;
1008 NicknamesList = &GeneralNicknamesList;
1009 NicknamesListType = &GeneralNicknamesListType;
1010 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1011 NicknamesListAltID = &GeneralNicknamesListAltID;
1012 NicknamesListPID = &GeneralNicknamesListPID;
1013 NicknamesListTokens = &GeneralNicknamesListTokens;
1014 NicknamesListPref = &GeneralNicknamesListPref;
1017 NicknamesList = &HomeNicknamesList;
1018 NicknamesListType = &HomeNicknamesListType;
1019 NicknamesListLanguage = &HomeNicknamesListLanguage;
1020 NicknamesListAltID = &HomeNicknamesListAltID;
1021 NicknamesListPID = &HomeNicknamesListPID;
1022 NicknamesListTokens = &HomeNicknamesListTokens;
1023 NicknamesListPref = &HomeNicknamesListPref;
1026 NicknamesList = &BusinessNicknamesList;
1027 NicknamesListType = &BusinessNicknamesListType;
1028 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1029 NicknamesListAltID = &BusinessNicknamesListAltID;
1030 NicknamesListPID = &BusinessNicknamesListPID;
1031 NicknamesListTokens = &BusinessNicknamesListTokens;
1032 NicknamesListPref = &BusinessNicknamesListPref;
1036 std::map<int, int>::iterator SLiter;
1037 wxString PropertyData;
1038 wxString PropertyName;
1039 wxString PropertyValue;
1040 wxString PropertyTokens;
1041 bool FirstToken = TRUE;
1042 bool PropertyMatched = FALSE;
1044 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1045 intiter != SplitPoints.end(); ++intiter){
1047 SLiter = SplitLength.find(intiter->first);
1048 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1049 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1050 intPrevValue = intiter->second;
1052 CaptureString(&PropertyValue, FALSE);
1054 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1055 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1056 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1057 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1059 if (PropertyMatched == TRUE){
1061 PropertyMatched = FALSE;
1066 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1070 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1072 // Add the name token data.
1074 if (!PropertyTokens.IsEmpty()){
1076 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1082 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1084 std::map<int, int> SplitPoints;
1085 std::map<int, int> SplitLength;
1086 std::map<int, int>::iterator SLiter;
1087 wxString PropertyData;
1088 wxString PropertyName;
1089 wxString PropertyValue;
1090 wxString PropertyTokens;
1091 bool FirstToken = TRUE;
1092 int intPrevValue = 8;
1094 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1098 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1099 intiter != SplitPoints.end(); ++intiter){
1101 SLiter = SplitLength.find(intiter->first);
1102 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1103 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1104 intPrevValue = intiter->second;
1106 // Process properties.
1108 size_t intPropertyValueLen = PropertyValue.Len();
1110 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1112 PropertyValue.Trim();
1113 PropertyValue.RemoveLast();
1117 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1119 PropertyValue.Remove(0, 1);
1123 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1127 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1129 wxString GenderComponent;
1131 if (GenderData.CountTokens() >= 2){
1133 Gender = GenderData.GetNextToken();
1134 GenderDetails = GenderData.GetString();
1136 CaptureString(&GenderDetails, FALSE);
1140 Gender = GenderData.GetNextToken();
1144 if (!PropertyTokens.IsEmpty()){
1146 GenderTokens = PropertyTokens;
1152 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1154 // Process date. Preserve the remainder in the string.
1156 std::map<int, int> SplitPoints;
1157 std::map<int, int> SplitLength;
1158 std::map<int, int>::iterator SLiter;
1159 wxString PropertyData;
1160 wxString PropertyName;
1161 wxString PropertyValue;
1162 wxString PropertyTokens;
1163 int intPrevValue = 6;
1165 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1169 // Look for type before continuing.
1171 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1172 intiter != SplitPoints.end(); ++intiter){
1174 SLiter = SplitLength.find(intiter->first);
1175 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1176 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1177 intPrevValue = intiter->second;
1179 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1181 CaptureString(&PropertySeg2, FALSE);
1182 Birthday = PropertySeg2;
1183 BirthdayText = TRUE;
1189 // Setup blank lines for later on.
1192 bool FirstToken = TRUE;
1194 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1195 intiter != SplitPoints.end(); ++intiter){
1197 SLiter = SplitLength.find(intiter->first);
1198 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1199 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1200 intPrevValue = intiter->second;
1202 // Process properties.
1204 CaptureString(&PropertyValue, FALSE);
1206 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1208 PropertyValue.Trim();
1209 PropertyValue.RemoveLast();
1213 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1215 PropertyValue.Remove(0, 1);
1219 if (PropertyName == wxT("ALTID")){
1221 BirthdayAltID = PropertyValue;
1223 } else if (PropertyName == wxT("CALSCALE")){
1225 BirthdayCalScale = PropertyValue;
1227 } else if (PropertyName != wxT("VALUE")) {
1229 // Something else we don't know about so append
1230 // to the tokens variable.
1232 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1238 // Add the data to the variables and form.
1240 if (BirthdayText == FALSE){
1242 Birthday = PropertySeg2;
1246 if (!PropertyTokens.IsEmpty()){
1248 BirthdayTokens = PropertyTokens;
1254 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1256 // Process date. Preserve the remainder in the string.
1258 std::map<int, int> SplitPoints;
1259 std::map<int, int> SplitLength;
1260 std::map<int, int>::iterator SLiter;
1261 wxString PropertyData;
1262 wxString PropertyName;
1263 wxString PropertyValue;
1264 wxString PropertyTokens;
1265 int intPrevValue = 13;
1267 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1271 // Look for type before continuing.
1273 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1274 intiter != SplitPoints.end(); ++intiter){
1276 SLiter = SplitLength.find(intiter->first);
1277 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1278 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1279 intPrevValue = intiter->second;
1281 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1283 CaptureString(&PropertySeg2, FALSE);
1284 Anniversary = PropertySeg2;
1285 AnniversaryText = TRUE;
1291 // Setup blank lines for later on.
1294 bool FirstToken = TRUE;
1296 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1297 intiter != SplitPoints.end(); ++intiter){
1299 SLiter = SplitLength.find(intiter->first);
1300 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1301 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1302 intPrevValue = intiter->second;
1304 // Process properties.
1306 CaptureString(&PropertyValue, FALSE);
1308 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1310 PropertyValue.Trim();
1311 PropertyValue.RemoveLast();
1315 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1317 PropertyValue.Remove(0, 1);
1321 if (PropertyName == wxT("ALTID")){
1323 AnniversaryAltID = PropertyValue;
1325 } else if (PropertyName == wxT("CALSCALE")){
1327 AnniversaryCalScale = PropertyValue;
1329 } else if (PropertyName != wxT("VALUE")) {
1331 // Something else we don't know about so append
1332 // to the tokens variable.
1334 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1340 // Add the data to the variables and form.
1342 if (AnniversaryText == FALSE){
1344 Anniversary = PropertySeg2;
1348 if (!PropertyTokens.IsEmpty()){
1350 AnniversaryTokens = PropertyTokens;
1356 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1358 std::map<int, int> SplitPoints;
1359 std::map<int, int> SplitLength;
1361 int intPrevValue = 4;
1363 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1367 PropertyType PropType = PROPERTY_NONE;
1369 // Look for type before continuing.
1371 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1375 std::map<int, wxString> *TZList = NULL;
1376 std::map<int, wxString> *TZListType = NULL;
1377 std::map<int, wxString> *TZListMediatype = NULL;
1378 std::map<int, wxString> *TZListAltID = NULL;
1379 std::map<int, wxString> *TZListPID = NULL;
1380 std::map<int, wxString> *TZListTokens = NULL;
1381 std::map<int, int> *TZListPref = NULL;
1385 TZList = &GeneralTZList;
1386 TZListType = &GeneralTZListType;
1387 TZListMediatype = &GeneralTZListMediatype;
1388 TZListAltID = &GeneralTZListAltID;
1389 TZListPID = &GeneralTZListPID;
1390 TZListTokens = &GeneralTZListTokens;
1391 TZListPref = &GeneralTZListPref;
1394 TZList = &HomeTZList;
1395 TZListType = &HomeTZListType;
1396 TZListMediatype = &HomeTZListMediatype;
1397 TZListAltID = &HomeTZListAltID;
1398 TZListPID = &HomeTZListPID;
1399 TZListTokens = &HomeTZListTokens;
1400 TZListPref = &HomeTZListPref;
1403 TZList = &BusinessTZList;
1404 TZListType = &BusinessTZListType;
1405 TZListMediatype = &BusinessTZListMediatype;
1406 TZListAltID = &BusinessTZListAltID;
1407 TZListPID = &BusinessTZListPID;
1408 TZListTokens = &BusinessTZListTokens;
1409 TZListPref = &BusinessTZListPref;
1413 std::map<int, int>::iterator SLiter;
1414 wxString PropertyData;
1415 wxString PropertyName;
1416 wxString PropertyValue;
1417 wxString PropertyTokens;
1418 bool FirstToken = TRUE;
1419 bool PropertyMatched = FALSE;
1421 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1422 intiter != SplitPoints.end(); ++intiter){
1424 SLiter = SplitLength.find(intiter->first);
1425 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1426 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1427 intPrevValue = intiter->second;
1429 CaptureString(&PropertyValue, FALSE);
1431 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1432 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1433 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1434 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1436 if (PropertyMatched == TRUE){
1438 PropertyMatched = FALSE;
1443 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1445 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1451 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1453 // Add the name token data.
1455 if (!PropertyTokens.IsEmpty()){
1457 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1464 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1466 size_t intPropertyLen = PropertySeg1.Len();
1467 std::map<int, int> SplitPoints;
1468 std::map<int, int> SplitLength;
1469 std::map<int, int>::iterator SLiter;
1470 wxString PropertyData;
1471 wxString PropertyName;
1472 wxString PropertyValue;
1473 wxString PropertyTokens;
1474 wxString AddressLabel;
1475 wxString AddressLang;
1476 wxString AddressAltID;
1477 wxString AddressPID;
1478 wxString AddressTokens;
1479 wxString AddressGeo;
1480 wxString AddressTimezone;
1481 wxString AddressType;
1482 wxString AddressMediatype;
1483 wxString AddressPOBox;
1484 wxString AddressExtended;
1485 wxString AddressStreet;
1486 wxString AddressLocality;
1487 wxString AddressCity;
1488 wxString AddressRegion;
1489 wxString AddressPostalCode;
1490 wxString AddressCountry;
1491 bool FirstToken = TRUE;
1492 int intSplitsFound = 0;
1493 int intSplitSize = 0;
1494 int intPrevValue = 5;
1495 bool PropertyMatched = FALSE;
1497 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1501 PropertyType PropType = PROPERTY_NONE;
1503 // Look for type before continuing.
1505 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1509 std::map<int, wxString> *AddressList = NULL;
1510 std::map<int, wxString> *AddressListTown = NULL;
1511 std::map<int, wxString> *AddressListCounty = NULL;
1512 std::map<int, wxString> *AddressListPostCode = NULL;
1513 std::map<int, wxString> *AddressListCountry = NULL;
1514 std::map<int, wxString> *AddressListLabel = NULL;
1515 std::map<int, wxString> *AddressListLang = NULL;
1516 std::map<int, wxString> *AddressListAltID = NULL;
1517 std::map<int, wxString> *AddressListPID = NULL;
1518 std::map<int, wxString> *AddressListTokens = NULL;
1519 std::map<int, wxString> *AddressListGeo = NULL;
1520 std::map<int, wxString> *AddressListTimezone = NULL;
1521 std::map<int, wxString> *AddressListType = NULL;
1522 std::map<int, wxString> *AddressListMediatype = NULL;
1523 std::map<int, int> *AddressListPref = NULL;
1527 AddressList = &GeneralAddressList;
1528 AddressListTown = &GeneralAddressListTown;
1529 AddressListCounty = &GeneralAddressListCounty;
1530 AddressListPostCode = &GeneralAddressListPostCode;
1531 AddressListCountry = &GeneralAddressListCountry;
1532 AddressListLabel = &GeneralAddressListLabel;
1533 AddressListLang = &GeneralAddressListLang;
1534 AddressListAltID = &GeneralAddressListAltID;
1535 AddressListPID = &GeneralAddressListPID;
1536 AddressListTokens = &GeneralAddressListTokens;
1537 AddressListGeo = &GeneralAddressListGeo;
1538 AddressListTimezone = &GeneralAddressListTimezone;
1539 AddressListType = &GeneralAddressListType;
1540 AddressListMediatype = &GeneralAddressListMediatype;
1541 AddressListPref = &GeneralAddressListPref;
1544 AddressList = &HomeAddressList;
1545 AddressListTown = &HomeAddressListTown;
1546 AddressListCounty = &HomeAddressListCounty;
1547 AddressListPostCode = &HomeAddressListPostCode;
1548 AddressListCountry = &HomeAddressListCountry;
1549 AddressListLabel = &HomeAddressListLabel;
1550 AddressListLang = &HomeAddressListLang;
1551 AddressListAltID = &HomeAddressListAltID;
1552 AddressListPID = &HomeAddressListPID;
1553 AddressListTokens = &HomeAddressListTokens;
1554 AddressListGeo = &HomeAddressListGeo;
1555 AddressListTimezone = &HomeAddressListTimezone;
1556 AddressListType = &HomeAddressListType;
1557 AddressListMediatype = &HomeAddressListMediatype;
1558 AddressListPref = &HomeAddressListPref;
1561 AddressList = &BusinessAddressList;
1562 AddressListTown = &BusinessAddressListTown;
1563 AddressListCounty = &BusinessAddressListCounty;
1564 AddressListPostCode = &BusinessAddressListPostCode;
1565 AddressListCountry = &BusinessAddressListCountry;
1566 AddressListLabel = &BusinessAddressListLabel;
1567 AddressListLang = &BusinessAddressListLang;
1568 AddressListAltID = &BusinessAddressListAltID;
1569 AddressListPID = &BusinessAddressListPID;
1570 AddressListTokens = &BusinessAddressListTokens;
1571 AddressListGeo = &BusinessAddressListGeo;
1572 AddressListTimezone = &BusinessAddressListTimezone;
1573 AddressListType = &BusinessAddressListType;
1574 AddressListMediatype = &BusinessAddressListMediatype;
1575 AddressListPref = &BusinessAddressListPref;
1581 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1582 intiter != SplitPoints.end(); ++intiter){
1584 SLiter = SplitLength.find(intiter->first);
1585 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1586 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1587 intPrevValue = intiter->second;
1589 CaptureString(&PropertyValue, FALSE);
1591 // Process properties.
1593 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1594 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1595 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1596 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1597 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1598 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1599 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1600 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1602 if (PropertyMatched == TRUE){
1604 PropertyMatched = FALSE;
1609 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1613 // Split the address.
1615 //std::map<int, int>::iterator SLiter;
1616 intPropertyLen = PropertySeg2.Len();
1617 SplitPoints.clear();
1618 SplitLength.clear();
1623 for (int i = 0; i <= intPropertyLen; i++){
1627 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1630 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1632 if (intSplitsFound == 6){
1634 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1639 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1649 // Split the data into several parts.
1651 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1652 intiter != SplitPoints.end(); ++intiter){
1654 if (intiter->first == 1){
1656 // Deal with PO Box.
1658 SLiter = SplitLength.find(1);
1660 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1661 intPrevValue = intiter->second;
1663 } else if (intiter->first == 2){
1665 // Deal with extended address.
1667 SLiter = SplitLength.find(2);
1669 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1670 intPrevValue = intiter->second;
1672 } else if (intiter->first == 3){
1674 // Deal with street address.
1676 SLiter = SplitLength.find(3);
1678 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1679 intPrevValue = intiter->second;
1681 } else if (intiter->first == 4){
1683 // Deal with locality
1685 SLiter = SplitLength.find(4);
1687 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1688 intPrevValue = intiter->second;
1690 } else if (intiter->first == 5){
1692 // Deal with region.
1694 SLiter = SplitLength.find(5);
1696 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1697 intPrevValue = intiter->second;
1700 } else if (intiter->first == 6){
1702 // Deal with post code.
1704 SLiter = SplitLength.find(6);
1706 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1707 intPrevValue = intiter->second;
1709 // Deal with country.
1711 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1719 // Add the data to the General/Home/Work address variables.
1721 CaptureString(&AddressStreet, FALSE);
1722 CaptureString(&AddressLocality, FALSE);
1723 CaptureString(&AddressRegion, FALSE);
1724 CaptureString(&AddressPostalCode, FALSE);
1725 CaptureString(&AddressCountry, FALSE);
1727 if (!PropertyTokens.IsEmpty()){
1729 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1733 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1734 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1735 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1736 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1737 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1741 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1744 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1747 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1751 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1755 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1757 std::map<int, int> SplitPoints;
1758 std::map<int, int> SplitLength;
1760 int intPrevValue = 7;
1762 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1766 PropertyType PropType = PROPERTY_NONE;
1768 // Look for type before continuing.
1770 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1772 std::map<int, wxString> *EmailList = NULL;
1773 std::map<int, wxString> *EmailListType = NULL;
1774 std::map<int, wxString> *EmailListAltID = NULL;
1775 std::map<int, wxString> *EmailListPID = NULL;
1776 std::map<int, wxString> *EmailListTokens = NULL;
1777 std::map<int, int> *EmailListPref = NULL;
1781 EmailList = &GeneralEmailList;
1782 EmailListType = &GeneralEmailListType;
1783 EmailListAltID = &GeneralEmailListAltID;
1784 EmailListPID = &GeneralEmailListPID;
1785 EmailListTokens = &GeneralEmailListTokens;
1786 EmailListPref = &GeneralEmailListPref;
1789 EmailList = &HomeEmailList;
1790 EmailListType = &HomeEmailListType;
1791 EmailListAltID = &HomeEmailListAltID;
1792 EmailListPID = &HomeEmailListPID;
1793 EmailListTokens = &HomeEmailListTokens;
1794 EmailListPref = &HomeEmailListPref;
1797 EmailList = &BusinessEmailList;
1798 EmailListType = &BusinessEmailListType;
1799 EmailListAltID = &BusinessEmailListAltID;
1800 EmailListPID = &BusinessEmailListPID;
1801 EmailListTokens = &BusinessEmailListTokens;
1802 EmailListPref = &BusinessEmailListPref;
1808 std::map<int,int>::iterator SLiter;
1809 wxString PropertyData;
1810 wxString PropertyName;
1811 wxString PropertyValue;
1812 wxString PropertyTokens;
1813 bool FirstToken = TRUE;
1814 bool PropertyMatched = FALSE;
1816 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1817 intiter != SplitPoints.end(); ++intiter){
1819 SLiter = SplitLength.find(intiter->first);
1820 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1821 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1822 intPrevValue = intiter->second;
1824 CaptureString(&PropertyValue, FALSE);
1826 // Process properties.
1828 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
1829 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
1830 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
1832 if (PropertyMatched == TRUE){
1834 PropertyMatched = FALSE;
1839 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1843 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1845 // Add the name token data.
1847 if (!PropertyTokens.IsEmpty()){
1849 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1856 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1858 std::map<int, int> SplitPoints;
1859 std::map<int, int> SplitLength;
1861 int intPrevValue = 6;
1863 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1867 PropertyType PropType = PROPERTY_NONE;
1869 // Look for type before continuing.
1871 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1873 std::map<int, wxString> *IMList = NULL;
1874 std::map<int, wxString> *IMListType = NULL;
1875 std::map<int, wxString> *IMListAltID = NULL;
1876 std::map<int, wxString> *IMListPID = NULL;
1877 std::map<int, wxString> *IMListTokens = NULL;
1878 std::map<int, wxString> *IMListMediatype = NULL;
1879 std::map<int, int> *IMListPref = NULL;
1883 IMList = &GeneralIMList;
1884 IMListType = &GeneralIMListType;
1885 IMListAltID = &GeneralIMListAltID;
1886 IMListPID = &GeneralIMListPID;
1887 IMListTokens = &GeneralIMListTokens;
1888 IMListMediatype = &GeneralIMListMediatype;
1889 IMListPref = &GeneralIMListPref;
1892 IMList = &HomeIMList;
1893 IMListType = &HomeIMListType;
1894 IMListAltID = &HomeIMListAltID;
1895 IMListPID = &HomeIMListPID;
1896 IMListTokens = &HomeIMListTokens;
1897 IMListMediatype = &HomeIMListMediatype;
1898 IMListPref = &HomeIMListPref;
1901 IMList = &BusinessIMList;
1902 IMListType = &BusinessIMListType;
1903 IMListAltID = &BusinessIMListAltID;
1904 IMListPID = &BusinessIMListPID;
1905 IMListTokens = &BusinessIMListTokens;
1906 IMListMediatype = &BusinessIMListMediatype;
1907 IMListPref = &BusinessIMListPref;
1913 std::map<int,int>::iterator SLiter;
1914 wxString PropertyData;
1915 wxString PropertyName;
1916 wxString PropertyValue;
1917 wxString PropertyTokens;
1918 bool FirstToken = TRUE;
1919 bool PropertyMatched = FALSE;
1921 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1922 intiter != SplitPoints.end(); ++intiter){
1924 SLiter = SplitLength.find(intiter->first);
1925 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1926 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1927 intPrevValue = intiter->second;
1929 CaptureString(&PropertyValue, FALSE);
1931 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
1932 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
1933 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
1934 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
1936 // Process properties.
1938 if (PropertyMatched == TRUE){
1940 PropertyMatched = FALSE;
1945 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
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;
1967 PropertyType PropType = PROPERTY_NONE;
1969 // Look for type before continuing.
1972 wxString TelTypeDetail;
1973 wxString PropertyData;
1974 wxString PropertyName;
1975 wxString PropertyValue;
1976 wxString PropertyTokens;
1978 std::map<int,int> TypeSplitPoints;
1979 std::map<int,int> TypeSplitLength;
1980 std::map<int,int>::iterator TSLiter;
1982 int intSplitSize = 0;
1983 int intSplitsFound = 0;
1984 int intSplitPoint = 0;
1986 int intPrevValue = 5;
1988 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1992 // Look for type before continuing.
1994 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1995 intiter != SplitPoints.end(); ++intiter){
1997 SLiter = SplitLength.find(intiter->first);
1998 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1999 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2000 intPrevValue = intiter->second;
2002 if (PropertyName == wxT("TYPE")){
2004 // Process each value in type and translate each
2007 // Strip out the quotes if they are there.
2009 size_t intPropertyValueLen = PropertyValue.Len();
2011 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2013 PropertyValue.Trim();
2014 PropertyValue.RemoveLast();
2018 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2020 PropertyValue.Remove(0, 1);
2024 TelTypeDetail = PropertyValue;
2030 for (int i = 0; i <= intPropertyValueLen; i++){
2034 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2036 if (intSplitsFound == 0){
2038 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2039 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2043 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2044 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2057 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2058 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2060 int intTypeSeek = 0;
2062 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2063 typeiter != TypeSplitPoints.end(); ++typeiter){
2065 wxString TypePropertyName;
2067 TSLiter = TypeSplitLength.find(typeiter->first);
2069 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2071 if (intTypeSeek == 0){
2076 TelTypeUI.Append(wxT(","));
2080 if (TypePropertyName == wxT("home")){
2082 PropType = PROPERTY_HOME;
2084 } else if (TypePropertyName == wxT("work")){
2086 PropType = PROPERTY_WORK;
2091 if (TypePropertyName == wxT("text")){
2093 TelTypeUI.Append(_("text"));
2096 } else if (TypePropertyName == wxT("voice")){
2098 TelTypeUI.Append(_("voice"));
2101 } else if (TypePropertyName == wxT("fax")){
2103 TelTypeUI.Append(_("fax"));
2106 } else if (TypePropertyName == wxT("cell")){
2108 TelTypeUI.Append(_("mobile"));
2111 } else if (TypePropertyName == wxT("video")){
2113 TelTypeUI.Append(_("video"));
2116 } else if (TypePropertyName == wxT("pager")){
2118 TelTypeUI.Append(_("pager"));
2121 } else if (TypePropertyName == wxT("textphone")){
2123 TelTypeUI.Append(_("textphone"));
2134 std::map<int, wxString> *TelephoneList = NULL;
2135 std::map<int, wxString> *TelephoneListType = NULL;
2136 std::map<int, wxString> *TelephoneListAltID = NULL;
2137 std::map<int, wxString> *TelephoneListPID = NULL;
2138 std::map<int, wxString> *TelephoneListTokens = NULL;
2139 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2140 std::map<int, int> *TelephoneListPref = NULL;
2144 TelephoneList = &GeneralTelephoneList;
2145 TelephoneListType = &GeneralTelephoneListType;
2146 TelephoneListAltID = &GeneralTelephoneListAltID;
2147 TelephoneListPID = &GeneralTelephoneListPID;
2148 TelephoneListTokens = &GeneralTelephoneListTokens;
2149 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2150 TelephoneListPref = &GeneralTelephoneListPref;
2153 TelephoneList = &HomeTelephoneList;
2154 TelephoneListType = &HomeTelephoneListType;
2155 TelephoneListAltID = &HomeTelephoneListAltID;
2156 TelephoneListPID = &HomeTelephoneListPID;
2157 TelephoneListTokens = &HomeTelephoneListTokens;
2158 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2159 TelephoneListPref = &HomeTelephoneListPref;
2162 TelephoneList = &BusinessTelephoneList;
2163 TelephoneListType = &BusinessTelephoneListType;
2164 TelephoneListAltID = &BusinessTelephoneListAltID;
2165 TelephoneListPID = &BusinessTelephoneListPID;
2166 TelephoneListTokens = &BusinessTelephoneListTokens;
2167 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2168 TelephoneListPref = &BusinessTelephoneListPref;
2172 // Process the properties.
2174 bool FirstToken = TRUE;
2177 SplitPoints.clear();
2178 SplitLength.clear();
2180 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2184 bool PropertyMatched = FALSE;
2186 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2187 intiter != SplitPoints.end(); ++intiter){
2189 SLiter = SplitLength.find(intiter->first);
2190 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2191 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2192 intPrevValue = intiter->second;
2194 CaptureString(&PropertyValue, FALSE);
2196 // Process properties.
2198 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2199 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2200 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2202 if (PropertyMatched == TRUE){
2204 PropertyMatched = FALSE;
2209 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2213 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2214 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2216 // Add the name token data.
2218 if (!PropertyTokens.IsEmpty()){
2220 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2226 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2228 std::map<int, int> SplitPoints;
2229 std::map<int, int> SplitLength;
2231 int intPrevValue = 6;
2233 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2237 PropertyType PropType = PROPERTY_NONE;
2239 // Look for type before continuing.
2241 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2243 std::map<int, wxString> *LanguageList = NULL;
2244 std::map<int, wxString> *LanguageListType = NULL;
2245 std::map<int, wxString> *LanguageListAltID = NULL;
2246 std::map<int, wxString> *LanguageListPID = NULL;
2247 std::map<int, wxString> *LanguageListTokens = NULL;
2248 std::map<int, int> *LanguageListPref = NULL;
2252 LanguageList = &GeneralLanguageList;
2253 LanguageListType = &GeneralLanguageListType;
2254 LanguageListAltID = &GeneralLanguageListAltID;
2255 LanguageListPID = &GeneralLanguageListPID;
2256 LanguageListTokens = &GeneralLanguageListTokens;
2257 LanguageListPref = &GeneralLanguageListPref;
2260 LanguageList = &HomeLanguageList;
2261 LanguageListType = &HomeLanguageListType;
2262 LanguageListAltID = &HomeLanguageListAltID;
2263 LanguageListPID = &HomeLanguageListPID;
2264 LanguageListTokens = &HomeLanguageListTokens;
2265 LanguageListPref = &HomeLanguageListPref;
2268 LanguageList = &BusinessLanguageList;
2269 LanguageListType = &BusinessLanguageListType;
2270 LanguageListAltID = &BusinessLanguageListAltID;
2271 LanguageListPID = &BusinessLanguageListPID;
2272 LanguageListTokens = &BusinessLanguageListTokens;
2273 LanguageListPref = &BusinessLanguageListPref;
2279 std::map<int,int>::iterator SLiter;
2280 wxString PropertyData;
2281 wxString PropertyName;
2282 wxString PropertyValue;
2283 wxString PropertyTokens;
2284 bool FirstToken = TRUE;
2285 bool PropertyMatched = FALSE;
2287 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2288 intiter != SplitPoints.end(); ++intiter){
2290 SLiter = SplitLength.find(intiter->first);
2291 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2292 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2293 intPrevValue = intiter->second;
2295 CaptureString(&PropertyValue, FALSE);
2297 // Process properties.
2299 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2300 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2301 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2303 if (PropertyMatched == TRUE){
2305 PropertyMatched = FALSE;
2310 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2314 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2316 // Add the name token data.
2318 if (!PropertyTokens.IsEmpty()){
2320 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2326 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2328 std::map<int, int> SplitPoints;
2329 std::map<int, int> SplitLength;
2331 int intPrevValue = 5;
2333 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2337 PropertyType PropType = PROPERTY_NONE;
2339 // Look for type before continuing.
2341 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2343 std::map<int, wxString> *GeopositionList = NULL;
2344 std::map<int, wxString> *GeopositionListType = NULL;
2345 std::map<int, wxString> *GeopositionListAltID = NULL;
2346 std::map<int, wxString> *GeopositionListPID = NULL;
2347 std::map<int, wxString> *GeopositionListTokens = NULL;
2348 std::map<int, wxString> *GeopositionListMediatype = NULL;
2349 std::map<int, int> *GeopositionListPref = NULL;
2353 GeopositionList = &GeneralGeographyList;
2354 GeopositionListType = &GeneralGeographyListType;
2355 GeopositionListAltID = &GeneralGeographyListAltID;
2356 GeopositionListPID = &GeneralGeographyListPID;
2357 GeopositionListTokens = &GeneralGeographyListTokens;
2358 GeopositionListMediatype = &GeneralGeographyListMediatype;
2359 GeopositionListPref = &GeneralGeographyListPref;
2362 GeopositionList = &HomeGeographyList;
2363 GeopositionListType = &HomeGeographyListType;
2364 GeopositionListAltID = &HomeGeographyListAltID;
2365 GeopositionListPID = &HomeGeographyListPID;
2366 GeopositionListTokens = &HomeGeographyListTokens;
2367 GeopositionListMediatype = &HomeGeographyListMediatype;
2368 GeopositionListPref = &HomeGeographyListPref;
2371 GeopositionList = &BusinessGeographyList;
2372 GeopositionListType = &BusinessGeographyListType;
2373 GeopositionListAltID = &BusinessGeographyListAltID;
2374 GeopositionListPID = &BusinessGeographyListPID;
2375 GeopositionListTokens = &BusinessGeographyListTokens;
2376 GeopositionListMediatype = &BusinessGeographyListMediatype;
2377 GeopositionListPref = &BusinessGeographyListPref;
2383 std::map<int,int>::iterator SLiter;
2384 wxString PropertyData;
2385 wxString PropertyName;
2386 wxString PropertyValue;
2387 wxString PropertyTokens;
2388 bool FirstToken = TRUE;
2389 bool PropertyMatched = FALSE;
2391 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2392 intiter != SplitPoints.end(); ++intiter){
2394 SLiter = SplitLength.find(intiter->first);
2395 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2396 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2397 intPrevValue = intiter->second;
2399 CaptureString(&PropertyValue, FALSE);
2401 // Process properties.
2403 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2404 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2405 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2406 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2408 if (PropertyMatched == TRUE){
2410 PropertyMatched = FALSE;
2415 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2419 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2421 // Add the name token data.
2423 if (!PropertyTokens.IsEmpty()){
2425 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2431 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2433 size_t intPropertyLen = PropertySeg1.Len();
2434 std::map<int, int> SplitPoints;
2435 std::map<int, int> SplitLength;
2436 std::map<int, int>::iterator SLiter;
2437 wxString PropertyData;
2438 wxString PropertyName;
2439 wxString PropertyValue;
2440 wxString PropertyTokens;
2441 wxString RelatedType;
2442 wxString RelatedTypeOriginal;
2443 wxString RelatedName;
2444 bool FirstToken = TRUE;
2445 int intSplitsFound = 0;
2446 int intSplitSize = 0;
2447 int intPrevValue = 9;
2449 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2453 // Look for type before continuing.
2455 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2456 intiter != SplitPoints.end(); ++intiter){
2458 SLiter = SplitLength.find(intiter->first);
2459 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2460 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2461 intPrevValue = intiter->second;
2465 RelatedTypeOriginal = PropertyValue;
2467 if (PropertyName == wxT("TYPE")){
2469 if (PropertyValue == wxT("contact")){
2471 RelatedType = _("Contact");
2473 } else if (PropertyValue == wxT("acquaintance")){
2475 RelatedType = _("Acquaintance");
2477 } else if (PropertyValue == wxT("friend")){
2479 RelatedType = _("Friend");
2481 } else if (PropertyValue == wxT("met")){
2483 RelatedType = _("Met");
2485 } else if (PropertyValue == wxT("co-worker")){
2487 RelatedType = _("Co-worker");
2489 } else if (PropertyValue == wxT("colleague")){
2491 RelatedType = _("Colleague");
2493 } else if (PropertyValue == wxT("co-resident")){
2495 RelatedType = _("Co-resident");
2497 } else if (PropertyValue == wxT("neighbor")){
2499 RelatedType = _("Neighbour");
2501 } else if (PropertyValue == wxT("child")){
2503 RelatedType = _("Child");
2505 } else if (PropertyValue == wxT("parent")){
2507 RelatedType = _("Parent");
2509 } else if (PropertyValue == wxT("sibling")){
2511 RelatedType = _("Sibling");
2513 } else if (PropertyValue == wxT("spouse")){
2515 RelatedType = _("Spouse");
2517 } else if (PropertyValue == wxT("kin")){
2519 RelatedType = _("Kin");
2521 } else if (PropertyValue == wxT("muse")){
2523 RelatedType = _("Muse");
2525 } else if (PropertyValue == wxT("crush")){
2527 RelatedType = _("Crush");
2529 } else if (PropertyValue == wxT("date")){
2531 RelatedType = _("Date");
2533 } else if (PropertyValue == wxT("sweetheart")){
2535 RelatedType = _("Sweetheart");
2537 } else if (PropertyValue == wxT("me")){
2539 RelatedType = _("Me");
2541 } else if (PropertyValue == wxT("agent")){
2543 RelatedType = _("Agent");
2545 } else if (PropertyValue == wxT("emergency")){
2547 RelatedType = _("Emergency");
2551 RelatedType = PropertyValue;
2561 bool PropertyMatched = FALSE;
2563 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2564 intiter != SplitPoints.end(); ++intiter){
2566 SLiter = SplitLength.find(intiter->first);
2567 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2568 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2569 intPrevValue = intiter->second;
2571 // Process properties.
2573 size_t intPropertyValueLen = PropertyValue.Len();
2575 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2577 PropertyValue.Trim();
2578 PropertyValue.RemoveLast();
2582 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2584 PropertyValue.Remove(0, 1);
2588 CaptureString(&PropertyValue, FALSE);
2590 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2591 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2592 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2593 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2595 if (PropertyMatched == TRUE){
2597 PropertyMatched = FALSE;
2602 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2606 // Add the data to the General/Home/Work address variables.
2608 GeneralRelatedList.erase(*RelatedCount);
2609 GeneralRelatedListRelType.erase(*RelatedCount);
2610 GeneralRelatedListType.erase(*RelatedCount);
2611 GeneralRelatedListTokens.erase(*RelatedCount);
2612 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2613 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2614 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2615 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2619 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2621 std::map<int, int> SplitPoints;
2622 std::map<int, int> SplitLength;
2623 std::map<int, int>::iterator SLiter;
2624 wxString PropertyData;
2625 wxString PropertyName;
2626 wxString PropertyValue;
2627 wxString PropertyTokens;
2628 bool FirstToken = TRUE;
2629 int intPrevValue = 5;
2631 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2635 PropertyType PropType = PROPERTY_NONE;
2637 // Look for type before continuing.
2639 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2641 // Setup the pointers.
2643 std::map<int, wxString> *WebsiteList = NULL;
2644 std::map<int, wxString> *WebsiteListAltID = NULL;
2645 std::map<int, wxString> *WebsiteListPID = NULL;
2646 std::map<int, wxString> *WebsiteListType = NULL;
2647 std::map<int, wxString> *WebsiteListTokens = NULL;
2648 std::map<int, wxString> *WebsiteListMediatype = NULL;
2649 std::map<int, int> *WebsiteListPref = NULL;
2651 // Setup blank lines for later on.
2655 WebsiteList = &GeneralWebsiteList;
2656 WebsiteListType = &GeneralWebsiteListType;
2657 WebsiteListAltID = &GeneralWebsiteListAltID;
2658 WebsiteListPID = &GeneralWebsiteListPID;
2659 WebsiteListTokens = &GeneralWebsiteListTokens;
2660 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2661 WebsiteListPref = &GeneralWebsiteListPref;
2664 WebsiteList = &HomeWebsiteList;
2665 WebsiteListType = &HomeWebsiteListType;
2666 WebsiteListAltID = &HomeWebsiteListAltID;
2667 WebsiteListPID = &HomeWebsiteListPID;
2668 WebsiteListTokens = &HomeWebsiteListTokens;
2669 WebsiteListMediatype = &HomeWebsiteListMediatype;
2670 WebsiteListPref = &HomeWebsiteListPref;
2673 WebsiteList = &BusinessWebsiteList;
2674 WebsiteListType = &BusinessWebsiteListType;
2675 WebsiteListAltID = &BusinessWebsiteListAltID;
2676 WebsiteListPID = &BusinessWebsiteListPID;
2677 WebsiteListTokens = &BusinessWebsiteListTokens;
2678 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2679 WebsiteListPref = &BusinessWebsiteListPref;
2684 bool PropertyMatched = FALSE;
2686 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2687 intiter != SplitPoints.end(); ++intiter){
2689 SLiter = SplitLength.find(intiter->first);
2690 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2691 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2692 intPrevValue = intiter->second;
2694 // Process properties.
2696 size_t intPropertyValueLen = PropertyValue.Len();
2698 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2700 PropertyValue.Trim();
2701 PropertyValue.RemoveLast();
2705 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2707 PropertyValue.Remove(0, 1);
2711 CaptureString(&PropertyValue, FALSE);
2713 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
2714 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
2715 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
2716 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
2718 if (PropertyMatched == TRUE){
2720 PropertyMatched = FALSE;
2725 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2729 // Add the data to the General/Home/Work address variables.
2731 CaptureString(&PropertySeg2, FALSE);
2733 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
2735 if (!PropertyTokens.IsEmpty()){
2737 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
2743 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
2745 std::map<int, int> SplitPoints;
2746 std::map<int, int> SplitLength;
2747 std::map<int, int>::iterator SLiter;
2748 wxString PropertyData;
2749 wxString PropertyName;
2750 wxString PropertyValue;
2751 wxString PropertyTokens;
2752 bool FirstToken = TRUE;
2753 int intPrevValue = 7;
2755 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2759 PropertyType PropType = PROPERTY_NONE;
2761 // Look for type before continuing.
2763 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2765 // Setup the pointers.
2767 std::map<int, wxString> *TitleList = NULL;
2768 std::map<int, wxString> *TitleListAltID = NULL;
2769 std::map<int, wxString> *TitleListPID = NULL;
2770 std::map<int, wxString> *TitleListType = NULL;
2771 std::map<int, wxString> *TitleListTokens = NULL;
2772 std::map<int, wxString> *TitleListLanguage = NULL;
2773 std::map<int, int> *TitleListPref = NULL;
2775 // Setup blank lines for later on.
2779 TitleList = &GeneralTitleList;
2780 TitleListType = &GeneralTitleListType;
2781 TitleListAltID = &GeneralTitleListAltID;
2782 TitleListPID = &GeneralTitleListPID;
2783 TitleListTokens = &GeneralTitleListTokens;
2784 TitleListLanguage = &GeneralTitleListLanguage;
2785 TitleListPref = &GeneralTitleListPref;
2788 TitleList = &HomeTitleList;
2789 TitleListType = &HomeTitleListType;
2790 TitleListAltID = &HomeTitleListAltID;
2791 TitleListPID = &HomeTitleListPID;
2792 TitleListTokens = &HomeTitleListTokens;
2793 TitleListLanguage = &HomeTitleListLanguage;
2794 TitleListPref = &HomeTitleListPref;
2797 TitleList = &BusinessTitleList;
2798 TitleListType = &BusinessTitleListType;
2799 TitleListAltID = &BusinessTitleListAltID;
2800 TitleListPID = &BusinessTitleListPID;
2801 TitleListTokens = &BusinessTitleListTokens;
2802 TitleListLanguage = &BusinessTitleListLanguage;
2803 TitleListPref = &BusinessTitleListPref;
2808 bool PropertyMatched = FALSE;
2810 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2811 intiter != SplitPoints.end(); ++intiter){
2813 SLiter = SplitLength.find(intiter->first);
2814 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2815 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2816 intPrevValue = intiter->second;
2818 // Process properties.
2820 size_t intPropertyValueLen = PropertyValue.Len();
2822 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2824 PropertyValue.Trim();
2825 PropertyValue.RemoveLast();
2829 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2831 PropertyValue.Remove(0, 1);
2835 CaptureString(&PropertyValue, FALSE);
2837 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
2838 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
2839 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
2840 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
2842 if (PropertyMatched == TRUE){
2844 PropertyMatched = FALSE;
2849 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2853 // Add the data to the General/Home/Work address variables.
2855 CaptureString(&PropertySeg2, FALSE);
2857 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
2859 if (!PropertyTokens.IsEmpty()){
2861 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
2867 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
2869 std::map<int, int> SplitPoints;
2870 std::map<int, int> SplitLength;
2871 std::map<int, int>::iterator SLiter;
2872 wxString PropertyData;
2873 wxString PropertyName;
2874 wxString PropertyValue;
2875 wxString PropertyTokens;
2876 bool FirstToken = TRUE;
2877 int intPrevValue = 6;
2879 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2883 PropertyType PropType = PROPERTY_NONE;
2885 // Look for type before continuing.
2887 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2889 // Setup the pointers.
2891 std::map<int, wxString> *RoleList = NULL;
2892 std::map<int, wxString> *RoleListAltID = NULL;
2893 std::map<int, wxString> *RoleListPID = NULL;
2894 std::map<int, wxString> *RoleListType = NULL;
2895 std::map<int, wxString> *RoleListTokens = NULL;
2896 std::map<int, wxString> *RoleListLanguage = NULL;
2897 std::map<int, int> *RoleListPref = NULL;
2899 // Setup blank lines for later on.
2903 RoleList = &GeneralRoleList;
2904 RoleListType = &GeneralRoleListType;
2905 RoleListAltID = &GeneralRoleListAltID;
2906 RoleListPID = &GeneralRoleListPID;
2907 RoleListTokens = &GeneralRoleListTokens;
2908 RoleListLanguage = &GeneralRoleListLanguage;
2909 RoleListPref = &GeneralRoleListPref;
2912 RoleList = &HomeRoleList;
2913 RoleListType = &HomeRoleListType;
2914 RoleListAltID = &HomeRoleListAltID;
2915 RoleListPID = &HomeRoleListPID;
2916 RoleListTokens = &HomeRoleListTokens;
2917 RoleListLanguage = &HomeRoleListLanguage;
2918 RoleListPref = &HomeRoleListPref;
2921 RoleList = &BusinessRoleList;
2922 RoleListType = &BusinessRoleListType;
2923 RoleListAltID = &BusinessRoleListAltID;
2924 RoleListPID = &BusinessRoleListPID;
2925 RoleListTokens = &BusinessRoleListTokens;
2926 RoleListLanguage = &BusinessRoleListLanguage;
2927 RoleListPref = &BusinessRoleListPref;
2932 bool PropertyMatched = FALSE;
2934 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2935 intiter != SplitPoints.end(); ++intiter){
2937 SLiter = SplitLength.find(intiter->first);
2938 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2939 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2940 intPrevValue = intiter->second;
2942 // Process properties.
2944 size_t intPropertyValueLen = PropertyValue.Len();
2946 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2948 PropertyValue.Trim();
2949 PropertyValue.RemoveLast();
2953 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2955 PropertyValue.Remove(0, 1);
2959 CaptureString(&PropertyValue, FALSE);
2961 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
2962 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
2963 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
2964 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
2966 if (PropertyMatched == TRUE){
2968 PropertyMatched = FALSE;
2973 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2977 // Add the data to the General/Home/Work address variables.
2979 CaptureString(&PropertySeg2, FALSE);
2981 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
2983 if (!PropertyTokens.IsEmpty()){
2985 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
2991 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
2993 std::map<int, int> SplitPoints;
2994 std::map<int, int> SplitLength;
2995 std::map<int, int>::iterator SLiter;
2996 wxString PropertyData;
2997 wxString PropertyName;
2998 wxString PropertyValue;
2999 wxString PropertyTokens;
3000 bool FirstToken = TRUE;
3001 int intPrevValue = 5;
3003 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3007 PropertyType PropType = PROPERTY_NONE;
3009 // Look for type before continuing.
3011 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3013 // Setup the pointers.
3015 std::map<int, wxString> *OrganisationsList = NULL;
3016 std::map<int, wxString> *OrganisationsListAltID = NULL;
3017 std::map<int, wxString> *OrganisationsListPID = NULL;
3018 std::map<int, wxString> *OrganisationsListType = NULL;
3019 std::map<int, wxString> *OrganisationsListTokens = NULL;
3020 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3021 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3022 std::map<int, int> *OrganisationsListPref = NULL;
3024 // Setup blank lines for later on.
3028 OrganisationsList = &GeneralOrganisationsList;
3029 OrganisationsListType = &GeneralOrganisationsListType;
3030 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3031 OrganisationsListPID = &GeneralOrganisationsListPID;
3032 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3033 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3034 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3035 OrganisationsListPref = &GeneralOrganisationsListPref;
3038 OrganisationsList = &HomeOrganisationsList;
3039 OrganisationsListType = &HomeOrganisationsListType;
3040 OrganisationsListAltID = &HomeOrganisationsListAltID;
3041 OrganisationsListPID = &HomeOrganisationsListPID;
3042 OrganisationsListTokens = &HomeOrganisationsListTokens;
3043 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3044 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3045 OrganisationsListPref = &HomeOrganisationsListPref;
3048 OrganisationsList = &BusinessOrganisationsList;
3049 OrganisationsListType = &BusinessOrganisationsListType;
3050 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3051 OrganisationsListPID = &BusinessOrganisationsListPID;
3052 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3053 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3054 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3055 OrganisationsListPref = &BusinessOrganisationsListPref;
3060 bool PropertyMatched = FALSE;
3062 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3063 intiter != SplitPoints.end(); ++intiter){
3065 SLiter = SplitLength.find(intiter->first);
3066 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3067 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3068 intPrevValue = intiter->second;
3070 // Process properties.
3072 size_t intPropertyValueLen = PropertyValue.Len();
3074 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3076 PropertyValue.Trim();
3077 PropertyValue.RemoveLast();
3081 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3083 PropertyValue.Remove(0, 1);
3087 CaptureString(&PropertyValue, FALSE);
3089 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3090 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3091 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3092 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3093 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3095 if (PropertyMatched == TRUE){
3097 PropertyMatched = FALSE;
3102 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3106 // Add the data to the General/Home/Work address variables.
3108 CaptureString(&PropertySeg2, FALSE);
3110 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3112 if (!PropertyTokens.IsEmpty()){
3114 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3120 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3122 std::map<int, int> SplitPoints;
3123 std::map<int, int> SplitLength;
3124 std::map<int, int>::iterator SLiter;
3125 wxString PropertyData;
3126 wxString PropertyName;
3127 wxString PropertyValue;
3128 wxString PropertyTokens;
3129 bool FirstToken = TRUE;
3130 int intPrevValue = 6;
3132 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3136 PropertyType PropType = PROPERTY_NONE;
3138 // Look for type before continuing.
3140 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3142 // Setup the pointers.
3144 std::map<int, wxString> *NoteList = NULL;
3145 std::map<int, wxString> *NoteListAltID = NULL;
3146 std::map<int, wxString> *NoteListPID = NULL;
3147 std::map<int, wxString> *NoteListType = NULL;
3148 std::map<int, wxString> *NoteListTokens = NULL;
3149 std::map<int, wxString> *NoteListLanguage = NULL;
3150 std::map<int, int> *NoteListPref = NULL;
3152 // Setup blank lines for later on.
3156 NoteList = &GeneralNoteList;
3157 NoteListType = &GeneralNoteListType;
3158 NoteListAltID = &GeneralNoteListAltID;
3159 NoteListPID = &GeneralNoteListPID;
3160 NoteListTokens = &GeneralNoteListTokens;
3161 NoteListLanguage = &GeneralNoteListLanguage;
3162 NoteListPref = &GeneralNoteListPref;
3165 NoteList = &HomeNoteList;
3166 NoteListType = &HomeNoteListType;
3167 NoteListAltID = &HomeNoteListAltID;
3168 NoteListPID = &HomeNoteListPID;
3169 NoteListTokens = &HomeNoteListTokens;
3170 NoteListLanguage = &HomeNoteListLanguage;
3171 NoteListPref = &HomeNoteListPref;
3174 NoteList = &BusinessNoteList;
3175 NoteListType = &BusinessNoteListType;
3176 NoteListAltID = &BusinessNoteListAltID;
3177 NoteListPID = &BusinessNoteListPID;
3178 NoteListTokens = &BusinessNoteListTokens;
3179 NoteListLanguage = &BusinessNoteListLanguage;
3180 NoteListPref = &BusinessNoteListPref;
3185 bool PropertyMatched = FALSE;
3187 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3188 intiter != SplitPoints.end(); ++intiter){
3190 SLiter = SplitLength.find(intiter->first);
3191 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3192 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3193 intPrevValue = intiter->second;
3195 // Process properties.
3197 size_t intPropertyValueLen = PropertyValue.Len();
3199 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3201 PropertyValue.Trim();
3202 PropertyValue.RemoveLast();
3206 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3208 PropertyValue.Remove(0, 1);
3212 CaptureString(&PropertyValue, FALSE);
3214 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3215 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3216 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3217 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3219 if (PropertyMatched == TRUE){
3221 PropertyMatched = FALSE;
3226 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3230 // Add the data to the General/Home/Work address variables.
3232 CaptureString(&PropertySeg2, FALSE);
3234 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3236 if (!PropertyTokens.IsEmpty()){
3238 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3244 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3246 std::map<int, int> SplitPoints;
3247 std::map<int, int> SplitLength;
3248 std::map<int, int>::iterator SLiter;
3249 wxString PropertyData;
3250 wxString PropertyName;
3251 wxString PropertyValue;
3252 wxString PropertyTokens;
3253 bool FirstToken = TRUE;
3254 int intPrevValue = 12;
3256 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3260 PropertyType PropType = PROPERTY_NONE;
3262 // Look for type before continuing.
3264 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3266 // Setup blank lines for later on.
3272 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3275 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3280 bool PropertyMatched = FALSE;
3282 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3283 intiter != SplitPoints.end(); ++intiter){
3285 SLiter = SplitLength.find(intiter->first);
3286 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3287 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3288 intPrevValue = intiter->second;
3290 // Process properties.
3292 size_t intPropertyValueLen = PropertyValue.Len();
3294 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3296 PropertyValue.Trim();
3297 PropertyValue.RemoveLast();
3301 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3303 PropertyValue.Remove(0, 1);
3307 CaptureString(&PropertyValue, FALSE);
3309 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3310 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3311 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3312 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3314 if (PropertyMatched == TRUE){
3316 PropertyMatched = FALSE;
3321 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3325 // Deal with multiple categories.
3327 int intOrigCatCount = *CategoryCount;
3328 bool FirstCategoryProcessed = TRUE;
3329 bool AfterFirstToken = FALSE;
3330 int intSplitSize = 0;
3331 int intSplitsFound = 0;
3332 int intSplitSeek = 0;
3333 int intPropertyLen = PropertySeg2.Len();
3335 SplitPoints.clear();
3336 SplitLength.clear();
3339 for (int i = 0; i <= intPropertyLen; i++){
3341 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3349 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3351 if (AfterFirstToken == TRUE){
3353 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3354 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3358 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3359 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3360 AfterFirstToken = TRUE;
3372 if (SplitPoints.size() > 0){
3374 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3375 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3379 if (SplitPoints.size() == 0){
3381 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3383 if (!PropertyTokens.IsEmpty()){
3385 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3391 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3392 intiter != SplitPoints.end(); ++intiter){
3394 SLiter = SplitLength.find(intiter->first);
3396 intPrevValue = intiter->second;
3398 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3400 // Add the data to the General/Home/Work address variables.
3402 // Trim any whitespace from the start and end.
3404 PropertyData = PropertyData.Trim(FALSE);
3405 PropertyData = PropertyData.Trim(TRUE);
3407 CaptureString(&PropertyData, FALSE);
3409 if (FirstCategoryProcessed == TRUE){
3411 FirstCategoryProcessed = FALSE;
3413 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3415 if (!PropertyTokens.IsEmpty()){
3417 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3427 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3429 if (!PropertyTokens.IsEmpty()){
3431 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3437 // Copy the properties to each of the categories (if it exists).
3439 if (!PropertyTokens.IsEmpty()){
3441 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3445 // Check if ALTID was used.
3447 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3449 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3453 // Check if PID was used.
3455 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3457 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3461 // Check if PREF was used.
3463 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3465 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3469 // Check if LANGUAGE was used.
3471 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3473 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3477 // Check if TYPE was used.
3483 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3486 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3494 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3496 size_t intPropertyLen = PropertySeg1.Len();
3497 std::map<int, int> SplitPoints;
3498 std::map<int, int> SplitLength;
3499 std::map<int, int>::iterator SLiter;
3500 wxString PropertyData;
3501 wxString PropertyName;
3502 wxString PropertyValue;
3503 wxString PropertyTokens;
3504 bool FirstToken = TRUE;
3505 int intSplitsFound = 0;
3506 int intSplitSize = 0;
3507 int intPrevValue = 7;
3509 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3513 PropertyType PropType = PROPERTY_NONE;
3515 // Look for type before continuing.
3517 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3520 bool PropertyMatched = FALSE;
3522 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3523 intiter != SplitPoints.end(); ++intiter){
3525 SLiter = SplitLength.find(intiter->first);
3526 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3527 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3528 intPrevValue = intiter->second;
3530 // Process properties.
3532 size_t intPropertyValueLen = PropertyValue.Len();
3534 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3536 PropertyValue.Trim();
3537 PropertyValue.RemoveLast();
3541 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3543 PropertyValue.Remove(0, 1);
3547 CaptureString(&PropertyValue, FALSE);
3549 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3550 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3551 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3552 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
3554 if (PropertyMatched == TRUE){
3556 PropertyMatched = FALSE;
3561 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3565 intPropertyLen = PropertySeg2.Len();
3566 SplitPoints.clear();
3567 SplitLength.clear();
3572 CaptureString(&PropertySeg2, FALSE);
3574 for (int i = 0; i <= intPropertyLen; i++){
3578 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3581 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3583 if (intSplitsFound == 6){
3585 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3590 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3600 wxString wxSPhotoURI;
3601 wxString wxSPhotoMIME;
3602 wxString wxSPhotoEncoding;
3603 wxString wxSPhotoData;
3604 std::string base64enc;
3606 if (intSplitsFound == 0){
3610 std::map<int, int>::iterator striter;
3612 striter = SplitLength.find(1);
3614 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3616 while (wSTDataType.HasMoreTokens() == TRUE){
3618 wxSPhotoURI = wSTDataType.GetNextToken();
3619 wxSPhotoMIME = wSTDataType.GetNextToken();
3624 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3626 while (wSTDataInfo.HasMoreTokens() == TRUE){
3628 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3629 wxSPhotoData = wSTDataInfo.GetNextToken();
3630 base64enc = wxSPhotoData.mb_str();
3637 // Add the data to the General/Home/Work address variables.
3639 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
3640 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
3641 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
3647 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
3650 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
3654 if (!PropertyTokens.IsEmpty()){
3656 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
3662 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
3664 size_t intPropertyLen = PropertySeg1.Len();
3665 std::map<int, int> SplitPoints;
3666 std::map<int, int> SplitLength;
3667 std::map<int, int>::iterator SLiter;
3668 wxString PropertyData;
3669 wxString PropertyName;
3670 wxString PropertyValue;
3671 wxString PropertyTokens;
3672 bool FirstToken = TRUE;
3673 int intSplitsFound = 0;
3674 int intSplitSize = 0;
3675 int intPrevValue = 6;
3677 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3681 PropertyType PropType = PROPERTY_NONE;
3683 // Look for type before continuing.
3685 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3688 bool PropertyMatched = FALSE;
3690 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3691 intiter != SplitPoints.end(); ++intiter){
3693 SLiter = SplitLength.find(intiter->first);
3694 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3695 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3696 intPrevValue = intiter->second;
3698 // Process properties.
3700 size_t intPropertyValueLen = PropertyValue.Len();
3702 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3704 PropertyValue.Trim();
3705 PropertyValue.RemoveLast();
3709 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3711 PropertyValue.Remove(0, 1);
3715 CaptureString(&PropertyValue, FALSE);
3717 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
3718 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
3719 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
3720 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
3722 if (PropertyMatched == TRUE){
3724 PropertyMatched = FALSE;
3729 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3733 intPropertyLen = PropertySeg2.Len();
3734 SplitPoints.clear();
3735 SplitLength.clear();
3740 CaptureString(&PropertySeg2, FALSE);
3742 for (int i = 0; i <= intPropertyLen; i++){
3746 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3749 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3751 if (intSplitsFound == 6){
3753 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3758 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3768 wxString wxSPhotoURI;
3769 wxString wxSPhotoMIME;
3770 wxString wxSPhotoEncoding;
3771 wxString wxSPhotoData;
3772 std::string base64enc;
3774 if (intSplitsFound == 0){
3778 std::map<int, int>::iterator striter;
3780 striter = SplitLength.find(1);
3782 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3784 while (wSTDataType.HasMoreTokens() == TRUE){
3786 wxSPhotoURI = wSTDataType.GetNextToken();
3787 wxSPhotoMIME = wSTDataType.GetNextToken();
3792 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3794 while (wSTDataInfo.HasMoreTokens() == TRUE){
3796 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3797 wxSPhotoData = wSTDataInfo.GetNextToken();
3798 base64enc = wxSPhotoData.mb_str();
3805 // Add the data to the General/Home/Work address variables.
3807 LogosList.insert(std::make_pair(*LogoCount, base64enc));
3808 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
3809 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
3815 LogosListType.insert(std::make_pair(*LogoCount, "home"));
3818 LogosListType.insert(std::make_pair(*LogoCount, "work"));
3822 if (!PropertyTokens.IsEmpty()){
3824 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
3830 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
3832 size_t intPropertyLen = PropertySeg1.Len();
3833 std::map<int, int> SplitPoints;
3834 std::map<int, int> SplitLength;
3835 std::map<int, int>::iterator SLiter;
3836 wxString PropertyData;
3837 wxString PropertyName;
3838 wxString PropertyValue;
3839 wxString PropertyTokens;
3840 bool FirstToken = TRUE;
3841 int intSplitsFound = 0;
3842 int intSplitSize = 0;
3843 int intPrevValue = 7;
3845 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3849 PropertyType PropType = PROPERTY_NONE;
3851 // Look for type before continuing.
3853 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3856 bool PropertyMatched = FALSE;
3858 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3859 intiter != SplitPoints.end(); ++intiter){
3861 SLiter = SplitLength.find(intiter->first);
3862 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3863 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3864 intPrevValue = intiter->second;
3866 // Process properties.
3868 size_t intPropertyValueLen = PropertyValue.Len();
3870 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3872 PropertyValue.Trim();
3873 PropertyValue.RemoveLast();
3877 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3879 PropertyValue.Remove(0, 1);
3883 CaptureString(&PropertyValue, FALSE);
3885 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
3886 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
3887 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
3888 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
3889 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
3891 if (PropertyMatched == TRUE){
3893 PropertyMatched = FALSE;
3898 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3902 intPropertyLen = PropertySeg2.Len();
3903 SplitPoints.clear();
3904 SplitLength.clear();
3909 CaptureString(&PropertySeg2, FALSE);
3911 for (int i = 0; i <= intPropertyLen; i++){
3915 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3918 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3920 if (intSplitsFound == 6){
3922 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3927 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3937 wxString wxSSoundURI;
3938 wxString wxSSoundMIME;
3939 wxString wxSSoundEncoding;
3940 wxString wxSSoundData;
3941 std::string base64enc;
3943 if (intSplitsFound == 0){
3947 std::map<int, int>::iterator striter;
3949 striter = SplitLength.find(1);
3951 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3953 while (wSTDataType.HasMoreTokens() == TRUE){
3955 wxSSoundURI = wSTDataType.GetNextToken();
3956 wxSSoundMIME = wSTDataType.GetNextToken();
3961 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3963 while (wSTDataInfo.HasMoreTokens() == TRUE){
3965 wxSSoundEncoding = wSTDataInfo.GetNextToken();
3966 wxSSoundData = wSTDataInfo.GetNextToken();
3967 base64enc = wxSSoundData.mb_str();
3974 // Add the data to the General/Home/Work address variables.
3980 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
3983 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
3987 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
3988 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
3989 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
3991 if (!PropertyTokens.IsEmpty()){
3993 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
3999 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4001 size_t intPropertyLen = PropertySeg1.Len();
4002 std::map<int, int> SplitPoints;
4003 std::map<int, int> SplitLength;
4004 std::map<int, int>::iterator SLiter;
4005 wxString PropertyData;
4006 wxString PropertyName;
4007 wxString PropertyValue;
4008 wxString PropertyTokens;
4009 bool FirstToken = TRUE;
4010 int intSplitsFound = 0;
4011 int intSplitSize = 0;
4012 int intPrevValue = 8;
4014 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4018 PropertyType PropType = PROPERTY_NONE;
4020 // Look for type before continuing.
4022 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4025 bool PropertyMatched = FALSE;
4027 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4028 intiter != SplitPoints.end(); ++intiter){
4030 SLiter = SplitLength.find(intiter->first);
4031 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4032 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4033 intPrevValue = intiter->second;
4035 // Process properties.
4037 size_t intPropertyValueLen = PropertyValue.Len();
4039 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4041 PropertyValue.Trim();
4042 PropertyValue.RemoveLast();
4046 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4048 PropertyValue.Remove(0, 1);
4052 CaptureString(&PropertyValue, FALSE);
4054 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4055 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4056 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4057 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4059 if (PropertyMatched == TRUE){
4061 PropertyMatched = FALSE;
4066 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4070 intPropertyLen = PropertySeg2.Len();
4071 SplitPoints.clear();
4072 SplitLength.clear();
4077 CaptureString(&PropertySeg2, FALSE);
4079 // Add the data to the General/Home/Work address variables.
4085 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4088 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4092 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4094 if (!PropertyTokens.IsEmpty()){
4096 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4102 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4104 size_t intPropertyLen = PropertySeg1.Len();
4105 std::map<int, int> SplitPoints;
4106 std::map<int, int> SplitLength;
4107 std::map<int, int>::iterator SLiter;
4108 wxString PropertyData;
4109 wxString PropertyName;
4110 wxString PropertyValue;
4111 wxString PropertyTokens;
4112 bool FirstToken = TRUE;
4113 int intSplitsFound = 0;
4114 int intSplitSize = 0;
4115 int intPrevValue = 8;
4117 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4121 PropertyType PropType = PROPERTY_NONE;
4123 // Look for type before continuing.
4125 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4128 bool PropertyMatched = FALSE;
4130 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4131 intiter != SplitPoints.end(); ++intiter){
4133 SLiter = SplitLength.find(intiter->first);
4134 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4135 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4136 intPrevValue = intiter->second;
4138 // Process properties.
4140 size_t intPropertyValueLen = PropertyValue.Len();
4142 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4144 PropertyValue.Trim();
4145 PropertyValue.RemoveLast();
4149 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4151 PropertyValue.Remove(0, 1);
4155 CaptureString(&PropertyValue, FALSE);
4157 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4158 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4159 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4160 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4162 if (PropertyMatched == TRUE){
4164 PropertyMatched = FALSE;
4169 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4173 intPropertyLen = PropertySeg2.Len();
4174 SplitPoints.clear();
4175 SplitLength.clear();
4180 CaptureString(&PropertySeg2, FALSE);
4182 // Add the data to the General/Home/Work address variables.
4188 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4191 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4195 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4197 if (!PropertyTokens.IsEmpty()){
4199 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4205 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4207 size_t intPropertyLen = PropertySeg1.Len();
4208 std::map<int, int> SplitPoints;
4209 std::map<int, int> SplitLength;
4210 std::map<int, int>::iterator SLiter;
4211 wxString PropertyData;
4212 wxString PropertyName;
4213 wxString PropertyValue;
4214 wxString PropertyTokens;
4215 bool FirstToken = TRUE;
4216 int intSplitsFound = 0;
4217 int intSplitSize = 0;
4218 int intPrevValue = 7;
4220 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4224 PropertyType PropType = PROPERTY_NONE;
4226 // Look for type before continuing.
4228 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4231 bool PropertyMatched = FALSE;
4233 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4234 intiter != SplitPoints.end(); ++intiter){
4236 SLiter = SplitLength.find(intiter->first);
4237 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4238 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4239 intPrevValue = intiter->second;
4241 // Process properties.
4243 size_t intPropertyValueLen = PropertyValue.Len();
4245 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4247 PropertyValue.Trim();
4248 PropertyValue.RemoveLast();
4252 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4254 PropertyValue.Remove(0, 1);
4258 CaptureString(&PropertyValue, FALSE);
4260 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4261 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4262 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4263 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4265 if (PropertyMatched == TRUE){
4267 PropertyMatched = FALSE;
4272 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4276 intPropertyLen = PropertySeg2.Len();
4277 SplitPoints.clear();
4278 SplitLength.clear();
4283 CaptureString(&PropertySeg2, FALSE);
4285 // Add the data to the General/Home/Work address variables.
4291 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4294 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4298 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4300 if (!PropertyTokens.IsEmpty()){
4302 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4308 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4310 size_t intPropertyLen = PropertySeg1.Len();
4311 std::map<int, int> SplitPoints;
4312 std::map<int, int> SplitLength;
4313 std::map<int, int>::iterator SLiter;
4314 wxString PropertyData;
4315 wxString PropertyName;
4316 wxString PropertyValue;
4317 wxString PropertyTokens;
4318 bool FirstToken = TRUE;
4319 int intSplitsFound = 0;
4320 int intSplitSize = 0;
4321 int intPrevValue = 5;
4323 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4327 PropertyType PropType = PROPERTY_NONE;
4329 // Look for type before continuing.
4331 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4334 bool PropertyMatched = FALSE;
4336 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4337 intiter != SplitPoints.end(); ++intiter){
4339 SLiter = SplitLength.find(intiter->first);
4340 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4341 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4342 intPrevValue = intiter->second;
4344 // Process properties.
4346 size_t intPropertyValueLen = PropertyValue.Len();
4348 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4350 PropertyValue.Trim();
4351 PropertyValue.RemoveLast();
4355 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4357 PropertyValue.Remove(0, 1);
4361 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4362 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4363 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4365 if (PropertyMatched == TRUE){
4367 PropertyMatched = FALSE;
4372 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4376 intPropertyLen = PropertySeg2.Len();
4377 SplitPoints.clear();
4378 SplitLength.clear();
4383 for (int i = 0; i <= intPropertyLen; i++){
4387 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4390 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4392 if (intSplitsFound == 6){
4394 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4399 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4410 wxString wxSKeyMIME;
4411 wxString wxSKeyEncoding;
4412 wxString wxSKeyData;
4413 std::string base64enc;
4415 if (intSplitsFound == 0){
4419 std::map<int, int>::iterator striter;
4421 striter = SplitLength.find(1);
4423 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4425 while (wSTDataType.HasMoreTokens() == TRUE){
4427 wxSKeyURI = wSTDataType.GetNextToken();
4428 wxSKeyMIME = wSTDataType.GetNextToken();
4433 if (wxSKeyURI == wxT("data")){
4435 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4437 while (wSTDataInfo.HasMoreTokens() == TRUE){
4439 wxSKeyEncoding = wSTDataInfo.GetNextToken();
4440 wxSKeyData = wSTDataInfo.GetNextToken();
4449 // Add the data to the General/Home/Work address variables.
4451 if (wxSKeyURI == wxT("data")){
4453 KeyListDataEncType.erase(*KeyCount);
4454 KeyListKeyType.erase(*KeyCount);
4455 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
4456 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
4458 KeyList.erase(*KeyCount);
4459 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
4463 KeyList.erase(*KeyCount);
4464 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
4468 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
4474 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
4477 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
4481 if (!PropertyTokens.IsEmpty()){
4483 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
4489 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
4491 // Split the Vendor three ways.
4493 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
4496 wxString wxSVNDPropName;
4498 while (wSTVendorDetails.HasMoreTokens() == TRUE){
4500 wSTVendorDetails.GetNextToken();
4501 wxSVNDID = wSTVendorDetails.GetNextToken();
4502 wxSVNDPropName = wSTVendorDetails.GetNextToken();
4507 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
4509 // Add the data to the vendor variables.
4511 VendorList.erase(*VendorCount);
4512 VendorListPEN.erase(*VendorCount);
4513 VendorListElement.erase(*VendorCount);
4515 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
4516 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
4517 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
4523 void ContactDataObject::ClearData(){
4526 NameForename.clear();
4527 NameSurname.clear();
4528 NameOtherNames.clear();
4530 NameNickname.clear();
4531 NameDisplayAs.clear();
4532 NameLanguage.clear();
4537 BirthdayAltID.clear();
4538 BirthdayCalScale.clear();
4539 BirthdayTokens.clear();
4540 Anniversary.clear();
4541 AnniversaryAltID.clear();
4542 AnniversaryCalScale.clear();
4543 AnniversaryTokens.clear();
4546 GenderDetails.clear();
4547 GenderTokens.clear();
4551 RevisionTokens.clear();
4554 SourceListAltID.clear();
4555 SourceListPID.clear();
4556 SourceListType.clear();
4557 SourceListTokens.clear();
4558 SourceListMediatype.clear();
4559 SourceListPref.clear();
4562 XMLListAltID.clear();
4564 ClientPIDList.clear();
4565 ClientPIDListTokens.clear();
4567 FullNamesList.clear();
4568 FullNamesListType.clear();
4569 FullNamesListLanguage.clear();
4570 FullNamesListAltID.clear();
4571 FullNamesListPID.clear();
4572 FullNamesListTokens.clear();
4573 FullNamesListPref.clear();
4575 GeneralNicknamesList.clear();
4576 GeneralNicknamesListType.clear();
4577 GeneralNicknamesListLanguage.clear();
4578 GeneralNicknamesListAltID.clear();
4579 GeneralNicknamesListPID.clear();
4580 GeneralNicknamesListTokens.clear();
4581 GeneralNicknamesListPref.clear();
4583 GeneralAddressList.clear();
4584 GeneralAddressListTown.clear();
4585 GeneralAddressListCounty.clear();
4586 GeneralAddressListPostCode.clear();
4587 GeneralAddressListCountry.clear();
4588 GeneralAddressListLabel.clear();
4589 GeneralAddressListLang.clear();
4590 GeneralAddressListAltID.clear();
4591 GeneralAddressListPID.clear();
4592 GeneralAddressListTokens.clear();
4593 GeneralAddressListGeo.clear();
4594 GeneralAddressListTimezone.clear();
4595 GeneralAddressListType.clear();
4596 GeneralAddressListMediatype.clear();
4597 GeneralAddressListPref.clear();
4599 GeneralEmailList.clear();
4600 GeneralEmailListAltID.clear();
4601 GeneralEmailListPID.clear();
4602 GeneralEmailListType.clear();
4603 GeneralEmailListTokens.clear();
4604 GeneralEmailListPref.clear();
4606 GeneralIMList.clear();
4607 GeneralIMListAltID.clear();
4608 GeneralIMListPID.clear();
4609 GeneralIMListType.clear();
4610 GeneralIMListTypeInfo.clear();
4611 GeneralIMListTokens.clear();
4612 GeneralIMListMediatype.clear();
4613 GeneralIMListPref.clear();
4615 GeneralTelephoneList.clear();
4616 GeneralTelephoneListAltID.clear();
4617 GeneralTelephoneListPID.clear();
4618 GeneralTelephoneListType.clear();
4619 GeneralTelephoneListTokens.clear();
4620 GeneralTelephoneListTypeInfo.clear();
4621 GeneralTelephoneListPref.clear();
4623 GeneralLanguageList.clear();
4624 GeneralLanguageListAltID.clear();
4625 GeneralLanguageListPID.clear();
4626 GeneralLanguageListType.clear();
4627 GeneralLanguageListTokens.clear();
4628 GeneralLanguageListPref.clear();
4630 GeneralTZList.clear();
4631 GeneralTZListAltID.clear();
4632 GeneralTZListPID.clear();
4633 GeneralTZListType.clear();
4634 GeneralTZListTokens.clear();
4635 GeneralTZListMediatype.clear();
4636 GeneralTZListPref.clear();
4638 GeneralGeographyList.clear();
4639 GeneralGeographyListAltID.clear();
4640 GeneralGeographyListPID.clear();
4641 GeneralGeographyListType.clear();
4642 GeneralGeographyListTokens.clear();
4643 GeneralGeographyListMediatype.clear();
4644 GeneralGeographyListPref.clear();
4646 GeneralRelatedList.clear();
4647 GeneralRelatedListRelType.clear();
4648 GeneralRelatedListLanguage.clear();
4649 GeneralRelatedListAltID.clear();
4650 GeneralRelatedListPID.clear();
4651 GeneralRelatedListType.clear();
4652 GeneralRelatedListTokens.clear();
4653 GeneralRelatedListPref.clear();
4655 GeneralWebsiteList.clear();
4656 GeneralWebsiteListAltID.clear();
4657 GeneralWebsiteListPID.clear();
4658 GeneralWebsiteListType.clear();
4659 GeneralWebsiteListTokens.clear();
4660 GeneralWebsiteListMediatype.clear();
4661 GeneralWebsiteListPref.clear();
4663 GeneralTitleList.clear();
4664 GeneralTitleListLanguage.clear();
4665 GeneralTitleListAltID.clear();
4666 GeneralTitleListPID.clear();
4667 GeneralTitleListType.clear();
4668 GeneralTitleListTokens.clear();
4669 GeneralTitleListPref.clear();
4671 GeneralRoleList.clear();
4672 GeneralRoleListLanguage.clear();
4673 GeneralRoleListAltID.clear();
4674 GeneralRoleListPID.clear();
4675 GeneralRoleListType.clear();
4676 GeneralRoleListTokens.clear();
4677 GeneralRoleListPref.clear();
4679 GeneralOrganisationsList.clear();
4680 GeneralOrganisationsListLanguage.clear();
4681 GeneralOrganisationsListAltID.clear();
4682 GeneralOrganisationsListPID.clear();
4683 GeneralOrganisationsListType.clear();
4684 GeneralOrganisationsListTokens.clear();
4685 GeneralOrganisationsListSortAs.clear();
4686 GeneralOrganisationsListPref.clear();
4688 GeneralNoteList.clear();
4689 GeneralNoteListLanguage.clear();
4690 GeneralNoteListAltID.clear();
4691 GeneralNoteListPID.clear();
4692 GeneralNoteListType.clear();
4693 GeneralNoteListTokens.clear();
4694 GeneralNoteListPref.clear();
4696 /* Items on Home Tab */
4698 HomeNicknamesList.clear();
4699 HomeNicknamesListType.clear();
4700 HomeNicknamesListLanguage.clear();
4701 HomeNicknamesListAltID.clear();
4702 HomeNicknamesListPID.clear();
4703 HomeNicknamesListTokens.clear();
4704 HomeNicknamesListPref.clear();
4706 HomeAddressList.clear();
4707 HomeAddressListTown.clear();
4708 HomeAddressListCounty.clear();
4709 HomeAddressListPostCode.clear();
4710 HomeAddressListCountry.clear();
4711 HomeAddressListLabel.clear();
4712 HomeAddressListLang.clear();
4713 HomeAddressListAltID.clear();
4714 HomeAddressListPID.clear();
4715 HomeAddressListTokens.clear();
4716 HomeAddressListGeo.clear();
4717 HomeAddressListTimezone.clear();
4718 HomeAddressListType.clear();
4719 HomeAddressListMediatype.clear();
4720 HomeAddressListPref.clear();
4722 HomeEmailList.clear();
4723 HomeEmailListAltID.clear();
4724 HomeEmailListPID.clear();
4725 HomeEmailListType.clear();
4726 HomeEmailListTokens.clear();
4727 HomeEmailListPref.clear();
4730 HomeIMListAltID.clear();
4731 HomeIMListPID.clear();
4732 HomeIMListType.clear();
4733 HomeIMListTypeInfo.clear();
4734 HomeIMListTokens.clear();
4735 HomeIMListMediatype.clear();
4736 HomeIMListPref.clear();
4738 HomeTelephoneList.clear();
4739 HomeTelephoneListAltID.clear();
4740 HomeTelephoneListPID.clear();
4741 HomeTelephoneListType.clear();
4742 HomeTelephoneListTokens.clear();
4743 HomeTelephoneListTypeInfo.clear();
4744 HomeTelephoneListPref.clear();
4746 HomeLanguageList.clear();
4747 HomeLanguageListAltID.clear();
4748 HomeLanguageListPID.clear();
4749 HomeLanguageListType.clear();
4750 HomeLanguageListTokens.clear();
4751 HomeLanguageListPref.clear();
4754 HomeTZListAltID.clear();
4755 HomeTZListPID.clear();
4756 HomeTZListType.clear();
4757 HomeTZListTokens.clear();
4758 HomeTZListMediatype.clear();
4759 HomeTZListPref.clear();
4761 HomeGeographyList.clear();
4762 HomeGeographyListAltID.clear();
4763 HomeGeographyListPID.clear();
4764 HomeGeographyListType.clear();
4765 HomeGeographyListTokens.clear();
4766 HomeGeographyListMediatype.clear();
4767 HomeGeographyListPref.clear();
4769 HomeWebsiteList.clear();
4770 HomeWebsiteListAltID.clear();
4771 HomeWebsiteListPID.clear();
4772 HomeWebsiteListType.clear();
4773 HomeWebsiteListTokens.clear();
4774 HomeWebsiteListMediatype.clear();
4775 HomeWebsiteListPref.clear();
4777 HomeTitleList.clear();
4778 HomeTitleListLanguage.clear();
4779 HomeTitleListAltID.clear();
4780 HomeTitleListPID.clear();
4781 HomeTitleListType.clear();
4782 HomeTitleListTokens.clear();
4783 HomeTitleListPref.clear();
4785 HomeRoleList.clear();
4786 HomeRoleListLanguage.clear();
4787 HomeRoleListAltID.clear();
4788 HomeRoleListPID.clear();
4789 HomeRoleListType.clear();
4790 HomeRoleListTokens.clear();
4791 HomeRoleListPref.clear();
4793 HomeOrganisationsList.clear();
4794 HomeOrganisationsListLanguage.clear();
4795 HomeOrganisationsListAltID.clear();
4796 HomeOrganisationsListPID.clear();
4797 HomeOrganisationsListType.clear();
4798 HomeOrganisationsListTokens.clear();
4799 HomeOrganisationsListSortAs.clear();
4800 HomeOrganisationsListPref.clear();
4802 HomeNoteList.clear();
4803 HomeNoteListLanguage.clear();
4804 HomeNoteListAltID.clear();
4805 HomeNoteListPID.clear();
4806 HomeNoteListType.clear();
4807 HomeNoteListTokens.clear();
4808 HomeNoteListPref.clear();
4810 /* Items on the Business tab */
4812 BusinessNicknamesList.clear();
4813 BusinessNicknamesListType.clear();
4814 BusinessNicknamesListLanguage.clear();
4815 BusinessNicknamesListAltID.clear();
4816 BusinessNicknamesListPID.clear();
4817 BusinessNicknamesListTokens.clear();
4818 BusinessNicknamesListPref.clear();
4820 BusinessAddressList.clear();
4821 BusinessAddressListTown.clear();
4822 BusinessAddressListCounty.clear();
4823 BusinessAddressListPostCode.clear();
4824 BusinessAddressListCountry.clear();
4825 BusinessAddressListLabel.clear();
4826 BusinessAddressListLang.clear();
4827 BusinessAddressListAltID.clear();
4828 BusinessAddressListPID.clear();
4829 BusinessAddressListTokens.clear();
4830 BusinessAddressListGeo.clear();
4831 BusinessAddressListTimezone.clear();
4832 BusinessAddressListType.clear();
4833 BusinessAddressListMediatype.clear();
4834 BusinessAddressListPref.clear();
4836 BusinessEmailList.clear();
4837 BusinessEmailListAltID.clear();
4838 BusinessEmailListPID.clear();
4839 BusinessEmailListType.clear();
4840 BusinessEmailListTokens.clear();
4841 BusinessEmailListPref.clear();
4843 BusinessIMList.clear();
4844 BusinessIMListAltID.clear();
4845 BusinessIMListPID.clear();
4846 BusinessIMListType.clear();
4847 BusinessIMListTokens.clear();
4848 BusinessIMListMediatype.clear();
4849 BusinessIMListPref.clear();
4851 BusinessTelephoneList.clear();
4852 BusinessTelephoneListAltID.clear();
4853 BusinessTelephoneListPID.clear();
4854 BusinessTelephoneListType.clear();
4855 BusinessTelephoneListTokens.clear();
4856 BusinessTelephoneListPref.clear();
4858 BusinessLanguageList.clear();
4859 BusinessLanguageListAltID.clear();
4860 BusinessLanguageListPID.clear();
4861 BusinessLanguageListType.clear();
4862 BusinessLanguageListTokens.clear();
4863 BusinessLanguageListPref.clear();
4865 BusinessTZList.clear();
4866 BusinessTZListAltID.clear();
4867 BusinessTZListPID.clear();
4868 BusinessTZListType.clear();
4869 BusinessTZListTokens.clear();
4870 BusinessTZListMediatype.clear();
4871 BusinessTZListPref.clear();
4873 BusinessGeographyList.clear();
4874 BusinessGeographyListAltID.clear();
4875 BusinessGeographyListPID.clear();
4876 BusinessGeographyListType.clear();
4877 BusinessGeographyListTokens.clear();
4878 BusinessGeographyListMediatype.clear();
4879 BusinessGeographyListPref.clear();
4881 BusinessWebsiteList.clear();
4882 BusinessWebsiteListAltID.clear();
4883 BusinessWebsiteListPID.clear();
4884 BusinessWebsiteListType.clear();
4885 BusinessWebsiteListTokens.clear();
4886 BusinessWebsiteListMediatype.clear();
4887 BusinessWebsiteListPref.clear();
4889 BusinessTitleList.clear();
4890 BusinessTitleListLanguage.clear();
4891 BusinessTitleListAltID.clear();
4892 BusinessTitleListPID.clear();
4893 BusinessTitleListType.clear();
4894 BusinessTitleListTokens.clear();
4895 BusinessTitleListPref.clear();
4897 BusinessRoleList.clear();
4898 BusinessRoleListLanguage.clear();
4899 BusinessRoleListAltID.clear();
4900 BusinessRoleListPID.clear();
4901 BusinessRoleListType.clear();
4902 BusinessRoleListTokens.clear();
4903 BusinessRoleListPref.clear();
4905 BusinessOrganisationsList.clear();
4906 BusinessOrganisationsListLanguage.clear();
4907 BusinessOrganisationsListAltID.clear();
4908 BusinessOrganisationsListPID.clear();
4909 BusinessOrganisationsListType.clear();
4910 BusinessOrganisationsListTokens.clear();
4911 BusinessOrganisationsListSortAs.clear();
4912 BusinessOrganisationsListPref.clear();
4914 BusinessNoteList.clear();
4915 BusinessNoteListLanguage.clear();
4916 BusinessNoteListAltID.clear();
4917 BusinessNoteListPID.clear();
4918 BusinessNoteListType.clear();
4919 BusinessNoteListTokens.clear();
4920 BusinessNoteListPref.clear();
4922 /* Items on the Categories tab */
4924 CategoriesList.clear();
4925 CategoriesListAltID.clear();
4926 CategoriesListPID.clear();
4927 CategoriesListType.clear();
4928 CategoriesListTokens.clear();
4929 CategoriesListLanguage.clear();
4930 CategoriesListPref.clear();
4932 /* Items on the Groups tab */
4935 GroupsListAltID.clear();
4936 GroupsListPID.clear();
4937 GroupsListType.clear();
4938 GroupsListMediaType.clear();
4939 GroupsListTokens.clear();
4940 GroupsListPref.clear();
4942 /* Items on the Pictures tab */
4944 PicturesList.clear();
4945 PicturesListAltID.clear();
4946 PicturesListPID.clear();
4947 PicturesListType.clear();
4948 PicturesListPicEncType.clear();
4949 PicturesListPictureType.clear();
4950 PicturesListTokens.clear();
4951 PicturesListMediatype.clear();
4952 PicturesListPref.clear();
4954 /* Items on the Logos tab */
4957 LogosListAltID.clear();
4958 LogosListPID.clear();
4959 LogosListType.clear();
4960 LogosListPicEncType.clear();
4961 LogosListPictureType.clear();
4962 LogosListTokens.clear();
4963 LogosListMediatype.clear();
4964 LogosListPref.clear();
4966 /* Items on the Sounds tab */
4969 SoundsListAltID.clear();
4970 SoundsListPID.clear();
4971 SoundsListType.clear();
4972 SoundsListAudioEncType.clear();
4973 SoundsListAudioType.clear();
4974 SoundsListTokens.clear();
4975 SoundsListMediatype.clear();
4976 SoundsListPref.clear();
4978 /* Items on the Calendaring tab */
4980 CalendarList.clear();
4981 CalendarListAltID.clear();
4982 CalendarListPID.clear();
4983 CalendarListType.clear();
4984 CalendarListTokens.clear();
4985 CalendarListMediatype.clear();
4986 CalendarListPref.clear();
4988 CalendarRequestList.clear();
4989 CalendarRequestListAltID.clear();
4990 CalendarRequestListPID.clear();
4991 CalendarRequestListType.clear();
4992 CalendarRequestListTokens.clear();
4993 CalendarRequestListMediatype.clear();
4994 CalendarRequestListPref.clear();
4996 FreeBusyList.clear();
4997 FreeBusyListAltID.clear();
4998 FreeBusyListPID.clear();
4999 FreeBusyListType.clear();
5000 FreeBusyListTokens.clear();
5001 FreeBusyListMediatype.clear();
5002 FreeBusyListPref.clear();
5004 /* Items on the Security tab */
5007 KeyListAltID.clear();
5009 KeyListKeyType.clear();
5010 KeyListDataType.clear();
5011 KeyListDataEncType.clear();
5012 KeyListType.clear();
5013 KeyListTokens.clear();
5014 KeyListPref.clear();
5016 /* Items on the Other tab */
5019 VendorListPEN.clear();
5020 VendorListElement.clear();
5023 XTokenListTokens.clear();
5027 void ProcessNameValue(wxString *PropertyData,
5028 wxString *PropertyName,
5029 wxString *PropertyValue){
5031 wxStringTokenizer PropertyElement (*PropertyData, wxT("="));
5032 *PropertyName = PropertyElement.GetNextToken();
5033 *PropertyValue = PropertyElement.GetNextToken();
5037 void ProcessTokens(wxString *PropertyName,
5038 wxString *PropertyValue,
5039 wxString *PropertyTokens,
5042 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5044 if (*FirstToken == TRUE){
5046 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5047 *FirstToken = FALSE;
5051 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5059 void ProcessStringValue(wxString *PropertyName,
5060 wxString PropertyNameMatch,
5061 std::map<int,wxString> *MapPtr,
5062 wxString *PropertyValue,
5064 bool *PropertyMatched){
5066 if (*PropertyName == PropertyNameMatch){
5067 MapPtr->erase(*ItemCount);
5068 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5069 *PropertyMatched = TRUE;
5074 void ProcessIntegerValue(wxString *PropertyName,
5075 wxString PropertyNameMatch,
5076 std::map<int,int> *PrefPtr,
5077 wxString *PropertyValue,
5079 bool *PropertyMatched){
5081 if (*PropertyName == PropertyNameMatch){
5082 *PropertyMatched = TRUE;
5087 int PriorityNumber = 0;
5088 bool ValidNumber = TRUE;
5091 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5094 catch(std::invalid_argument &e){
5095 ValidNumber = FALSE;
5098 if (ValidNumber == TRUE){
5100 PrefPtr->erase(*ItemCount);
5101 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5107 void SplitValues(wxString *PropertyLine,
5108 std::map<int,int> *SplitPoints,
5109 std::map<int,int> *SplitLength,
5112 size_t intPropertyLen = PropertyLine->Len();
5113 int intSplitsFound = 0;
5114 int intSplitSize = 0;
5115 int intSplitSeek = 0;
5117 for (int i = intSize; i <= intPropertyLen; i++){
5121 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5122 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5124 if (intSplitsFound == 0){
5126 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5130 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5134 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5144 if (intSplitsFound == 0){
5146 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5147 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5151 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5152 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5158 void CheckType(wxString *PropertySeg1,
5159 std::map<int,int> *SplitPoints,
5160 std::map<int,int> *SplitLength,
5162 PropertyType *PropType){
5164 wxString PropertyData;
5165 wxString PropertyName;
5166 wxString PropertyValue;
5167 std::map<int,int>::iterator SLiter;
5169 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5170 intiter != SplitPoints->end(); ++intiter){
5172 SLiter = SplitLength->find(intiter->first);
5173 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5174 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
5175 *intPrevValue = intiter->second;
5177 if (PropertyName == wxT("TYPE")){
5179 if (PropertyValue == wxT("work")){
5181 *PropType = PROPERTY_WORK;
5183 } else if (PropertyValue == wxT("home")){
5185 *PropType = PROPERTY_HOME;
5189 *PropType = PROPERTY_NONE;