1 // ContactDataObject.cpp - Client Data Object.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "ContactDataObject.h"
21 ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
23 if (!wxFileExists(Filename)){
25 return CONTACTLOAD_FILEMISSING;
31 if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){
33 return CONTACTLOAD_FILEERROR;
37 // Check that the vCard is a valid vCard 4.0 file.
39 vCard vCard4FormatCheck;
41 vCard4FormatCheck.LoadFile(Filename);
43 if (vCard4FormatCheck.Get("VERSION") != wxT("4.0")){
45 return CONTACTLOAD_FILEINVALIDFORMAT;
49 // Check that the vCard meets the base specification.
51 if (!vCard4FormatCheck.MeetBaseSpecification()){
53 return CONTACTLOAD_FILEBASESPECFAIL;
57 wxStringTokenizer wSTContactFileLines(vCard4FormatCheck.WriteString(), wxT("\r\n"));
59 std::map<int, wxString> ContactFileLines;
61 int ContactLineSeek = 0;
63 while (wSTContactFileLines.HasMoreTokens() == TRUE){
65 wxString ContactLine = wSTContactFileLines.GetNextToken();
66 ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
71 wxString wxSPropertyNextLine;
73 bool ExtraLineSeek = TRUE;
74 bool QuoteMode = FALSE;
75 bool PropertyFind = TRUE;
76 bool KindProcessed = FALSE;
77 bool NameProcessed = FALSE;
78 bool GenderProcessed = FALSE;
79 bool BirthdayProcessed = FALSE;
80 bool AnniversaryProcessed = FALSE;
81 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("LOGO")) {
380 // See frmContactEditor-LoadPhoto.cpp
382 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
385 } else if (Property == wxT("SOUND")) {
387 // See frmContactEditor-LoadSound.cpp
389 ProcessSound(PropertySeg1, PropertySeg2, &SoundCount);
392 } else if (Property == wxT("CALURI")){
394 // See frmContactEditor-LoadCalendar.cpp
396 ProcessCalendarURI(PropertySeg1, PropertySeg2, &CalendarCount);
399 } else if (Property == wxT("CALADRURI")){
401 ProcessCalendarAddressURI(PropertySeg1, PropertySeg2, &CalendarAddressCount);
402 CalendarAddressCount++;
404 } else if (Property == wxT("FBURL")){
406 // See frmContactEditor-LoadCalendar.cpp
408 ProcessCalendarFreeBusy(PropertySeg1, PropertySeg2, &FreeBusyAddressCount);
409 FreeBusyAddressCount++;
411 } else if (Property == wxT("KEY")){
413 // See frmContactEditor-LoadKey.cpp
415 ProcessKey(PropertySeg1, PropertySeg2, &KeyCount);
418 } else if (Property.Mid(0, 3) == wxT("VND")){
420 ProcessVendor(PropertySeg1, PropertySeg2, &VendorCount);
423 } else if (Property.Mid(0, 2) == wxT("X-")){
425 XTokenList.insert(std::make_pair(XTokenCount, PropertySeg2));
426 XTokenListTokens.insert(std::make_pair(XTokenCount, PropertySeg1.Mid(2)));
433 return CONTACTLOAD_OK;
437 void ContactDataObject::ProcessKind(wxString KindType){
439 if (KindType == wxT("individual")){
441 ContactKind = CONTACTKIND_INDIVIDUAL;
443 } else if (KindType == wxT("group")){
445 ContactKind = CONTACTKIND_GROUP;
447 } else if (KindType == wxT("org")){
449 ContactKind = CONTACTKIND_ORGANISATION;
451 } else if (KindType == wxT("location")){
453 ContactKind = CONTACTKIND_LOCATION;
457 ContactKind = CONTACTKIND_NONE;
462 void ContactDataObject::ProcessRevision(wxString PropertySeg1, wxString PropertySeg2){
464 size_t intPropertyLen = PropertySeg1.Len();
465 std::map<int, int> SplitPoints;
466 std::map<int, int> SplitLength;
467 std::map<int, int>::iterator SLiter;
468 wxString PropertyData;
469 wxString PropertyName;
470 wxString PropertyValue;
471 wxString PropertyTokens;
472 bool FirstToken = TRUE;
473 int intSplitsFound = 0;
474 int intSplitSize = 0;
475 int intPrevValue = 5;
479 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
483 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
484 intiter != SplitPoints.end(); ++intiter){
486 SLiter = SplitLength.find(intiter->first);
488 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
490 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
491 PropertyName = PropertyElement.GetNextToken();
492 PropertyValue = PropertyElement.GetNextToken();
494 intPrevValue = intiter->second;
496 // Process properties.
498 size_t intPropertyValueLen = PropertyValue.Len();
500 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
502 PropertyValue.Trim();
503 PropertyValue.RemoveLast();
507 if (PropertyValue.Mid(0, 1) == wxT("\"")){
509 PropertyValue.Remove(0, 1);
513 CaptureString(&PropertyValue, FALSE);
515 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
519 CaptureString(&PropertySeg2, FALSE);
521 Revision = PropertySeg2;
523 if (!PropertyTokens.IsEmpty()){
525 RevisionTokens = PropertyTokens;
532 void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySeg2, int *SourceCount){
534 size_t intPropertyLen = PropertySeg1.Len();
535 std::map<int, int> SplitPoints;
536 std::map<int, int> SplitLength;
537 std::map<int, int>::iterator SLiter;
538 wxString PropertyData;
539 wxString PropertyName;
540 wxString PropertyValue;
541 wxString PropertyTokens;
542 bool FirstToken = TRUE;
543 bool PropertyMatched = FALSE;
544 int intSplitsFound = 0;
545 int intSplitSize = 0;
546 int intPrevValue = 8;
550 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
554 PropertyType PropType = PROPERTY_NONE;
556 // Look for type before continuing.
558 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
562 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
563 intiter != SplitPoints.end(); ++intiter){
565 SLiter = SplitLength.find(intiter->first);
567 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
569 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
570 PropertyName = PropertyElement.GetNextToken();
571 PropertyValue = PropertyElement.GetNextToken();
573 intPrevValue = intiter->second;
575 // Process properties.
577 size_t intPropertyValueLen = PropertyValue.Len();
579 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
581 PropertyValue.Trim();
582 PropertyValue.RemoveLast();
586 if (PropertyValue.Mid(0, 1) == wxT("\"")){
588 PropertyValue.Remove(0, 1);
592 CaptureString(&PropertyValue, FALSE);
594 ProcessStringValue(&PropertyName, "ALTID", &SourceListAltID, &PropertyValue, SourceCount, &PropertyMatched);
595 ProcessStringValue(&PropertyName, "PID", &SourceListPID, &PropertyValue, SourceCount, &PropertyMatched);
596 ProcessStringValue(&PropertyName, "MEDIATYPE", &SourceListMediatype, &PropertyValue, SourceCount, &PropertyMatched);
597 ProcessIntegerValue(&PropertyName, "PREF", &SourceListPref, &PropertyValue, SourceCount, &PropertyMatched);
599 if (PropertyMatched == TRUE){
601 PropertyMatched = FALSE;
606 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
610 intPropertyLen = PropertySeg2.Len();
617 CaptureString(&PropertySeg2, FALSE);
619 // Add the data to the General/Home/Work address variables.
625 SourceListType.insert(std::make_pair(*SourceCount, "home"));
628 SourceListType.insert(std::make_pair(*SourceCount, "work"));
632 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
634 if (!PropertyTokens.IsEmpty()){
636 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
642 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
644 std::map<int, int> SplitPoints;
645 std::map<int, int> SplitLength;
647 int intPrevValue = 5;
651 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
655 wxString PropertyName;
656 wxString PropertyValue;
657 wxString PropertyData;
658 wxString PropertyTokens;
659 std::map<int,int>::iterator SLiter;
660 bool FirstToken = TRUE;
661 bool PropertyMatched = FALSE;
663 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
664 intiter != SplitPoints.end(); ++intiter){
666 SLiter = SplitLength.find(intiter->first);
668 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
670 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
671 PropertyName = PropertyElement.GetNextToken();
672 PropertyValue = PropertyElement.GetNextToken();
674 intPrevValue = intiter->second;
676 CaptureString(&PropertyValue, FALSE);
678 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
680 if (PropertyMatched == TRUE){
682 PropertyMatched = FALSE;
689 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
693 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
695 std::map<int, int> SplitPoints;
696 std::map<int, int> SplitLength;
698 int intPrevValue = 8;
702 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
706 wxString PropertyName;
707 wxString PropertyValue;
708 wxString PropertyData;
709 wxString PropertyTokens;
710 std::map<int,int>::iterator SLiter;
711 bool FirstToken = TRUE;
712 bool PropertyMatched = FALSE;
714 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
715 intiter != SplitPoints.end(); ++intiter){
717 SLiter = SplitLength.find(intiter->first);
719 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
721 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
722 PropertyName = PropertyElement.GetNextToken();
723 PropertyValue = PropertyElement.GetNextToken();
725 intPrevValue = intiter->second;
727 CaptureString(&PropertyValue, FALSE);
729 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
730 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
731 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
732 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
734 if (PropertyMatched == TRUE){
736 PropertyMatched = FALSE;
741 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
745 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
747 if (!PropertyTokens.IsEmpty()){
749 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
756 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
758 std::map<int, int> SplitPoints;
759 std::map<int, int> SplitLength;
761 int intPrevValue = 4;
765 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
769 wxString PropertyName;
770 wxString PropertyValue;
771 wxString PropertyData;
772 wxString PropertyTokens;
773 std::map<int,int>::iterator SLiter;
774 bool FirstToken = TRUE;
775 bool PropertyMatched = FALSE;
777 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
778 intiter != SplitPoints.end(); ++intiter){
780 SLiter = SplitLength.find(intiter->first);
782 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
784 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
785 PropertyName = PropertyElement.GetNextToken();
786 PropertyValue = PropertyElement.GetNextToken();
788 intPrevValue = intiter->second;
790 CaptureString(&PropertyValue, FALSE);
792 if (PropertyName == wxT("TYPE")){
794 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
795 PropertyValue == wxT("work") ){
797 FullNamesListType.erase(*FNCount);
798 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
802 PropertyMatched = TRUE;
806 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
807 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
808 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
809 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
811 if (PropertyMatched == TRUE){
813 PropertyMatched = FALSE;
818 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
822 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
824 if (!PropertyTokens.IsEmpty()){
826 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
832 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
834 std::map<int, int> SplitPoints;
835 std::map<int, int> SplitLength;
837 int intPrevValue = 3;
841 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
845 wxString PropertyName;
846 wxString PropertyValue;
847 wxString PropertyData;
848 wxString PropertyTokens;
849 std::map<int,int>::iterator SLiter;
850 bool FirstToken = TRUE;
852 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
853 intiter != SplitPoints.end(); ++intiter){
855 SLiter = SplitLength.find(intiter->first);
857 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
859 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
860 PropertyName = PropertyElement.GetNextToken();
861 PropertyValue = PropertyElement.GetNextToken();
863 intPrevValue = intiter->second;
865 CaptureString(&PropertyValue, FALSE);
867 if (PropertyName == wxT("ALTID")){
869 NameAltID = PropertyValue;
871 } else if (PropertyName == wxT("LANGUAGE")){
873 NameLanguage = PropertyValue;
875 } else if (PropertyName == wxT("SORT-AS")){
877 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
878 PropertyValue.Len() >= 3){
879 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
882 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
884 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
890 // Split the name data.
892 int intSplitSeek = 0;
893 int intSplitsFound = 0;
894 int intSplitSize = 0;
895 int intPropertyLen = PropertySeg2.Len();
897 std::map<int,wxString> NameValues;
900 for (int i = 0; i <= intPropertyLen; i++){
902 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
904 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
909 if (intSplitsFound == 4){
911 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
925 // Split the data into several parts.
927 for (std::map<int, wxString>::iterator iter = NameValues.begin();
928 iter != NameValues.end(); ++iter){
930 if (iter->first == 1){
932 // Deal with family name.
934 NameSurname = iter->second;
936 } else if (iter->first == 2){
938 // Deal with given names.
940 NameForename = iter->second;
942 } else if (iter->first == 3){
944 // Deal with additional names.
946 NameOtherNames = iter->second;
948 } else if (iter->first == 4){
950 // Deal with honorifix prefixes and suffixes.
952 NameTitle = iter->second;
956 if (iter == NameValues.end()){
962 NameSuffix = iter->second;
968 // Add the name token data.
970 if (!PropertyTokens.IsEmpty()){
972 NameTokens = PropertyTokens;
978 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
980 size_t intPropertyLen = PropertySeg1.Len();
981 std::map<int, int> SplitPoints;
982 std::map<int, int> SplitLength;
983 std::map<int, int>::iterator SLiter;
984 wxString PropertyData;
985 wxString PropertyName;
986 wxString PropertyValue;
987 wxString PropertyTokens;
988 bool FirstToken = TRUE;
989 int intSplitsFound = 0;
990 int intSplitSize = 0;
991 int intPrevValue = 14;
995 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
999 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1000 intiter != SplitPoints.end(); ++intiter){
1002 SLiter = SplitLength.find(intiter->first);
1004 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1006 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1007 PropertyName = PropertyElement.GetNextToken();
1008 PropertyValue = PropertyElement.GetNextToken();
1010 intPrevValue = intiter->second;
1012 // Process properties.
1014 CaptureString(&PropertyValue, FALSE);
1016 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1020 CaptureString(&PropertySeg2, FALSE);
1022 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
1024 if (!PropertyTokens.IsEmpty()){
1026 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
1032 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
1034 std::map<int, int> SplitPoints;
1035 std::map<int, int> SplitLength;
1037 int intPrevValue = 10;
1040 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1044 PropertyType PropType = PROPERTY_NONE;
1046 // Look for type before continuing.
1048 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1052 std::map<int, wxString> *NicknamesList = NULL;
1053 std::map<int, wxString> *NicknamesListType = NULL;
1054 std::map<int, wxString> *NicknamesListLanguage = NULL;
1055 std::map<int, wxString> *NicknamesListAltID = NULL;
1056 std::map<int, wxString> *NicknamesListPID = NULL;
1057 std::map<int, wxString> *NicknamesListTokens = NULL;
1058 std::map<int, int> *NicknamesListPref = NULL;
1062 NicknamesList = &GeneralNicknamesList;
1063 NicknamesListType = &GeneralNicknamesListType;
1064 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1065 NicknamesListAltID = &GeneralNicknamesListAltID;
1066 NicknamesListPID = &GeneralNicknamesListPID;
1067 NicknamesListTokens = &GeneralNicknamesListTokens;
1068 NicknamesListPref = &GeneralNicknamesListPref;
1071 NicknamesList = &HomeNicknamesList;
1072 NicknamesListType = &HomeNicknamesListType;
1073 NicknamesListLanguage = &HomeNicknamesListLanguage;
1074 NicknamesListAltID = &HomeNicknamesListAltID;
1075 NicknamesListPID = &HomeNicknamesListPID;
1076 NicknamesListTokens = &HomeNicknamesListTokens;
1077 NicknamesListPref = &HomeNicknamesListPref;
1080 NicknamesList = &BusinessNicknamesList;
1081 NicknamesListType = &BusinessNicknamesListType;
1082 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1083 NicknamesListAltID = &BusinessNicknamesListAltID;
1084 NicknamesListPID = &BusinessNicknamesListPID;
1085 NicknamesListTokens = &BusinessNicknamesListTokens;
1086 NicknamesListPref = &BusinessNicknamesListPref;
1090 std::map<int, int>::iterator SLiter;
1091 wxString PropertyData;
1092 wxString PropertyName;
1093 wxString PropertyValue;
1094 wxString PropertyTokens;
1095 bool FirstToken = TRUE;
1096 bool PropertyMatched = FALSE;
1098 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1099 intiter != SplitPoints.end(); ++intiter){
1101 SLiter = SplitLength.find(intiter->first);
1103 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1105 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1106 PropertyName = PropertyElement.GetNextToken();
1107 PropertyValue = PropertyElement.GetNextToken();
1109 intPrevValue = intiter->second;
1111 CaptureString(&PropertyValue, FALSE);
1113 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1114 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1115 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1116 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1118 if (PropertyMatched == TRUE){
1120 PropertyMatched = FALSE;
1125 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1129 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1131 // Add the name token data.
1133 if (!PropertyTokens.IsEmpty()){
1135 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1141 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1143 std::map<int, int> SplitPoints;
1144 std::map<int, int> SplitLength;
1145 std::map<int, int>::iterator SLiter;
1146 wxString PropertyData;
1147 wxString PropertyName;
1148 wxString PropertyValue;
1149 wxString PropertyTokens;
1150 bool FirstToken = TRUE;
1151 int intPrevValue = 8;
1153 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1157 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1158 intiter != SplitPoints.end(); ++intiter){
1160 SLiter = SplitLength.find(intiter->first);
1162 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1164 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1165 PropertyName = PropertyElement.GetNextToken();
1166 PropertyValue = PropertyElement.GetNextToken();
1168 intPrevValue = intiter->second;
1170 // Process properties.
1172 size_t intPropertyValueLen = PropertyValue.Len();
1174 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1176 PropertyValue.Trim();
1177 PropertyValue.RemoveLast();
1181 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1183 PropertyValue.Remove(0, 1);
1187 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1191 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1193 wxString GenderComponent;
1195 if (GenderData.CountTokens() >= 2){
1197 Gender = GenderData.GetNextToken();
1198 GenderDetails = GenderData.GetString();
1200 CaptureString(&GenderDetails, FALSE);
1204 Gender = GenderData.GetNextToken();
1208 if (!PropertyTokens.IsEmpty()){
1210 GenderTokens = PropertyTokens;
1216 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1218 // Process date. Preserve the remainder in the string.
1220 std::map<int, int> SplitPoints;
1221 std::map<int, int> SplitLength;
1222 std::map<int, int>::iterator SLiter;
1223 wxString PropertyData;
1224 wxString PropertyName;
1225 wxString PropertyValue;
1226 wxString PropertyTokens;
1227 bool BirthdayText = FALSE;
1228 int intPrevValue = 6;
1230 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1234 // Look for type before continuing.
1236 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1237 intiter != SplitPoints.end(); ++intiter){
1239 SLiter = SplitLength.find(intiter->first);
1241 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1243 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1244 PropertyName = PropertyElement.GetNextToken();
1245 PropertyValue = PropertyElement.GetNextToken();
1247 intPrevValue = intiter->second;
1249 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1251 CaptureString(&PropertySeg2, FALSE);
1252 Birthday = PropertySeg2;
1253 BirthdayText = TRUE;
1259 // Setup blank lines for later on.
1262 bool FirstToken = TRUE;
1264 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1265 intiter != SplitPoints.end(); ++intiter){
1267 SLiter = SplitLength.find(intiter->first);
1269 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1271 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1272 PropertyName = PropertyElement.GetNextToken();
1273 PropertyValue = PropertyElement.GetNextToken();
1275 intPrevValue = intiter->second;
1277 // Process properties.
1279 CaptureString(&PropertyValue, FALSE);
1281 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1283 PropertyValue.Trim();
1284 PropertyValue.RemoveLast();
1288 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1290 PropertyValue.Remove(0, 1);
1294 if (PropertyName == wxT("ALTID")){
1296 BirthdayAltID = PropertyValue;
1298 } else if (PropertyName == wxT("CALSCALE")){
1300 BirthdayCalScale = PropertyValue;
1302 } else if (PropertyName != wxT("VALUE")) {
1304 // Something else we don't know about so append
1305 // to the tokens variable.
1307 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1313 // Add the data to the variables and form.
1315 if (BirthdayText == FALSE){
1317 Birthday = PropertySeg2;
1321 if (!PropertyTokens.IsEmpty()){
1323 BirthdayTokens = PropertyTokens;
1329 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1331 // Process date. Preserve the remainder in the string.
1333 std::map<int, int> SplitPoints;
1334 std::map<int, int> SplitLength;
1335 std::map<int, int>::iterator SLiter;
1336 wxString PropertyData;
1337 wxString PropertyName;
1338 wxString PropertyValue;
1339 wxString PropertyTokens;
1340 bool AnniversaryText = FALSE;
1341 int intPrevValue = 13;
1343 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1347 // Look for type before continuing.
1349 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1350 intiter != SplitPoints.end(); ++intiter){
1352 SLiter = SplitLength.find(intiter->first);
1354 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1356 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1357 PropertyName = PropertyElement.GetNextToken();
1358 PropertyValue = PropertyElement.GetNextToken();
1360 intPrevValue = intiter->second;
1362 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1364 CaptureString(&PropertySeg2, FALSE);
1365 Anniversary = PropertySeg2;
1366 AnniversaryText = TRUE;
1372 // Setup blank lines for later on.
1375 bool FirstToken = TRUE;
1377 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1378 intiter != SplitPoints.end(); ++intiter){
1380 SLiter = SplitLength.find(intiter->first);
1382 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1384 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1385 PropertyName = PropertyElement.GetNextToken();
1386 PropertyValue = PropertyElement.GetNextToken();
1388 intPrevValue = intiter->second;
1390 // Process properties.
1392 CaptureString(&PropertyValue, FALSE);
1394 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1396 PropertyValue.Trim();
1397 PropertyValue.RemoveLast();
1401 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1403 PropertyValue.Remove(0, 1);
1407 if (PropertyName == wxT("ALTID")){
1409 AnniversaryAltID = PropertyValue;
1411 } else if (PropertyName == wxT("CALSCALE")){
1413 AnniversaryCalScale = PropertyValue;
1415 } else if (PropertyName != wxT("VALUE")) {
1417 // Something else we don't know about so append
1418 // to the tokens variable.
1420 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1426 // Add the data to the variables and form.
1428 if (AnniversaryText == FALSE){
1430 Anniversary = PropertySeg2;
1434 if (!PropertyTokens.IsEmpty()){
1436 AnniversaryTokens = PropertyTokens;
1442 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1444 std::map<int, int> SplitPoints;
1445 std::map<int, int> SplitLength;
1447 int intPrevValue = 4;
1450 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1454 PropertyType PropType = PROPERTY_NONE;
1456 // Look for type before continuing.
1458 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1462 std::map<int, wxString> *TZList = NULL;
1463 std::map<int, wxString> *TZListType = NULL;
1464 std::map<int, wxString> *TZListMediatype = NULL;
1465 std::map<int, wxString> *TZListAltID = NULL;
1466 std::map<int, wxString> *TZListPID = NULL;
1467 std::map<int, wxString> *TZListTokens = NULL;
1468 std::map<int, int> *TZListPref = NULL;
1472 TZList = &GeneralTZList;
1473 TZListType = &GeneralTZListType;
1474 TZListMediatype = &GeneralTZListMediatype;
1475 TZListAltID = &GeneralTZListAltID;
1476 TZListPID = &GeneralTZListPID;
1477 TZListTokens = &GeneralTZListTokens;
1478 TZListPref = &GeneralTZListPref;
1481 TZList = &HomeTZList;
1482 TZListType = &HomeTZListType;
1483 TZListMediatype = &HomeTZListMediatype;
1484 TZListAltID = &HomeTZListAltID;
1485 TZListPID = &HomeTZListPID;
1486 TZListTokens = &HomeTZListTokens;
1487 TZListPref = &HomeTZListPref;
1490 TZList = &BusinessTZList;
1491 TZListType = &BusinessTZListType;
1492 TZListMediatype = &BusinessTZListMediatype;
1493 TZListAltID = &BusinessTZListAltID;
1494 TZListPID = &BusinessTZListPID;
1495 TZListTokens = &BusinessTZListTokens;
1496 TZListPref = &BusinessTZListPref;
1500 std::map<int, int>::iterator SLiter;
1501 wxString PropertyData;
1502 wxString PropertyName;
1503 wxString PropertyValue;
1504 wxString PropertyTokens;
1505 bool FirstToken = TRUE;
1506 bool PropertyMatched = FALSE;
1508 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1509 intiter != SplitPoints.end(); ++intiter){
1511 SLiter = SplitLength.find(intiter->first);
1513 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1515 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1516 PropertyName = PropertyElement.GetNextToken();
1517 PropertyValue = PropertyElement.GetNextToken();
1519 intPrevValue = intiter->second;
1521 CaptureString(&PropertyValue, FALSE);
1523 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1524 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1525 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1526 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1528 if (PropertyMatched == TRUE){
1530 PropertyMatched = FALSE;
1535 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1537 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1543 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1545 // Add the name token data.
1547 if (!PropertyTokens.IsEmpty()){
1549 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1556 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1558 size_t intPropertyLen = PropertySeg1.Len();
1559 std::map<int, int> SplitPoints;
1560 std::map<int, int> SplitLength;
1561 std::map<int, int>::iterator SLiter;
1562 wxString PropertyData;
1563 wxString PropertyName;
1564 wxString PropertyValue;
1565 wxString PropertyTokens;
1566 wxString AddressLabel;
1567 wxString AddressLang;
1568 wxString AddressAltID;
1569 wxString AddressPID;
1570 wxString AddressTokens;
1571 wxString AddressGeo;
1572 wxString AddressTimezone;
1573 wxString AddressType;
1574 wxString AddressMediatype;
1575 wxString AddressPOBox;
1576 wxString AddressExtended;
1577 wxString AddressStreet;
1578 wxString AddressLocality;
1579 wxString AddressCity;
1580 wxString AddressRegion;
1581 wxString AddressPostalCode;
1582 wxString AddressCountry;
1583 bool FirstToken = TRUE;
1584 int intSplitsFound = 0;
1585 int intSplitSize = 0;
1586 int intPrevValue = 5;
1590 bool PropertyMatched = FALSE;
1592 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1596 PropertyType PropType = PROPERTY_NONE;
1598 // Look for type before continuing.
1600 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1604 std::map<int, wxString> *AddressList = NULL;
1605 std::map<int, wxString> *AddressListTown = NULL;
1606 std::map<int, wxString> *AddressListCounty = NULL;
1607 std::map<int, wxString> *AddressListPostCode = NULL;
1608 std::map<int, wxString> *AddressListCountry = NULL;
1609 std::map<int, wxString> *AddressListLabel = NULL;
1610 std::map<int, wxString> *AddressListLang = NULL;
1611 std::map<int, wxString> *AddressListAltID = NULL;
1612 std::map<int, wxString> *AddressListPID = NULL;
1613 std::map<int, wxString> *AddressListTokens = NULL;
1614 std::map<int, wxString> *AddressListGeo = NULL;
1615 std::map<int, wxString> *AddressListTimezone = NULL;
1616 std::map<int, wxString> *AddressListType = NULL;
1617 std::map<int, wxString> *AddressListMediatype = NULL;
1618 std::map<int, int> *AddressListPref = NULL;
1622 AddressList = &GeneralAddressList;
1623 AddressListTown = &GeneralAddressListTown;
1624 AddressListCounty = &GeneralAddressListCounty;
1625 AddressListPostCode = &GeneralAddressListPostCode;
1626 AddressListCountry = &GeneralAddressListCountry;
1627 AddressListLabel = &GeneralAddressListLabel;
1628 AddressListLang = &GeneralAddressListLang;
1629 AddressListAltID = &GeneralAddressListAltID;
1630 AddressListPID = &GeneralAddressListPID;
1631 AddressListTokens = &GeneralAddressListTokens;
1632 AddressListGeo = &GeneralAddressListGeo;
1633 AddressListTimezone = &GeneralAddressListTimezone;
1634 AddressListType = &GeneralAddressListType;
1635 AddressListMediatype = &GeneralAddressListMediatype;
1636 AddressListPref = &GeneralAddressListPref;
1639 AddressList = &HomeAddressList;
1640 AddressListTown = &HomeAddressListTown;
1641 AddressListCounty = &HomeAddressListCounty;
1642 AddressListPostCode = &HomeAddressListPostCode;
1643 AddressListCountry = &HomeAddressListCountry;
1644 AddressListLabel = &HomeAddressListLabel;
1645 AddressListLang = &HomeAddressListLang;
1646 AddressListAltID = &HomeAddressListAltID;
1647 AddressListPID = &HomeAddressListPID;
1648 AddressListTokens = &HomeAddressListTokens;
1649 AddressListGeo = &HomeAddressListGeo;
1650 AddressListTimezone = &HomeAddressListTimezone;
1651 AddressListType = &HomeAddressListType;
1652 AddressListMediatype = &HomeAddressListMediatype;
1653 AddressListPref = &HomeAddressListPref;
1656 AddressList = &BusinessAddressList;
1657 AddressListTown = &BusinessAddressListTown;
1658 AddressListCounty = &BusinessAddressListCounty;
1659 AddressListPostCode = &BusinessAddressListPostCode;
1660 AddressListCountry = &BusinessAddressListCountry;
1661 AddressListLabel = &BusinessAddressListLabel;
1662 AddressListLang = &BusinessAddressListLang;
1663 AddressListAltID = &BusinessAddressListAltID;
1664 AddressListPID = &BusinessAddressListPID;
1665 AddressListTokens = &BusinessAddressListTokens;
1666 AddressListGeo = &BusinessAddressListGeo;
1667 AddressListTimezone = &BusinessAddressListTimezone;
1668 AddressListType = &BusinessAddressListType;
1669 AddressListMediatype = &BusinessAddressListMediatype;
1670 AddressListPref = &BusinessAddressListPref;
1676 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1677 intiter != SplitPoints.end(); ++intiter){
1679 SLiter = SplitLength.find(intiter->first);
1681 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1683 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1684 PropertyName = PropertyElement.GetNextToken();
1685 PropertyValue = PropertyElement.GetNextToken();
1687 intPrevValue = intiter->second;
1689 CaptureString(&PropertyValue, FALSE);
1691 // Process properties.
1693 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1694 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1695 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1696 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1697 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1698 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1699 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1700 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1702 if (PropertyMatched == TRUE){
1704 PropertyMatched = FALSE;
1709 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1713 // Split the address.
1715 //std::map<int, int>::iterator SLiter;
1716 intPropertyLen = PropertySeg2.Len();
1717 SplitPoints.clear();
1718 SplitLength.clear();
1723 for (int i = 0; i <= intPropertyLen; i++){
1727 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1730 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1732 if (intSplitsFound == 6){
1734 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1739 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1749 // Split the data into several parts.
1751 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1752 intiter != SplitPoints.end(); ++intiter){
1754 if (intiter->first == 1){
1756 // Deal with PO Box.
1758 SLiter = SplitLength.find(1);
1760 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1761 intPrevValue = intiter->second;
1763 } else if (intiter->first == 2){
1765 // Deal with extended address.
1767 SLiter = SplitLength.find(2);
1769 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1770 intPrevValue = intiter->second;
1772 } else if (intiter->first == 3){
1774 // Deal with street address.
1776 SLiter = SplitLength.find(3);
1778 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1779 intPrevValue = intiter->second;
1781 } else if (intiter->first == 4){
1783 // Deal with locality
1785 SLiter = SplitLength.find(4);
1787 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1788 intPrevValue = intiter->second;
1790 } else if (intiter->first == 5){
1792 // Deal with region.
1794 SLiter = SplitLength.find(5);
1796 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1797 intPrevValue = intiter->second;
1800 } else if (intiter->first == 6){
1802 // Deal with post code.
1804 SLiter = SplitLength.find(6);
1806 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1807 intPrevValue = intiter->second;
1809 // Deal with country.
1811 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1819 // Add the data to the General/Home/Work address variables.
1821 CaptureString(&AddressStreet, FALSE);
1822 CaptureString(&AddressLocality, FALSE);
1823 CaptureString(&AddressRegion, FALSE);
1824 CaptureString(&AddressPostalCode, FALSE);
1825 CaptureString(&AddressCountry, FALSE);
1827 if (!PropertyTokens.IsEmpty()){
1829 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1833 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1834 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1835 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1836 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1837 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1841 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1844 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1847 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1851 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1855 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1857 std::map<int, int> SplitPoints;
1858 std::map<int, int> SplitLength;
1860 int intPrevValue = 7;
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> *EmailList = NULL;
1874 std::map<int, wxString> *EmailListType = NULL;
1875 std::map<int, wxString> *EmailListAltID = NULL;
1876 std::map<int, wxString> *EmailListPID = NULL;
1877 std::map<int, wxString> *EmailListTokens = NULL;
1878 std::map<int, int> *EmailListPref = NULL;
1882 EmailList = &GeneralEmailList;
1883 EmailListType = &GeneralEmailListType;
1884 EmailListAltID = &GeneralEmailListAltID;
1885 EmailListPID = &GeneralEmailListPID;
1886 EmailListTokens = &GeneralEmailListTokens;
1887 EmailListPref = &GeneralEmailListPref;
1890 EmailList = &HomeEmailList;
1891 EmailListType = &HomeEmailListType;
1892 EmailListAltID = &HomeEmailListAltID;
1893 EmailListPID = &HomeEmailListPID;
1894 EmailListTokens = &HomeEmailListTokens;
1895 EmailListPref = &HomeEmailListPref;
1898 EmailList = &BusinessEmailList;
1899 EmailListType = &BusinessEmailListType;
1900 EmailListAltID = &BusinessEmailListAltID;
1901 EmailListPID = &BusinessEmailListPID;
1902 EmailListTokens = &BusinessEmailListTokens;
1903 EmailListPref = &BusinessEmailListPref;
1909 std::map<int,int>::iterator SLiter;
1910 wxString PropertyData;
1911 wxString PropertyName;
1912 wxString PropertyValue;
1913 wxString PropertyTokens;
1914 bool FirstToken = TRUE;
1915 bool PropertyMatched = FALSE;
1917 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1918 intiter != SplitPoints.end(); ++intiter){
1920 SLiter = SplitLength.find(intiter->first);
1922 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1924 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1925 PropertyName = PropertyElement.GetNextToken();
1926 PropertyValue = PropertyElement.GetNextToken();
1928 intPrevValue = intiter->second;
1930 CaptureString(&PropertyValue, FALSE);
1932 // Process properties.
1934 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
1935 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
1936 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
1938 if (PropertyMatched == TRUE){
1940 PropertyMatched = FALSE;
1945 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1949 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1951 // Add the name token data.
1953 if (!PropertyTokens.IsEmpty()){
1955 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1962 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1964 std::map<int, int> SplitPoints;
1965 std::map<int, int> SplitLength;
1967 int intPrevValue = 6;
1970 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1974 PropertyType PropType = PROPERTY_NONE;
1976 // Look for type before continuing.
1978 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1980 std::map<int, wxString> *IMList = NULL;
1981 std::map<int, wxString> *IMListType = NULL;
1982 std::map<int, wxString> *IMListAltID = NULL;
1983 std::map<int, wxString> *IMListPID = NULL;
1984 std::map<int, wxString> *IMListTokens = NULL;
1985 std::map<int, wxString> *IMListMediatype = NULL;
1986 std::map<int, int> *IMListPref = NULL;
1990 IMList = &GeneralIMList;
1991 IMListType = &GeneralIMListType;
1992 IMListAltID = &GeneralIMListAltID;
1993 IMListPID = &GeneralIMListPID;
1994 IMListTokens = &GeneralIMListTokens;
1995 IMListMediatype = &GeneralIMListMediatype;
1996 IMListPref = &GeneralIMListPref;
1999 IMList = &HomeIMList;
2000 IMListType = &HomeIMListType;
2001 IMListAltID = &HomeIMListAltID;
2002 IMListPID = &HomeIMListPID;
2003 IMListTokens = &HomeIMListTokens;
2004 IMListMediatype = &HomeIMListMediatype;
2005 IMListPref = &HomeIMListPref;
2008 IMList = &BusinessIMList;
2009 IMListType = &BusinessIMListType;
2010 IMListAltID = &BusinessIMListAltID;
2011 IMListPID = &BusinessIMListPID;
2012 IMListTokens = &BusinessIMListTokens;
2013 IMListMediatype = &BusinessIMListMediatype;
2014 IMListPref = &BusinessIMListPref;
2020 std::map<int,int>::iterator SLiter;
2021 wxString PropertyData;
2022 wxString PropertyName;
2023 wxString PropertyValue;
2024 wxString PropertyTokens;
2025 bool FirstToken = TRUE;
2026 bool PropertyMatched = FALSE;
2028 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2029 intiter != SplitPoints.end(); ++intiter){
2031 SLiter = SplitLength.find(intiter->first);
2033 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2035 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2036 PropertyName = PropertyElement.GetNextToken();
2037 PropertyValue = PropertyElement.GetNextToken();
2039 intPrevValue = intiter->second;
2041 CaptureString(&PropertyValue, FALSE);
2043 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
2044 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
2045 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
2046 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
2048 // Process properties.
2050 if (PropertyMatched == TRUE){
2052 PropertyMatched = FALSE;
2057 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2061 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2063 // Add the name token data.
2065 if (!PropertyTokens.IsEmpty()){
2067 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2073 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2075 std::map<int, int> SplitPoints;
2076 std::map<int, int> SplitLength;
2077 std::map<int, int>::iterator SLiter;
2081 PropertyType PropType = PROPERTY_NONE;
2083 // Look for type before continuing.
2086 wxString TelTypeDetail;
2087 wxString PropertyData;
2088 wxString PropertyName;
2089 wxString PropertyValue;
2090 wxString PropertyTokens;
2092 std::map<int,int> TypeSplitPoints;
2093 std::map<int,int> TypeSplitLength;
2094 std::map<int,int>::iterator TSLiter;
2096 int intSplitSize = 0;
2097 int intSplitsFound = 0;
2098 int intSplitPoint = 0;
2100 int intPrevValue = 5;
2102 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2106 // Look for type before continuing.
2108 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2109 intiter != SplitPoints.end(); ++intiter){
2111 SLiter = SplitLength.find(intiter->first);
2113 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2115 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2116 PropertyName = PropertyElement.GetNextToken();
2117 PropertyValue = PropertyElement.GetNextToken();
2119 intPrevValue = intiter->second;
2121 if (PropertyName == wxT("TYPE")){
2123 // Process each value in type and translate each
2126 // Strip out the quotes if they are there.
2128 size_t intPropertyValueLen = PropertyValue.Len();
2130 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2132 PropertyValue.Trim();
2133 PropertyValue.RemoveLast();
2137 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2139 PropertyValue.Remove(0, 1);
2143 TelTypeDetail = PropertyValue;
2149 for (int i = 0; i <= intPropertyValueLen; i++){
2153 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2155 if (intSplitsFound == 0){
2157 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2158 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2162 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2163 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2176 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2177 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2179 int intTypeSeek = 0;
2181 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2182 typeiter != TypeSplitPoints.end(); ++typeiter){
2184 wxString TypePropertyName;
2186 TSLiter = TypeSplitLength.find(typeiter->first);
2188 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2190 if (intTypeSeek == 0){
2195 TelTypeUI.Append(wxT(","));
2199 if (TypePropertyName == wxT("home")){
2201 PropType = PROPERTY_HOME;
2203 } else if (TypePropertyName == wxT("work")){
2205 PropType = PROPERTY_WORK;
2210 if (TypePropertyName == wxT("text")){
2212 TelTypeUI.Append(_("text"));
2215 } else if (TypePropertyName == wxT("voice")){
2217 TelTypeUI.Append(_("voice"));
2220 } else if (TypePropertyName == wxT("fax")){
2222 TelTypeUI.Append(_("fax"));
2225 } else if (TypePropertyName == wxT("cell")){
2227 TelTypeUI.Append(_("mobile"));
2230 } else if (TypePropertyName == wxT("video")){
2232 TelTypeUI.Append(_("video"));
2235 } else if (TypePropertyName == wxT("pager")){
2237 TelTypeUI.Append(_("pager"));
2240 } else if (TypePropertyName == wxT("textphone")){
2242 TelTypeUI.Append(_("textphone"));
2253 std::map<int, wxString> *TelephoneList = NULL;
2254 std::map<int, wxString> *TelephoneListType = NULL;
2255 std::map<int, wxString> *TelephoneListAltID = NULL;
2256 std::map<int, wxString> *TelephoneListPID = NULL;
2257 std::map<int, wxString> *TelephoneListTokens = NULL;
2258 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2259 std::map<int, int> *TelephoneListPref = NULL;
2263 TelephoneList = &GeneralTelephoneList;
2264 TelephoneListType = &GeneralTelephoneListType;
2265 TelephoneListAltID = &GeneralTelephoneListAltID;
2266 TelephoneListPID = &GeneralTelephoneListPID;
2267 TelephoneListTokens = &GeneralTelephoneListTokens;
2268 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2269 TelephoneListPref = &GeneralTelephoneListPref;
2272 TelephoneList = &HomeTelephoneList;
2273 TelephoneListType = &HomeTelephoneListType;
2274 TelephoneListAltID = &HomeTelephoneListAltID;
2275 TelephoneListPID = &HomeTelephoneListPID;
2276 TelephoneListTokens = &HomeTelephoneListTokens;
2277 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2278 TelephoneListPref = &HomeTelephoneListPref;
2281 TelephoneList = &BusinessTelephoneList;
2282 TelephoneListType = &BusinessTelephoneListType;
2283 TelephoneListAltID = &BusinessTelephoneListAltID;
2284 TelephoneListPID = &BusinessTelephoneListPID;
2285 TelephoneListTokens = &BusinessTelephoneListTokens;
2286 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2287 TelephoneListPref = &BusinessTelephoneListPref;
2291 // Process the properties.
2293 bool FirstToken = TRUE;
2296 SplitPoints.clear();
2297 SplitLength.clear();
2299 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2303 bool PropertyMatched = FALSE;
2305 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2306 intiter != SplitPoints.end(); ++intiter){
2308 SLiter = SplitLength.find(intiter->first);
2310 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2312 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2313 PropertyName = PropertyElement.GetNextToken();
2314 PropertyValue = PropertyElement.GetNextToken();
2316 intPrevValue = intiter->second;
2318 CaptureString(&PropertyValue, FALSE);
2320 // Process properties.
2322 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2323 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2324 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2326 if (PropertyMatched == TRUE){
2328 PropertyMatched = FALSE;
2333 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2337 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2338 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2340 // Add the name token data.
2342 if (!PropertyTokens.IsEmpty()){
2344 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2350 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2352 std::map<int, int> SplitPoints;
2353 std::map<int, int> SplitLength;
2355 int intPrevValue = 6;
2358 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2362 PropertyType PropType = PROPERTY_NONE;
2364 // Look for type before continuing.
2366 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2368 std::map<int, wxString> *LanguageList = NULL;
2369 std::map<int, wxString> *LanguageListType = NULL;
2370 std::map<int, wxString> *LanguageListAltID = NULL;
2371 std::map<int, wxString> *LanguageListPID = NULL;
2372 std::map<int, wxString> *LanguageListTokens = NULL;
2373 std::map<int, int> *LanguageListPref = NULL;
2377 LanguageList = &GeneralLanguageList;
2378 LanguageListType = &GeneralLanguageListType;
2379 LanguageListAltID = &GeneralLanguageListAltID;
2380 LanguageListPID = &GeneralLanguageListPID;
2381 LanguageListTokens = &GeneralLanguageListTokens;
2382 LanguageListPref = &GeneralLanguageListPref;
2385 LanguageList = &HomeLanguageList;
2386 LanguageListType = &HomeLanguageListType;
2387 LanguageListAltID = &HomeLanguageListAltID;
2388 LanguageListPID = &HomeLanguageListPID;
2389 LanguageListTokens = &HomeLanguageListTokens;
2390 LanguageListPref = &HomeLanguageListPref;
2393 LanguageList = &BusinessLanguageList;
2394 LanguageListType = &BusinessLanguageListType;
2395 LanguageListAltID = &BusinessLanguageListAltID;
2396 LanguageListPID = &BusinessLanguageListPID;
2397 LanguageListTokens = &BusinessLanguageListTokens;
2398 LanguageListPref = &BusinessLanguageListPref;
2404 std::map<int,int>::iterator SLiter;
2405 wxString PropertyData;
2406 wxString PropertyName;
2407 wxString PropertyValue;
2408 wxString PropertyTokens;
2409 bool FirstToken = TRUE;
2410 bool PropertyMatched = FALSE;
2412 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2413 intiter != SplitPoints.end(); ++intiter){
2415 SLiter = SplitLength.find(intiter->first);
2417 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2419 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2420 PropertyName = PropertyElement.GetNextToken();
2421 PropertyValue = PropertyElement.GetNextToken();
2423 intPrevValue = intiter->second;
2425 CaptureString(&PropertyValue, FALSE);
2427 // Process properties.
2429 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2430 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2431 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2433 if (PropertyMatched == TRUE){
2435 PropertyMatched = FALSE;
2440 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2444 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2446 // Add the name token data.
2448 if (!PropertyTokens.IsEmpty()){
2450 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2456 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2458 std::map<int, int> SplitPoints;
2459 std::map<int, int> SplitLength;
2461 int intPrevValue = 5;
2464 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2468 PropertyType PropType = PROPERTY_NONE;
2470 // Look for type before continuing.
2472 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2474 std::map<int, wxString> *GeopositionList = NULL;
2475 std::map<int, wxString> *GeopositionListType = NULL;
2476 std::map<int, wxString> *GeopositionListAltID = NULL;
2477 std::map<int, wxString> *GeopositionListPID = NULL;
2478 std::map<int, wxString> *GeopositionListTokens = NULL;
2479 std::map<int, wxString> *GeopositionListMediatype = NULL;
2480 std::map<int, int> *GeopositionListPref = NULL;
2484 GeopositionList = &GeneralGeographyList;
2485 GeopositionListType = &GeneralGeographyListType;
2486 GeopositionListAltID = &GeneralGeographyListAltID;
2487 GeopositionListPID = &GeneralGeographyListPID;
2488 GeopositionListTokens = &GeneralGeographyListTokens;
2489 GeopositionListMediatype = &GeneralGeographyListMediatype;
2490 GeopositionListPref = &GeneralGeographyListPref;
2493 GeopositionList = &HomeGeographyList;
2494 GeopositionListType = &HomeGeographyListType;
2495 GeopositionListAltID = &HomeGeographyListAltID;
2496 GeopositionListPID = &HomeGeographyListPID;
2497 GeopositionListTokens = &HomeGeographyListTokens;
2498 GeopositionListMediatype = &HomeGeographyListMediatype;
2499 GeopositionListPref = &HomeGeographyListPref;
2502 GeopositionList = &BusinessGeographyList;
2503 GeopositionListType = &BusinessGeographyListType;
2504 GeopositionListAltID = &BusinessGeographyListAltID;
2505 GeopositionListPID = &BusinessGeographyListPID;
2506 GeopositionListTokens = &BusinessGeographyListTokens;
2507 GeopositionListMediatype = &BusinessGeographyListMediatype;
2508 GeopositionListPref = &BusinessGeographyListPref;
2514 std::map<int,int>::iterator SLiter;
2515 wxString PropertyData;
2516 wxString PropertyName;
2517 wxString PropertyValue;
2518 wxString PropertyTokens;
2519 bool FirstToken = TRUE;
2520 bool PropertyMatched = FALSE;
2522 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2523 intiter != SplitPoints.end(); ++intiter){
2525 SLiter = SplitLength.find(intiter->first);
2527 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2529 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2530 PropertyName = PropertyElement.GetNextToken();
2531 PropertyValue = PropertyElement.GetNextToken();
2533 intPrevValue = intiter->second;
2535 CaptureString(&PropertyValue, FALSE);
2537 // Process properties.
2539 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2540 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2541 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2542 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2544 if (PropertyMatched == TRUE){
2546 PropertyMatched = FALSE;
2551 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2555 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2557 // Add the name token data.
2559 if (!PropertyTokens.IsEmpty()){
2561 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2567 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2569 size_t intPropertyLen = PropertySeg1.Len();
2570 std::map<int, int> SplitPoints;
2571 std::map<int, int> SplitLength;
2572 std::map<int, int>::iterator SLiter;
2573 wxString PropertyData;
2574 wxString PropertyName;
2575 wxString PropertyValue;
2576 wxString PropertyTokens;
2577 wxString RelatedType;
2578 wxString RelatedTypeOriginal;
2579 wxString RelatedName;
2580 bool FirstToken = TRUE;
2581 int intSplitsFound = 0;
2582 int intSplitSize = 0;
2583 int intPrevValue = 9;
2587 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2591 // Look for type before continuing.
2593 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2594 intiter != SplitPoints.end(); ++intiter){
2596 SLiter = SplitLength.find(intiter->first);
2598 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2600 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2601 PropertyName = PropertyElement.GetNextToken();
2602 PropertyValue = PropertyElement.GetNextToken();
2604 intPrevValue = intiter->second;
2608 RelatedTypeOriginal = PropertyValue;
2610 if (PropertyName == wxT("TYPE")){
2612 if (PropertyValue == wxT("contact")){
2614 RelatedType = _("Contact");
2616 } else if (PropertyValue == wxT("acquaintance")){
2618 RelatedType = _("Acquaintance");
2620 } else if (PropertyValue == wxT("friend")){
2622 RelatedType = _("Friend");
2624 } else if (PropertyValue == wxT("met")){
2626 RelatedType = _("Met");
2628 } else if (PropertyValue == wxT("co-worker")){
2630 RelatedType = _("Co-worker");
2632 } else if (PropertyValue == wxT("colleague")){
2634 RelatedType = _("Colleague");
2636 } else if (PropertyValue == wxT("co-resident")){
2638 RelatedType = _("Co-resident");
2640 } else if (PropertyValue == wxT("neighbor")){
2642 RelatedType = _("Neighbour");
2644 } else if (PropertyValue == wxT("child")){
2646 RelatedType = _("Child");
2648 } else if (PropertyValue == wxT("parent")){
2650 RelatedType = _("Parent");
2652 } else if (PropertyValue == wxT("sibling")){
2654 RelatedType = _("Sibling");
2656 } else if (PropertyValue == wxT("spouse")){
2658 RelatedType = _("Spouse");
2660 } else if (PropertyValue == wxT("kin")){
2662 RelatedType = _("Kin");
2664 } else if (PropertyValue == wxT("muse")){
2666 RelatedType = _("Muse");
2668 } else if (PropertyValue == wxT("crush")){
2670 RelatedType = _("Crush");
2672 } else if (PropertyValue == wxT("date")){
2674 RelatedType = _("Date");
2676 } else if (PropertyValue == wxT("sweetheart")){
2678 RelatedType = _("Sweetheart");
2680 } else if (PropertyValue == wxT("me")){
2682 RelatedType = _("Me");
2684 } else if (PropertyValue == wxT("agent")){
2686 RelatedType = _("Agent");
2688 } else if (PropertyValue == wxT("emergency")){
2690 RelatedType = _("Emergency");
2694 RelatedType = PropertyValue;
2704 bool PropertyMatched = FALSE;
2706 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2707 intiter != SplitPoints.end(); ++intiter){
2709 SLiter = SplitLength.find(intiter->first);
2711 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2713 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2714 PropertyName = PropertyElement.GetNextToken();
2715 PropertyValue = PropertyElement.GetNextToken();
2717 intPrevValue = intiter->second;
2719 // Process properties.
2721 size_t intPropertyValueLen = PropertyValue.Len();
2723 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2725 PropertyValue.Trim();
2726 PropertyValue.RemoveLast();
2730 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2732 PropertyValue.Remove(0, 1);
2736 CaptureString(&PropertyValue, FALSE);
2738 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2739 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2740 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2741 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2743 if (PropertyMatched == TRUE){
2745 PropertyMatched = FALSE;
2750 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2754 // Add the data to the General/Home/Work address variables.
2756 GeneralRelatedList.erase(*RelatedCount);
2757 GeneralRelatedListRelType.erase(*RelatedCount);
2758 GeneralRelatedListType.erase(*RelatedCount);
2759 GeneralRelatedListTokens.erase(*RelatedCount);
2760 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2761 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2762 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2763 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2767 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2769 std::map<int, int> SplitPoints;
2770 std::map<int, int> SplitLength;
2771 std::map<int, int>::iterator SLiter;
2772 wxString PropertyData;
2773 wxString PropertyName;
2774 wxString PropertyValue;
2775 wxString PropertyTokens;
2776 bool FirstToken = TRUE;
2777 int intPrevValue = 5;
2782 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2786 PropertyType PropType = PROPERTY_NONE;
2788 // Look for type before continuing.
2790 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2792 // Setup the pointers.
2794 std::map<int, wxString> *WebsiteList = NULL;
2795 std::map<int, wxString> *WebsiteListAltID = NULL;
2796 std::map<int, wxString> *WebsiteListPID = NULL;
2797 std::map<int, wxString> *WebsiteListType = NULL;
2798 std::map<int, wxString> *WebsiteListTokens = NULL;
2799 std::map<int, wxString> *WebsiteListMediatype = NULL;
2800 std::map<int, int> *WebsiteListPref = NULL;
2802 // Setup blank lines for later on.
2806 WebsiteList = &GeneralWebsiteList;
2807 WebsiteListType = &GeneralWebsiteListType;
2808 WebsiteListAltID = &GeneralWebsiteListAltID;
2809 WebsiteListPID = &GeneralWebsiteListPID;
2810 WebsiteListTokens = &GeneralWebsiteListTokens;
2811 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2812 WebsiteListPref = &GeneralWebsiteListPref;
2815 WebsiteList = &HomeWebsiteList;
2816 WebsiteListType = &HomeWebsiteListType;
2817 WebsiteListAltID = &HomeWebsiteListAltID;
2818 WebsiteListPID = &HomeWebsiteListPID;
2819 WebsiteListTokens = &HomeWebsiteListTokens;
2820 WebsiteListMediatype = &HomeWebsiteListMediatype;
2821 WebsiteListPref = &HomeWebsiteListPref;
2824 WebsiteList = &BusinessWebsiteList;
2825 WebsiteListType = &BusinessWebsiteListType;
2826 WebsiteListAltID = &BusinessWebsiteListAltID;
2827 WebsiteListPID = &BusinessWebsiteListPID;
2828 WebsiteListTokens = &BusinessWebsiteListTokens;
2829 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2830 WebsiteListPref = &BusinessWebsiteListPref;
2835 bool PropertyMatched = FALSE;
2837 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2838 intiter != SplitPoints.end(); ++intiter){
2840 SLiter = SplitLength.find(intiter->first);
2842 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2844 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2845 PropertyName = PropertyElement.GetNextToken();
2846 PropertyValue = PropertyElement.GetNextToken();
2848 intPrevValue = intiter->second;
2850 // Process properties.
2852 size_t intPropertyValueLen = PropertyValue.Len();
2854 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2856 PropertyValue.Trim();
2857 PropertyValue.RemoveLast();
2861 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2863 PropertyValue.Remove(0, 1);
2867 CaptureString(&PropertyValue, FALSE);
2869 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
2870 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
2871 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
2872 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
2874 if (PropertyMatched == TRUE){
2876 PropertyMatched = FALSE;
2881 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2885 // Add the data to the General/Home/Work address variables.
2887 CaptureString(&PropertySeg2, FALSE);
2889 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
2891 if (!PropertyTokens.IsEmpty()){
2893 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
2899 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
2901 std::map<int, int> SplitPoints;
2902 std::map<int, int> SplitLength;
2903 std::map<int, int>::iterator SLiter;
2904 wxString PropertyData;
2905 wxString PropertyName;
2906 wxString PropertyValue;
2907 wxString PropertyTokens;
2908 bool FirstToken = TRUE;
2909 int intPrevValue = 7;
2914 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2918 PropertyType PropType = PROPERTY_NONE;
2920 // Look for type before continuing.
2922 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2924 // Setup the pointers.
2926 std::map<int, wxString> *TitleList = NULL;
2927 std::map<int, wxString> *TitleListAltID = NULL;
2928 std::map<int, wxString> *TitleListPID = NULL;
2929 std::map<int, wxString> *TitleListType = NULL;
2930 std::map<int, wxString> *TitleListTokens = NULL;
2931 std::map<int, wxString> *TitleListLanguage = NULL;
2932 std::map<int, int> *TitleListPref = NULL;
2934 // Setup blank lines for later on.
2938 TitleList = &GeneralTitleList;
2939 TitleListType = &GeneralTitleListType;
2940 TitleListAltID = &GeneralTitleListAltID;
2941 TitleListPID = &GeneralTitleListPID;
2942 TitleListTokens = &GeneralTitleListTokens;
2943 TitleListLanguage = &GeneralTitleListLanguage;
2944 TitleListPref = &GeneralTitleListPref;
2947 TitleList = &HomeTitleList;
2948 TitleListType = &HomeTitleListType;
2949 TitleListAltID = &HomeTitleListAltID;
2950 TitleListPID = &HomeTitleListPID;
2951 TitleListTokens = &HomeTitleListTokens;
2952 TitleListLanguage = &HomeTitleListLanguage;
2953 TitleListPref = &HomeTitleListPref;
2956 TitleList = &BusinessTitleList;
2957 TitleListType = &BusinessTitleListType;
2958 TitleListAltID = &BusinessTitleListAltID;
2959 TitleListPID = &BusinessTitleListPID;
2960 TitleListTokens = &BusinessTitleListTokens;
2961 TitleListLanguage = &BusinessTitleListLanguage;
2962 TitleListPref = &BusinessTitleListPref;
2967 bool PropertyMatched = FALSE;
2969 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2970 intiter != SplitPoints.end(); ++intiter){
2972 SLiter = SplitLength.find(intiter->first);
2974 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2976 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2977 PropertyName = PropertyElement.GetNextToken();
2978 PropertyValue = PropertyElement.GetNextToken();
2980 intPrevValue = intiter->second;
2982 // Process properties.
2984 size_t intPropertyValueLen = PropertyValue.Len();
2986 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2988 PropertyValue.Trim();
2989 PropertyValue.RemoveLast();
2993 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2995 PropertyValue.Remove(0, 1);
2999 CaptureString(&PropertyValue, FALSE);
3001 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
3002 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
3003 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
3004 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
3006 if (PropertyMatched == TRUE){
3008 PropertyMatched = FALSE;
3013 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3017 // Add the data to the General/Home/Work address variables.
3019 CaptureString(&PropertySeg2, FALSE);
3021 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3023 if (!PropertyTokens.IsEmpty()){
3025 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3031 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3033 std::map<int, int> SplitPoints;
3034 std::map<int, int> SplitLength;
3035 std::map<int, int>::iterator SLiter;
3036 wxString PropertyData;
3037 wxString PropertyName;
3038 wxString PropertyValue;
3039 wxString PropertyTokens;
3040 bool FirstToken = TRUE;
3041 int intPrevValue = 6;
3046 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3050 PropertyType PropType = PROPERTY_NONE;
3052 // Look for type before continuing.
3054 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3056 // Setup the pointers.
3058 std::map<int, wxString> *RoleList = NULL;
3059 std::map<int, wxString> *RoleListAltID = NULL;
3060 std::map<int, wxString> *RoleListPID = NULL;
3061 std::map<int, wxString> *RoleListType = NULL;
3062 std::map<int, wxString> *RoleListTokens = NULL;
3063 std::map<int, wxString> *RoleListLanguage = NULL;
3064 std::map<int, int> *RoleListPref = NULL;
3066 // Setup blank lines for later on.
3070 RoleList = &GeneralRoleList;
3071 RoleListType = &GeneralRoleListType;
3072 RoleListAltID = &GeneralRoleListAltID;
3073 RoleListPID = &GeneralRoleListPID;
3074 RoleListTokens = &GeneralRoleListTokens;
3075 RoleListLanguage = &GeneralRoleListLanguage;
3076 RoleListPref = &GeneralRoleListPref;
3079 RoleList = &HomeRoleList;
3080 RoleListType = &HomeRoleListType;
3081 RoleListAltID = &HomeRoleListAltID;
3082 RoleListPID = &HomeRoleListPID;
3083 RoleListTokens = &HomeRoleListTokens;
3084 RoleListLanguage = &HomeRoleListLanguage;
3085 RoleListPref = &HomeRoleListPref;
3088 RoleList = &BusinessRoleList;
3089 RoleListType = &BusinessRoleListType;
3090 RoleListAltID = &BusinessRoleListAltID;
3091 RoleListPID = &BusinessRoleListPID;
3092 RoleListTokens = &BusinessRoleListTokens;
3093 RoleListLanguage = &BusinessRoleListLanguage;
3094 RoleListPref = &BusinessRoleListPref;
3099 bool PropertyMatched = FALSE;
3101 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3102 intiter != SplitPoints.end(); ++intiter){
3104 SLiter = SplitLength.find(intiter->first);
3106 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3108 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3109 PropertyName = PropertyElement.GetNextToken();
3110 PropertyValue = PropertyElement.GetNextToken();
3112 intPrevValue = intiter->second;
3114 // Process properties.
3116 size_t intPropertyValueLen = PropertyValue.Len();
3118 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3120 PropertyValue.Trim();
3121 PropertyValue.RemoveLast();
3125 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3127 PropertyValue.Remove(0, 1);
3131 CaptureString(&PropertyValue, FALSE);
3133 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3134 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3135 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3136 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3138 if (PropertyMatched == TRUE){
3140 PropertyMatched = FALSE;
3145 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3149 // Add the data to the General/Home/Work address variables.
3151 CaptureString(&PropertySeg2, FALSE);
3153 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3155 if (!PropertyTokens.IsEmpty()){
3157 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3163 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3165 std::map<int, int> SplitPoints;
3166 std::map<int, int> SplitLength;
3167 std::map<int, int>::iterator SLiter;
3168 wxString PropertyData;
3169 wxString PropertyName;
3170 wxString PropertyValue;
3171 wxString PropertyTokens;
3172 bool FirstToken = TRUE;
3173 int intPrevValue = 5;
3178 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3182 PropertyType PropType = PROPERTY_NONE;
3184 // Look for type before continuing.
3186 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3188 // Setup the pointers.
3190 std::map<int, wxString> *OrganisationsList = NULL;
3191 std::map<int, wxString> *OrganisationsListAltID = NULL;
3192 std::map<int, wxString> *OrganisationsListPID = NULL;
3193 std::map<int, wxString> *OrganisationsListType = NULL;
3194 std::map<int, wxString> *OrganisationsListTokens = NULL;
3195 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3196 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3197 std::map<int, int> *OrganisationsListPref = NULL;
3199 // Setup blank lines for later on.
3203 OrganisationsList = &GeneralOrganisationsList;
3204 OrganisationsListType = &GeneralOrganisationsListType;
3205 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3206 OrganisationsListPID = &GeneralOrganisationsListPID;
3207 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3208 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3209 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3210 OrganisationsListPref = &GeneralOrganisationsListPref;
3213 OrganisationsList = &HomeOrganisationsList;
3214 OrganisationsListType = &HomeOrganisationsListType;
3215 OrganisationsListAltID = &HomeOrganisationsListAltID;
3216 OrganisationsListPID = &HomeOrganisationsListPID;
3217 OrganisationsListTokens = &HomeOrganisationsListTokens;
3218 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3219 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3220 OrganisationsListPref = &HomeOrganisationsListPref;
3223 OrganisationsList = &BusinessOrganisationsList;
3224 OrganisationsListType = &BusinessOrganisationsListType;
3225 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3226 OrganisationsListPID = &BusinessOrganisationsListPID;
3227 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3228 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3229 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3230 OrganisationsListPref = &BusinessOrganisationsListPref;
3235 bool PropertyMatched = FALSE;
3237 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3238 intiter != SplitPoints.end(); ++intiter){
3240 SLiter = SplitLength.find(intiter->first);
3242 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3244 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3245 PropertyName = PropertyElement.GetNextToken();
3246 PropertyValue = PropertyElement.GetNextToken();
3248 intPrevValue = intiter->second;
3250 // Process properties.
3252 size_t intPropertyValueLen = PropertyValue.Len();
3254 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3256 PropertyValue.Trim();
3257 PropertyValue.RemoveLast();
3261 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3263 PropertyValue.Remove(0, 1);
3267 CaptureString(&PropertyValue, FALSE);
3269 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3270 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3271 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3272 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3273 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3275 if (PropertyMatched == TRUE){
3277 PropertyMatched = FALSE;
3282 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3286 // Add the data to the General/Home/Work address variables.
3288 CaptureString(&PropertySeg2, FALSE);
3290 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3292 if (!PropertyTokens.IsEmpty()){
3294 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3300 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3302 std::map<int, int> SplitPoints;
3303 std::map<int, int> SplitLength;
3304 std::map<int, int>::iterator SLiter;
3305 wxString PropertyData;
3306 wxString PropertyName;
3307 wxString PropertyValue;
3308 wxString PropertyTokens;
3309 bool FirstToken = TRUE;
3310 int intPrevValue = 6;
3315 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3319 PropertyType PropType = PROPERTY_NONE;
3321 // Look for type before continuing.
3323 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3325 // Setup the pointers.
3327 std::map<int, wxString> *NoteList = NULL;
3328 std::map<int, wxString> *NoteListAltID = NULL;
3329 std::map<int, wxString> *NoteListPID = NULL;
3330 std::map<int, wxString> *NoteListType = NULL;
3331 std::map<int, wxString> *NoteListTokens = NULL;
3332 std::map<int, wxString> *NoteListLanguage = NULL;
3333 std::map<int, int> *NoteListPref = NULL;
3335 // Setup blank lines for later on.
3339 NoteList = &GeneralNoteList;
3340 NoteListType = &GeneralNoteListType;
3341 NoteListAltID = &GeneralNoteListAltID;
3342 NoteListPID = &GeneralNoteListPID;
3343 NoteListTokens = &GeneralNoteListTokens;
3344 NoteListLanguage = &GeneralNoteListLanguage;
3345 NoteListPref = &GeneralNoteListPref;
3348 NoteList = &HomeNoteList;
3349 NoteListType = &HomeNoteListType;
3350 NoteListAltID = &HomeNoteListAltID;
3351 NoteListPID = &HomeNoteListPID;
3352 NoteListTokens = &HomeNoteListTokens;
3353 NoteListLanguage = &HomeNoteListLanguage;
3354 NoteListPref = &HomeNoteListPref;
3357 NoteList = &BusinessNoteList;
3358 NoteListType = &BusinessNoteListType;
3359 NoteListAltID = &BusinessNoteListAltID;
3360 NoteListPID = &BusinessNoteListPID;
3361 NoteListTokens = &BusinessNoteListTokens;
3362 NoteListLanguage = &BusinessNoteListLanguage;
3363 NoteListPref = &BusinessNoteListPref;
3368 bool PropertyMatched = FALSE;
3370 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3371 intiter != SplitPoints.end(); ++intiter){
3373 SLiter = SplitLength.find(intiter->first);
3375 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3377 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3378 PropertyName = PropertyElement.GetNextToken();
3379 PropertyValue = PropertyElement.GetNextToken();
3381 intPrevValue = intiter->second;
3383 // Process properties.
3385 size_t intPropertyValueLen = PropertyValue.Len();
3387 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3389 PropertyValue.Trim();
3390 PropertyValue.RemoveLast();
3394 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3396 PropertyValue.Remove(0, 1);
3400 CaptureString(&PropertyValue, FALSE);
3402 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3403 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3404 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3405 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3407 if (PropertyMatched == TRUE){
3409 PropertyMatched = FALSE;
3414 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3418 // Add the data to the General/Home/Work address variables.
3420 CaptureString(&PropertySeg2, FALSE);
3422 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3424 if (!PropertyTokens.IsEmpty()){
3426 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3432 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3434 std::map<int, int> SplitPoints;
3435 std::map<int, int> SplitLength;
3436 std::map<int, int>::iterator SLiter;
3437 wxString PropertyData;
3438 wxString PropertyName;
3439 wxString PropertyValue;
3440 wxString PropertyTokens;
3441 bool FirstToken = TRUE;
3442 int intPrevValue = 12;
3447 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3451 PropertyType PropType = PROPERTY_NONE;
3453 // Look for type before continuing.
3455 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3457 // Setup blank lines for later on.
3463 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3466 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3471 bool PropertyMatched = FALSE;
3473 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3474 intiter != SplitPoints.end(); ++intiter){
3476 SLiter = SplitLength.find(intiter->first);
3478 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3480 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3481 PropertyName = PropertyElement.GetNextToken();
3482 PropertyValue = PropertyElement.GetNextToken();
3484 intPrevValue = intiter->second;
3486 // Process properties.
3488 size_t intPropertyValueLen = PropertyValue.Len();
3490 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3492 PropertyValue.Trim();
3493 PropertyValue.RemoveLast();
3497 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3499 PropertyValue.Remove(0, 1);
3503 CaptureString(&PropertyValue, FALSE);
3505 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3506 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3507 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3508 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3510 if (PropertyMatched == TRUE){
3512 PropertyMatched = FALSE;
3517 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3521 // Deal with multiple categories.
3523 int intOrigCatCount = *CategoryCount;
3524 bool FirstCategoryProcessed = TRUE;
3525 bool AfterFirstToken = FALSE;
3526 int intSplitSize = 0;
3527 int intSplitsFound = 0;
3528 int intSplitSeek = 0;
3529 int intPropertyLen = PropertySeg2.Len();
3531 SplitPoints.clear();
3532 SplitLength.clear();
3535 for (int i = 0; i <= intPropertyLen; i++){
3537 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3545 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3547 if (AfterFirstToken == TRUE){
3549 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3550 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3554 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3555 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3556 AfterFirstToken = TRUE;
3568 if (SplitPoints.size() > 0){
3570 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3571 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3575 if (SplitPoints.size() == 0){
3577 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3579 if (!PropertyTokens.IsEmpty()){
3581 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3587 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3588 intiter != SplitPoints.end(); ++intiter){
3590 SLiter = SplitLength.find(intiter->first);
3592 intPrevValue = intiter->second;
3594 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3596 // Add the data to the General/Home/Work address variables.
3598 // Trim any whitespace from the start and end.
3600 PropertyData = PropertyData.Trim(FALSE);
3601 PropertyData = PropertyData.Trim(TRUE);
3603 CaptureString(&PropertyData, FALSE);
3605 if (FirstCategoryProcessed == TRUE){
3607 FirstCategoryProcessed = FALSE;
3609 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3611 if (!PropertyTokens.IsEmpty()){
3613 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3623 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3625 if (!PropertyTokens.IsEmpty()){
3627 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3633 // Copy the properties to each of the categories (if it exists).
3635 if (!PropertyTokens.IsEmpty()){
3637 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3641 // Check if ALTID was used.
3643 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3645 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3649 // Check if PID was used.
3651 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3653 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3657 // Check if PREF was used.
3659 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3661 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3665 // Check if LANGUAGE was used.
3667 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3669 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3673 // Check if TYPE was used.
3679 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3682 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3690 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3692 size_t intPropertyLen = PropertySeg1.Len();
3693 std::map<int, int> SplitPoints;
3694 std::map<int, int> SplitLength;
3695 std::map<int, int>::iterator SLiter;
3696 wxString PropertyData;
3697 wxString PropertyName;
3698 wxString PropertyValue;
3699 wxString PropertyTokens;
3700 bool FirstToken = TRUE;
3701 int intSplitsFound = 0;
3702 int intSplitSize = 0;
3703 int intPrevValue = 7;
3707 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3711 PropertyType PropType = PROPERTY_NONE;
3713 // Look for type before continuing.
3715 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3718 bool PropertyMatched = FALSE;
3720 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3721 intiter != SplitPoints.end(); ++intiter){
3723 SLiter = SplitLength.find(intiter->first);
3725 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3727 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3728 PropertyName = PropertyElement.GetNextToken();
3729 PropertyValue = PropertyElement.GetNextToken();
3731 intPrevValue = intiter->second;
3733 // Process properties.
3735 size_t intPropertyValueLen = PropertyValue.Len();
3737 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3739 PropertyValue.Trim();
3740 PropertyValue.RemoveLast();
3744 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3746 PropertyValue.Remove(0, 1);
3750 CaptureString(&PropertyValue, FALSE);
3752 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3753 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3754 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3755 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
3757 if (PropertyMatched == TRUE){
3759 PropertyMatched = FALSE;
3764 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3768 intPropertyLen = PropertySeg2.Len();
3769 SplitPoints.clear();
3770 SplitLength.clear();
3775 CaptureString(&PropertySeg2, FALSE);
3777 for (int i = 0; i <= intPropertyLen; i++){
3781 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3784 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3786 if (intSplitsFound == 6){
3788 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3793 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3803 wxString wxSPhotoURI;
3804 wxString wxSPhotoMIME;
3805 wxString wxSPhotoEncoding;
3806 wxString wxSPhotoData;
3807 std::string base64enc;
3809 if (intSplitsFound == 0){
3813 std::map<int, int>::iterator striter;
3815 striter = SplitLength.find(1);
3817 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3819 while (wSTDataType.HasMoreTokens() == TRUE){
3821 wxSPhotoURI = wSTDataType.GetNextToken();
3822 wxSPhotoMIME = wSTDataType.GetNextToken();
3827 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3829 while (wSTDataInfo.HasMoreTokens() == TRUE){
3831 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3832 wxSPhotoData = wSTDataInfo.GetNextToken();
3833 base64enc = wxSPhotoData.mb_str();
3840 // Add the data to the General/Home/Work address variables.
3842 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
3843 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
3844 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
3850 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
3853 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
3857 if (!PropertyTokens.IsEmpty()){
3859 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
3865 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
3867 size_t intPropertyLen = PropertySeg1.Len();
3868 std::map<int, int> SplitPoints;
3869 std::map<int, int> SplitLength;
3870 std::map<int, int>::iterator SLiter;
3871 wxString PropertyData;
3872 wxString PropertyName;
3873 wxString PropertyValue;
3874 wxString PropertyTokens;
3875 bool FirstToken = TRUE;
3876 int intSplitsFound = 0;
3877 int intSplitSize = 0;
3878 int intPrevValue = 6;
3882 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3886 PropertyType PropType = PROPERTY_NONE;
3888 // Look for type before continuing.
3890 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3893 bool PropertyMatched = FALSE;
3895 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3896 intiter != SplitPoints.end(); ++intiter){
3898 SLiter = SplitLength.find(intiter->first);
3900 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3902 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3903 PropertyName = PropertyElement.GetNextToken();
3904 PropertyValue = PropertyElement.GetNextToken();
3906 intPrevValue = intiter->second;
3908 // Process properties.
3910 size_t intPropertyValueLen = PropertyValue.Len();
3912 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3914 PropertyValue.Trim();
3915 PropertyValue.RemoveLast();
3919 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3921 PropertyValue.Remove(0, 1);
3925 CaptureString(&PropertyValue, FALSE);
3927 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
3928 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
3929 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
3930 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
3932 if (PropertyMatched == TRUE){
3934 PropertyMatched = FALSE;
3939 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3943 intPropertyLen = PropertySeg2.Len();
3944 SplitPoints.clear();
3945 SplitLength.clear();
3950 CaptureString(&PropertySeg2, FALSE);
3952 for (int i = 0; i <= intPropertyLen; i++){
3956 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3959 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3961 if (intSplitsFound == 6){
3963 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3968 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3978 wxString wxSPhotoURI;
3979 wxString wxSPhotoMIME;
3980 wxString wxSPhotoEncoding;
3981 wxString wxSPhotoData;
3982 std::string base64enc;
3984 if (intSplitsFound == 0){
3988 std::map<int, int>::iterator striter;
3990 striter = SplitLength.find(1);
3992 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3994 while (wSTDataType.HasMoreTokens() == TRUE){
3996 wxSPhotoURI = wSTDataType.GetNextToken();
3997 wxSPhotoMIME = wSTDataType.GetNextToken();
4002 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4004 while (wSTDataInfo.HasMoreTokens() == TRUE){
4006 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4007 wxSPhotoData = wSTDataInfo.GetNextToken();
4008 base64enc = wxSPhotoData.mb_str();
4015 // Add the data to the General/Home/Work address variables.
4017 LogosList.insert(std::make_pair(*LogoCount, base64enc));
4018 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
4019 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
4025 LogosListType.insert(std::make_pair(*LogoCount, "home"));
4028 LogosListType.insert(std::make_pair(*LogoCount, "work"));
4032 if (!PropertyTokens.IsEmpty()){
4034 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
4040 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
4042 size_t intPropertyLen = PropertySeg1.Len();
4043 std::map<int, int> SplitPoints;
4044 std::map<int, int> SplitLength;
4045 std::map<int, int>::iterator SLiter;
4046 wxString PropertyData;
4047 wxString PropertyName;
4048 wxString PropertyValue;
4049 wxString PropertyTokens;
4050 bool FirstToken = TRUE;
4051 int intSplitsFound = 0;
4052 int intSplitSize = 0;
4053 int intPrevValue = 7;
4057 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4061 PropertyType PropType = PROPERTY_NONE;
4063 // Look for type before continuing.
4065 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4068 bool PropertyMatched = FALSE;
4070 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4071 intiter != SplitPoints.end(); ++intiter){
4073 SLiter = SplitLength.find(intiter->first);
4075 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4077 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4078 PropertyName = PropertyElement.GetNextToken();
4079 PropertyValue = PropertyElement.GetNextToken();
4081 intPrevValue = intiter->second;
4083 // Process properties.
4085 size_t intPropertyValueLen = PropertyValue.Len();
4087 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4089 PropertyValue.Trim();
4090 PropertyValue.RemoveLast();
4094 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4096 PropertyValue.Remove(0, 1);
4100 CaptureString(&PropertyValue, FALSE);
4102 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
4103 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
4104 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
4105 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
4106 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
4108 if (PropertyMatched == TRUE){
4110 PropertyMatched = FALSE;
4115 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4119 intPropertyLen = PropertySeg2.Len();
4120 SplitPoints.clear();
4121 SplitLength.clear();
4126 CaptureString(&PropertySeg2, FALSE);
4128 for (int i = 0; i <= intPropertyLen; i++){
4132 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4135 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4137 if (intSplitsFound == 6){
4139 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4144 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4154 wxString wxSSoundURI;
4155 wxString wxSSoundMIME;
4156 wxString wxSSoundEncoding;
4157 wxString wxSSoundData;
4158 std::string base64enc;
4160 if (intSplitsFound == 0){
4164 std::map<int, int>::iterator striter;
4166 striter = SplitLength.find(1);
4168 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4170 while (wSTDataType.HasMoreTokens() == TRUE){
4172 wxSSoundURI = wSTDataType.GetNextToken();
4173 wxSSoundMIME = wSTDataType.GetNextToken();
4178 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4180 while (wSTDataInfo.HasMoreTokens() == TRUE){
4182 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4183 wxSSoundData = wSTDataInfo.GetNextToken();
4184 base64enc = wxSSoundData.mb_str();
4191 // Add the data to the General/Home/Work address variables.
4197 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4200 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4204 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4205 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4206 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4208 if (!PropertyTokens.IsEmpty()){
4210 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4216 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4218 size_t intPropertyLen = PropertySeg1.Len();
4219 std::map<int, int> SplitPoints;
4220 std::map<int, int> SplitLength;
4221 std::map<int, int>::iterator SLiter;
4222 wxString PropertyData;
4223 wxString PropertyName;
4224 wxString PropertyValue;
4225 wxString PropertyTokens;
4226 bool FirstToken = TRUE;
4227 int intSplitsFound = 0;
4228 int intSplitSize = 0;
4229 int intPrevValue = 8;
4233 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4237 PropertyType PropType = PROPERTY_NONE;
4239 // Look for type before continuing.
4241 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4244 bool PropertyMatched = FALSE;
4246 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4247 intiter != SplitPoints.end(); ++intiter){
4249 SLiter = SplitLength.find(intiter->first);
4251 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4253 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4254 PropertyName = PropertyElement.GetNextToken();
4255 PropertyValue = PropertyElement.GetNextToken();
4257 intPrevValue = intiter->second;
4259 // Process properties.
4261 size_t intPropertyValueLen = PropertyValue.Len();
4263 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4265 PropertyValue.Trim();
4266 PropertyValue.RemoveLast();
4270 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4272 PropertyValue.Remove(0, 1);
4276 CaptureString(&PropertyValue, FALSE);
4278 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4279 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4280 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4281 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4283 if (PropertyMatched == TRUE){
4285 PropertyMatched = FALSE;
4290 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4294 intPropertyLen = PropertySeg2.Len();
4295 SplitPoints.clear();
4296 SplitLength.clear();
4301 CaptureString(&PropertySeg2, FALSE);
4303 // Add the data to the General/Home/Work address variables.
4309 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4312 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4316 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4318 if (!PropertyTokens.IsEmpty()){
4320 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4326 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4328 size_t intPropertyLen = PropertySeg1.Len();
4329 std::map<int, int> SplitPoints;
4330 std::map<int, int> SplitLength;
4331 std::map<int, int>::iterator SLiter;
4332 wxString PropertyData;
4333 wxString PropertyName;
4334 wxString PropertyValue;
4335 wxString PropertyTokens;
4336 bool FirstToken = TRUE;
4337 int intSplitsFound = 0;
4338 int intSplitSize = 0;
4339 int intPrevValue = 8;
4343 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4347 PropertyType PropType = PROPERTY_NONE;
4349 // Look for type before continuing.
4351 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4354 bool PropertyMatched = FALSE;
4356 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4357 intiter != SplitPoints.end(); ++intiter){
4359 SLiter = SplitLength.find(intiter->first);
4361 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4363 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4364 PropertyName = PropertyElement.GetNextToken();
4365 PropertyValue = PropertyElement.GetNextToken();
4367 intPrevValue = intiter->second;
4369 // Process properties.
4371 size_t intPropertyValueLen = PropertyValue.Len();
4373 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4375 PropertyValue.Trim();
4376 PropertyValue.RemoveLast();
4380 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4382 PropertyValue.Remove(0, 1);
4386 CaptureString(&PropertyValue, FALSE);
4388 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4389 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4390 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4391 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4393 if (PropertyMatched == TRUE){
4395 PropertyMatched = FALSE;
4400 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4404 intPropertyLen = PropertySeg2.Len();
4405 SplitPoints.clear();
4406 SplitLength.clear();
4411 CaptureString(&PropertySeg2, FALSE);
4413 // Add the data to the General/Home/Work address variables.
4419 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4422 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4426 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4428 if (!PropertyTokens.IsEmpty()){
4430 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4436 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4438 size_t intPropertyLen = PropertySeg1.Len();
4439 std::map<int, int> SplitPoints;
4440 std::map<int, int> SplitLength;
4441 std::map<int, int>::iterator SLiter;
4442 wxString PropertyData;
4443 wxString PropertyName;
4444 wxString PropertyValue;
4445 wxString PropertyTokens;
4446 bool FirstToken = TRUE;
4447 int intSplitsFound = 0;
4448 int intSplitSize = 0;
4449 int intPrevValue = 7;
4453 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4457 PropertyType PropType = PROPERTY_NONE;
4459 // Look for type before continuing.
4461 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4464 bool PropertyMatched = FALSE;
4466 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4467 intiter != SplitPoints.end(); ++intiter){
4469 SLiter = SplitLength.find(intiter->first);
4471 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4473 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4474 PropertyName = PropertyElement.GetNextToken();
4475 PropertyValue = PropertyElement.GetNextToken();
4477 intPrevValue = intiter->second;
4479 // Process properties.
4481 size_t intPropertyValueLen = PropertyValue.Len();
4483 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4485 PropertyValue.Trim();
4486 PropertyValue.RemoveLast();
4490 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4492 PropertyValue.Remove(0, 1);
4496 CaptureString(&PropertyValue, FALSE);
4498 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4499 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4500 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4501 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4503 if (PropertyMatched == TRUE){
4505 PropertyMatched = FALSE;
4510 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4514 intPropertyLen = PropertySeg2.Len();
4515 SplitPoints.clear();
4516 SplitLength.clear();
4521 CaptureString(&PropertySeg2, FALSE);
4523 // Add the data to the General/Home/Work address variables.
4529 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4532 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4536 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4538 if (!PropertyTokens.IsEmpty()){
4540 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4546 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4548 size_t intPropertyLen = PropertySeg1.Len();
4549 std::map<int, int> SplitPoints;
4550 std::map<int, int> SplitLength;
4551 std::map<int, int>::iterator SLiter;
4552 wxString PropertyData;
4553 wxString PropertyName;
4554 wxString PropertyValue;
4555 wxString PropertyTokens;
4556 bool FirstToken = TRUE;
4557 int intSplitsFound = 0;
4558 int intSplitSize = 0;
4559 int intPrevValue = 5;
4564 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4568 PropertyType PropType = PROPERTY_NONE;
4570 // Look for type before continuing.
4572 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4575 bool PropertyMatched = FALSE;
4577 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4578 intiter != SplitPoints.end(); ++intiter){
4580 SLiter = SplitLength.find(intiter->first);
4582 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4584 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4585 PropertyName = PropertyElement.GetNextToken();
4586 PropertyValue = PropertyElement.GetNextToken();
4588 intPrevValue = intiter->second;
4590 // Process properties.
4592 size_t intPropertyValueLen = PropertyValue.Len();
4594 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4596 PropertyValue.Trim();
4597 PropertyValue.RemoveLast();
4601 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4603 PropertyValue.Remove(0, 1);
4607 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4608 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4609 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4611 if (PropertyMatched == TRUE){
4613 PropertyMatched = FALSE;
4618 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4622 intPropertyLen = PropertySeg2.Len();
4623 SplitPoints.clear();
4624 SplitLength.clear();
4629 for (int i = 0; i <= intPropertyLen; i++){
4633 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4636 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4638 if (intSplitsFound == 6){
4640 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4645 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4656 wxString wxSKeyMIME;
4657 wxString wxSKeyEncoding;
4658 wxString wxSKeyData;
4659 std::string base64enc;
4661 if (intSplitsFound == 0){
4665 std::map<int, int>::iterator striter;
4667 striter = SplitLength.find(1);
4669 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4671 while (wSTDataType.HasMoreTokens() == TRUE){
4673 wxSKeyURI = wSTDataType.GetNextToken();
4674 wxSKeyMIME = wSTDataType.GetNextToken();
4679 if (wxSKeyURI == wxT("data")){
4681 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4683 while (wSTDataInfo.HasMoreTokens() == TRUE){
4685 wxSKeyEncoding = wSTDataInfo.GetNextToken();
4686 wxSKeyData = wSTDataInfo.GetNextToken();
4695 // Add the data to the General/Home/Work address variables.
4697 if (wxSKeyURI == wxT("data")){
4699 KeyListDataEncType.erase(*KeyCount);
4700 KeyListKeyType.erase(*KeyCount);
4701 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
4702 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
4704 KeyList.erase(*KeyCount);
4705 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
4709 KeyList.erase(*KeyCount);
4710 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
4714 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
4720 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
4723 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
4727 if (!PropertyTokens.IsEmpty()){
4729 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
4735 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
4737 // Split the Vendor three ways.
4739 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
4742 wxString wxSVNDPropName;
4745 while (wSTVendorDetails.HasMoreTokens() == TRUE){
4747 wSTVendorDetails.GetNextToken();
4748 wxSVNDID = wSTVendorDetails.GetNextToken();
4749 wxSVNDPropName = wSTVendorDetails.GetNextToken();
4754 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
4756 // Add the data to the vendor variables.
4758 VendorList.erase(*VendorCount);
4759 VendorListPEN.erase(*VendorCount);
4760 VendorListElement.erase(*VendorCount);
4762 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
4763 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
4764 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
4770 void ProcessTokens(wxString *PropertyName,
4771 wxString *PropertyValue,
4772 wxString *PropertyTokens,
4775 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
4777 if (*FirstToken == TRUE){
4779 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
4780 *FirstToken = FALSE;
4784 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
4792 void ProcessStringValue(wxString *PropertyName,
4793 wxString PropertyNameMatch,
4794 std::map<int,wxString> *MapPtr,
4795 wxString *PropertyValue,
4797 bool *PropertyMatched){
4799 if (*PropertyName == PropertyNameMatch){
4800 MapPtr->erase(*ItemCount);
4801 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
4802 *PropertyMatched = TRUE;
4807 void ProcessIntegerValue(wxString *PropertyName,
4808 wxString PropertyNameMatch,
4809 std::map<int,int> *PrefPtr,
4810 wxString *PropertyValue,
4812 bool *PropertyMatched){
4814 if (*PropertyName == PropertyNameMatch){
4815 *PropertyMatched = TRUE;
4820 int PriorityNumber = 0;
4821 bool ValidNumber = TRUE;
4824 PriorityNumber = std::stoi(PropertyValue->ToStdString());
4827 catch(std::invalid_argument &e){
4828 ValidNumber = FALSE;
4831 if (ValidNumber == TRUE){
4833 PrefPtr->erase(*ItemCount);
4834 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
4840 void SplitValues(wxString *PropertyLine,
4841 std::map<int,int> *SplitPoints,
4842 std::map<int,int> *SplitLength,
4845 size_t intPropertyLen = PropertyLine->Len();
4846 int intSplitsFound = 0;
4847 int intSplitSize = 0;
4848 int intSplitSeek = 0;
4850 for (int i = intSize; i <= intPropertyLen; i++){
4854 if (PropertyLine->Mid(i, 1) == wxT(";") &&
4855 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
4857 if (intSplitsFound == 0){
4859 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
4863 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4867 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
4877 if (intSplitsFound == 0){
4879 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
4880 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
4884 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
4885 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
4891 void CheckType(wxString *PropertySeg1,
4892 std::map<int,int> *SplitPoints,
4893 std::map<int,int> *SplitLength,
4895 PropertyType *PropType){
4897 wxString PropertyData;
4898 wxString PropertyName;
4899 wxString PropertyValue;
4900 std::map<int,int>::iterator SLiter;
4902 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
4903 intiter != SplitPoints->end(); ++intiter){
4905 SLiter = SplitLength->find(intiter->first);
4907 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
4909 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4910 PropertyName = PropertyElement.GetNextToken();
4911 PropertyValue = PropertyElement.GetNextToken();
4913 *intPrevValue = intiter->second;
4915 if (PropertyName == wxT("TYPE")){
4917 if (PropertyValue == wxT("work")){
4919 *PropType = PROPERTY_WORK;
4921 } else if (PropertyValue == wxT("home")){
4923 *PropType = PROPERTY_HOME;
4927 *PropType = PROPERTY_NONE;