Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added source code, headers and unit testing for the ROLE vCard Property for ContactDa...
[xestiaab/.git] / source / contacteditor / ContactDataObject.cpp
1 // ContactDataObject.cpp - Client Data Object.
2 //
3 // (c) 2012-2015 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
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.
10 //
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.
15 //
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){
22         
23         if (!wxFileExists(Filename)){
24         
25                 return CONTACTLOAD_FILEMISSING;
26         
27         }
28         
29         wxFile ContactFile;
30         
31         if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){
32         
33                 return CONTACTLOAD_FILEERROR;
34         
35         }
36         
37         // Check that the vCard is a valid vCard 4.0 file.
39         vCard vCard4FormatCheck;
40         
41         vCard4FormatCheck.LoadFile(Filename);
42         
43         if (vCard4FormatCheck.Get("VERSION") != wxT("4.0")){
44         
45                 return CONTACTLOAD_FILEINVALIDFORMAT;
46         
47         }
49         // Check that the vCard meets the base specification.
50         
51         if (!vCard4FormatCheck.MeetBaseSpecification()){
52         
53                 return CONTACTLOAD_FILEBASESPECFAIL;
54         
55         }
56         
57         wxStringTokenizer wSTContactFileLines(vCard4FormatCheck.WriteString(), wxT("\r\n"));
58         
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));
67                 ContactLineSeek++;              
68         
69         }
70         
71         wxString wxSPropertyNextLine;
72         
73         bool ExtraLineSeek = TRUE;
74         bool QuoteMode = FALSE;
75         bool PropertyFind = TRUE;
76         bool KindProcessed = FALSE;
77         bool NameProcessed = FALSE;
78         bool GenderProcessed = FALSE;
79         bool BirthdayProcessed = FALSE;
80         bool AnniversaryProcessed = FALSE;
81         int ContactLineLen = 0;
82         int QuoteBreakPoint = 0;
83         int GroupCount = 0;
84         int FNCount = 0;
85         int NicknameCount = 0;
86         int TimeZoneCount = 0;
87         int AddressCount = 0;
88         int EmailCount = 0;
89         int IMCount = 0;
90         int TelephoneCount = 0;
91         int LanguageCount = 0;
92         int GeographicCount = 0;
93         int RelatedCount = 0;
94         int URLCount = 0;
95         int TitleCount = 0;
96         int RoleCount = 0;
97         wxString ContactLine;
98         wxString PropertyLine;
99         wxString PropertySeg1;
100         wxString PropertySeg2;
101         wxString PropertyNextLine;
102         wxString Property;
103         
104         for (std::map<int,wxString>::iterator iter = ContactFileLines.begin(); 
105          iter != ContactFileLines.end(); ++iter){
107                 ExtraLineSeek = TRUE;
108                 QuoteMode = FALSE;
109                 PropertyFind = TRUE;
110                 ContactLineLen = 0;
111                 QuoteBreakPoint = 0;
112                 ContactLine.Clear();
113                 PropertyLine.Clear();
114                 PropertySeg1.Clear();
115                 PropertySeg2.Clear();
116                 Property.Clear();
117          
118                 ContactLine = iter->second;
119                 
120                 while (ExtraLineSeek == TRUE){
121                 
122                         // Check if there is extra data on the next line 
123                         // (indicated by space or tab at the start) and add data.
124                 
125                         iter++;
126                         
127                         if (iter == ContactFileLines.end()){
128                         
129                                 iter--;
130                                 break;
131                         
132                         }                       
133                 
134                         PropertyNextLine = iter->second;
135                 
136                         if (PropertyNextLine.Mid(0, 1) == wxT(" ") || PropertyNextLine.Mid(0, 1) == wxT("\t")){
137                 
138                                 PropertyNextLine.Remove(0, 1);
139                                 ContactLine.Append(PropertyNextLine);
140                 
141                         } else {
142                         
143                                 iter--;
144                                 ExtraLineSeek = FALSE;
145                         
146                         }
147                 
148                 }
150                 ContactLineLen = ContactLine.Len();
151                 
152                 // Make sure we are not in quotation mode.
153                 // Make sure colon does not have \ or \\ before it.
154                 
155                 for (int i = 0; i <= ContactLineLen; i++){
156                 
157                         if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
158                         
159                                 PropertyFind = FALSE;
160                         
161                         } else if (PropertyFind == TRUE){
162                         
163                                 Property.Append(ContactLine.Mid(i, 1));
164                         
165                         }               
166                 
167                         if (ContactLine.Mid(i, 1) == wxT("\"")){
168                         
169                                 if (QuoteMode == TRUE){
170                                 
171                                         QuoteMode = FALSE;
172                                 
173                                 } else {
174                         
175                                         QuoteMode = TRUE;
176                                         
177                                 }
178                         
179                         }
180                         
181                         if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
182                         
183                                 QuoteBreakPoint = i;
184                                 break;
185                         
186                         }
187                 
188                 }
189                 
190                 // Split that line at the point into two variables (ignore the colon).
191                 
192                 PropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
193                 PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
194                 
195                  if (Property == wxT("KIND") && KindProcessed == FALSE){
196                                 
197                         ProcessKind(PropertySeg2);
198                 
199                 } else if (Property == wxT("MEMBER")){
201                         ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
202                         GroupCount++;   
203                 
204                 } else if (Property == wxT("FN")){
205                 
206                         ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
207                         FNCount++;
208                 
209                 } else if (Property == wxT("N") && NameProcessed == FALSE){
210                 
211                         ProcessN(PropertySeg1, PropertySeg2);
212                         NameProcessed = TRUE;
213                 
214                 } else if (Property == wxT("NICKNAME")){
215                                                 
216                         ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
217                         NicknameCount++;
218                         
219                 } else if (Property == wxT("GENDER") && GenderProcessed == FALSE){
220                 
221                         ProcessGender(PropertySeg1, PropertySeg2);
222                         GenderProcessed = TRUE;
223                 
224                 } else if (Property == wxT("BDAY") && BirthdayProcessed == FALSE){
225                 
226                         ProcessBirthday(PropertySeg1, PropertySeg2);
227                         BirthdayProcessed = TRUE;
228                 
229                 } else if (Property == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
230                 
231                         ProcessAnniversary(PropertySeg1, PropertySeg2);
232                         AnniversaryProcessed = TRUE;
233                 
234                 } else if (Property == wxT("TZ")){
235                 
236                         ProcessTimeZone(PropertySeg1, PropertySeg2, &TimeZoneCount);
237                         TimeZoneCount++;
238                 
239                 } else if (Property == wxT("ADR")){
240                 
241                         ProcessAddress(PropertySeg1, PropertySeg2, &AddressCount);
242                         AddressCount++;
243                 
244                 } else if (Property == wxT("EMAIL")){
245                                         
246                         ProcessEmail(PropertySeg1, PropertySeg2, &EmailCount);  
247                         EmailCount++;
248                 
249                 } else if (Property == wxT("IMPP")){
250                 
251                         ProcessIM(PropertySeg1, PropertySeg2, &IMCount);
252                         IMCount++;
253                         
254                 } else if (Property == wxT("TEL")){
255                                 
256                         ProcessTelephone(PropertySeg1, PropertySeg2, &TelephoneCount);
257                         TelephoneCount++;
258                 
259                 } else if (Property == wxT("LANG")){
260                 
261                         // See frmContactEditor-LoadLanguage.cpp
262                         
263                         ProcessLanguage(PropertySeg1, PropertySeg2, &LanguageCount);
264                         LanguageCount++;
265                 
266                 } else if (Property == wxT("GEO")){
267                 
268                         // See frmContactEditor-LoadGeo.cpp
269                         
270                         ProcessGeographic(PropertySeg1, PropertySeg2, &GeographicCount);        
271                         GeographicCount++;
272                 
273                 } else if (Property == wxT("RELATED")){
274                         
275                         // See fromContactEditor-LoadRelated.cpp
276                         
277                         ProcessRelated(PropertySeg1, PropertySeg2, &RelatedCount);              
278                         RelatedCount++;
279                         
280                 } else if (Property == wxT("URL")){
282                         // See frmContactEditor-LoadURL.cpp
283                 
284                         ProcessURL(PropertySeg1, PropertySeg2, &URLCount);
285                         URLCount++;
286                 
287                 } else if (Property == wxT("TITLE")) {
288                 
289                         // See frmContactEditor-LoadTitle.cpp
290                         
291                         ProcessTitle(PropertySeg1, PropertySeg2, &TitleCount);
292                         TitleCount++;
293                         
294                 } else if (Property == wxT("ROLE")) {
295                 
296                         // See frmContactEditor-LoadTitle.cpp
297                         
298                         ProcessRole(PropertySeg1, PropertySeg2, &RoleCount);
299                         RoleCount++;
300                         
301                 }
302                 
303         }
304         
305         return CONTACTLOAD_OK;
309 void ContactDataObject::ProcessKind(wxString KindType){
311         if (KindType == wxT("individual")){
312                         
313                 ContactKind = CONTACTKIND_INDIVIDUAL;
314                         
315         } else if (KindType == wxT("group")){
316                         
317                 ContactKind = CONTACTKIND_GROUP;
318                         
319         } else if (KindType == wxT("org")){
320                         
321                 ContactKind = CONTACTKIND_ORGANISATION;
322                         
323         } else if (KindType == wxT("location")){
324                         
325                 ContactKind = CONTACTKIND_LOCATION;
326                         
327         } else {
328                         
329                 ContactKind = CONTACTKIND_NONE;                 
330         }
334 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
336         std::map<int, int> SplitPoints;
337         std::map<int, int> SplitLength;
339         int intPrevValue = 8;
340         int intPref = 0;                        
341         int intType = 0;
342         
343         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
345         intPrevValue = 7;
346         
347         wxString PropertyName;
348         wxString PropertyValue;
349         wxString PropertyData;
350         wxString PropertyTokens;
351         std::map<int,int>::iterator SLiter;
352         bool FirstToken = TRUE;
353         
354         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
355         intiter != SplitPoints.end(); ++intiter){
356         
357                 SLiter = SplitLength.find(intiter->first);
358         
359                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
360                 
361                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
362                 PropertyName = PropertyElement.GetNextToken();                          
363                 PropertyValue = PropertyElement.GetNextToken();
364                 
365                 intPrevValue = intiter->second;
366                 
367                 CaptureString(&PropertyValue, FALSE);
368         
369                 if (PropertyName == wxT("ALTID")){
371                         GroupsListAltID.erase(*GroupCount);
372                         GroupsListAltID.insert(std::make_pair(*GroupCount, PropertyValue));
373                 
374                 } else if (PropertyName == wxT("PID")){
376                         GroupsListPID.erase(*GroupCount);
377                         GroupsListPID.insert(std::make_pair(*GroupCount, PropertyValue));
378                 
379                 } else if (PropertyName == wxT("PREF")){
381                         int PriorityNumber = 0;
382                         bool ValidNumber = TRUE;
383                         
384                         try{
385                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
386                         }
387                         
388                         catch(std::invalid_argument &e){
389                                 ValidNumber = FALSE;
390                         }
392                         if (ValidNumber == TRUE){
394                                 GroupsListPref.erase(*GroupCount);
395                                 GroupsListPref.insert(std::make_pair(*GroupCount, PriorityNumber));
396                 
397                         }
398                 
399                 } else if (PropertyName == wxT("MEDIATYPE")){
401                         GroupsListMediaType.erase(*GroupCount);
402                         GroupsListMediaType.insert(std::make_pair(*GroupCount, PropertyValue));
403                 
404                 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
405                         
406                         if (FirstToken == TRUE){
407                                 
408                                 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
409                                 FirstToken = FALSE;
410                                 
411                         } else {
412                         
413                                 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
414                                 
415                         }
416                         
417                 }
418                 
419         }
421         GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
423         if (!PropertyTokens.IsEmpty()){
424         
425                 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
426         
427         }
432 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
434         std::map<int, int> SplitPoints;
435         std::map<int, int> SplitLength;
437         int intPrevValue = 4;
438         int intPref = 0;                        
439         int intType = 0;
440         
441         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
443         intPrevValue = 3;
444         
445         wxString PropertyName;
446         wxString PropertyValue;
447         wxString PropertyData;
448         wxString PropertyTokens;
449         std::map<int,int>::iterator SLiter;
450         bool FirstToken = TRUE;
451         
452         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
453         intiter != SplitPoints.end(); ++intiter){
454         
455                 SLiter = SplitLength.find(intiter->first);
456         
457                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
458                 
459                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
460                 PropertyName = PropertyElement.GetNextToken();                          
461                 PropertyValue = PropertyElement.GetNextToken();
462                 
463                 intPrevValue = intiter->second;
464                 
465                 CaptureString(&PropertyValue, FALSE);
466                 
467                 if (PropertyName == wxT("TYPE")){
469                         if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
470                                 PropertyValue == wxT("work") ){
472                                 FullNamesListType.erase(*FNCount);
473                                 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
474                 
475                         }
476                 
477                 } else if (PropertyName == wxT("LANGUAGE")){
479                         FullNamesListLanguage.erase(*FNCount);
480                         FullNamesListLanguage.insert(std::make_pair(*FNCount, PropertyValue));
481                 
482                 } else if (PropertyName == wxT("ALTID")){
483                 
484                         FullNamesListAltID.erase(*FNCount);
485                         FullNamesListAltID.insert(std::make_pair(*FNCount, PropertyValue));
486                 
487                 } else if (PropertyName == wxT("PID")){
489                         FullNamesListPID.erase(*FNCount);
490                         FullNamesListPID.insert(std::make_pair(*FNCount, PropertyValue));
491                 
492                 } else if (PropertyName == wxT("PREF")){
494                         int PriorityNumber = 0;
495                         bool ValidNumber = TRUE;
496                         
497                         try{
498                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
499                         }
500                         
501                         catch(std::invalid_argument &e){
502                                 ValidNumber = FALSE;
503                         }
505                         if (ValidNumber == TRUE){
507                                 FullNamesListPref.erase(*FNCount);
508                                 FullNamesListPref.insert(std::make_pair(*FNCount, PriorityNumber));
510                         }
511                 
512                 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
513                         
514                         if (FirstToken == TRUE){
515                                 
516                                 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
517                                 FirstToken = FALSE;
518                                 
519                         } else {
520                         
521                                 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
522                                 
523                         }
524                         
525                 } 
526         
527         }
529         FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
531         if (!PropertyTokens.IsEmpty()){
532         
533                 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
534         
535         }
539 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
541         std::map<int, int> SplitPoints;
542         std::map<int, int> SplitLength;
544         int intPrevValue = 3;
545         int intPref = 0;                        
546         int intType = 0;
547         
548         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
549         
550         intPrevValue = 2;
551         
552         wxString PropertyName;
553         wxString PropertyValue;
554         wxString PropertyData;
555         wxString PropertyTokens;
556         std::map<int,int>::iterator SLiter;
557         bool FirstToken = TRUE;
558         
559         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
560         intiter != SplitPoints.end(); ++intiter){
561         
562                 SLiter = SplitLength.find(intiter->first);
563         
564                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
565                 
566                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
567                 PropertyName = PropertyElement.GetNextToken();                          
568                 PropertyValue = PropertyElement.GetNextToken();
569                 
570                 intPrevValue = intiter->second;
571                 
572                 CaptureString(&PropertyValue, FALSE);
573                 
574                 if (PropertyName == wxT("ALTID")){
576                         NameAltID = PropertyValue;
577                 
578                 } else if (PropertyName == wxT("LANGUAGE")){
579                 
580                         NameLanguage = PropertyValue;
581                 
582                 } else if (PropertyName == wxT("SORT-AS")){
583                 
584                         if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
585                                 PropertyValue.Len() >= 3){
586                                 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
587                         }
588                 
589                 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
590                         
591                         if (FirstToken == TRUE){
592                                 
593                                 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
594                                 FirstToken = FALSE;
595                                 
596                         } else {
597                         
598                                 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
599                                 
600                         }
601                         
602                 }
603         
604         }
605         
606         // Split the name data.
607         
608         int intSplitSeek = 0;           
609         int intSplitsFound = 0;
610         int intSplitSize = 0;
611         int intPropertyLen = PropertySeg2.Len();
612         
613         std::map<int,wxString> NameValues;
614         intPrevValue = 0;                                       
615         
616         for (int i = 0; i <= intPropertyLen; i++){
617         
618                 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
619                         
620                         NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
621                         
622                         intSplitSeek = i;
623                         intSplitSeek++;
624                         
625                         if (intSplitsFound == 4){
626                         
627                                 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
628                                 break;
629                         
630                         }
631                         
632                         intSplitSize = 0;
633                         continue;
634         
635                 }
636                 
637                 intSplitSize++;
639         }
640         
641         // Split the data into several parts.
642                         
643         for (std::map<int, wxString>::iterator iter = NameValues.begin(); 
644         iter != NameValues.end(); ++iter){
645         
646                 if (iter->first == 1){
647                 
648                         // Deal with family name.
649                         
650                         NameSurname = iter->second;
651                 
652                 } else if (iter->first == 2){
653                 
654                         // Deal with given names.
655                         
656                         NameForename = iter->second;
657                 
658                 } else if (iter->first == 3){
659                 
660                         // Deal with additional names.
661                         
662                         NameOtherNames = iter->second;
663                 
664                 } else if (iter->first == 4){
665                 
666                         // Deal with honorifix prefixes and suffixes.
668                         NameTitle = iter->second;
669                 
670                         iter++;
671                         
672                         if (iter == NameValues.end()){
673                         
674                                 break;
675                         
676                         }
677                 
678                         NameSuffix = iter->second;
679                 
680                 }
681         
682         }
683         
684         // Add the name token data.
685         
686         if (!PropertyTokens.IsEmpty()){
687         
688                 NameTokens = PropertyTokens;
689         
690         }
694 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
696         std::map<int, int> SplitPoints;
697         std::map<int, int> SplitLength;
699         int intPrevValue = 10;
700         int intPref = 0;                        
701         
702         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
703         
704         intPrevValue = 9;
705         
706         PropertyType PropType = PROPERTY_NONE;
707         
708         // Look for type before continuing.
709         
710         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
711         
712         intPrevValue = 9;
713         
714         std::map<int, wxString> *NicknamesList = NULL;
715         std::map<int, wxString> *NicknamesListType = NULL;
716         std::map<int, wxString> *NicknamesListLanguage = NULL;
717         std::map<int, wxString> *NicknamesListAltID = NULL;
718         std::map<int, wxString> *NicknamesListPID = NULL;
719         std::map<int, wxString> *NicknamesListTokens = NULL;            
720         std::map<int, int> *NicknamesListPref = NULL;
721         
722         switch(PropType){
723                 case PROPERTY_NONE:
724                         NicknamesList = &GeneralNicknamesList;
725                         NicknamesListType = &GeneralNicknamesListType;
726                         NicknamesListLanguage = &GeneralNicknamesListLanguage;
727                         NicknamesListAltID = &GeneralNicknamesListAltID;
728                         NicknamesListPID = &GeneralNicknamesListPID;
729                         NicknamesListTokens = &GeneralNicknamesListTokens;
730                         NicknamesListPref = &GeneralNicknamesListPref;
731                         break;
732                 case PROPERTY_HOME:
733                         NicknamesList = &HomeNicknamesList;
734                         NicknamesListType = &HomeNicknamesListType;
735                         NicknamesListLanguage = &HomeNicknamesListLanguage;
736                         NicknamesListAltID = &HomeNicknamesListAltID;
737                         NicknamesListPID = &HomeNicknamesListPID;
738                         NicknamesListTokens = &HomeNicknamesListTokens;
739                         NicknamesListPref = &HomeNicknamesListPref;
740                         break;
741                 case PROPERTY_WORK:
742                         NicknamesList = &BusinessNicknamesList;
743                         NicknamesListType = &BusinessNicknamesListType;
744                         NicknamesListLanguage = &BusinessNicknamesListLanguage;
745                         NicknamesListAltID = &BusinessNicknamesListAltID;
746                         NicknamesListPID = &BusinessNicknamesListPID;
747                         NicknamesListTokens = &BusinessNicknamesListTokens;
748                         NicknamesListPref = &BusinessNicknamesListPref;
749                         break;
750         }
751         
752         std::map<int, int>::iterator SLiter;    
753         wxString PropertyData;
754         wxString PropertyName;
755         wxString PropertyValue;
756         wxString PropertyTokens;
757         bool FirstToken = TRUE;
758         
759         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
760         intiter != SplitPoints.end(); ++intiter){
761         
762                 SLiter = SplitLength.find(intiter->first);
763         
764                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
765                 
766                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
767                 PropertyName = PropertyElement.GetNextToken();                          
768                 PropertyValue = PropertyElement.GetNextToken();
769                 
770                 intPrevValue = intiter->second;
771                 
772                 CaptureString(&PropertyValue, FALSE);
773                 
774                 if (PropertyName == wxT("ALTID")){
776                         NicknamesListAltID->erase(*NicknameCount);
777                         NicknamesListAltID->insert(std::make_pair(*NicknameCount, PropertyValue));
778                 
779                 } else if (PropertyName == wxT("PID")){
781                         NicknamesListPID->erase(*NicknameCount);
782                         NicknamesListPID->insert(std::make_pair(*NicknameCount, PropertyValue));        
784                 } else if (PropertyName == wxT("PREF")){
786                         int PriorityNumber = 0;
787                         bool ValidNumber = TRUE;
788                         
789                         try{
790                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
791                         }
792                         
793                         catch(std::invalid_argument &e){
794                                 ValidNumber = FALSE;
795                         }
797                         if (ValidNumber == TRUE){
799                                 NicknamesListPref->erase(*NicknameCount);
800                                 NicknamesListPref->insert(std::make_pair(*NicknameCount, PriorityNumber));
802                         }
803                 
804                 } else if (PropertyName == wxT("LANGUAGE")){
806                         NicknamesListLanguage->erase(*NicknameCount);
807                         NicknamesListLanguage->insert(std::make_pair(*NicknameCount, PropertyValue));   
809                 } else {
810                 
811                         // Something else we don't know about so append
812                         // to the tokens variable.
813                 
814                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
815                 
816                                 if (FirstToken == TRUE){
817                         
818                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
819                                         FirstToken = FALSE;
820                         
821                                 } else {
822                         
823                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
824                         
825                                 }
826                 
827                         }
828                 
829                 }
830                 
831         }
832         
833         NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
834         
835         // Add the name token data.
836         
837         if (!PropertyTokens.IsEmpty()){
838         
839                 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
840         
841         }
845 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
847         std::map<int, int> SplitPoints;
848         std::map<int, int> SplitLength;
849         std::map<int, int>::iterator SLiter;                    
850         wxString PropertyData;
851         wxString PropertyName;
852         wxString PropertyValue;
853         wxString PropertyTokens;
854         bool FirstToken = TRUE;
855         int intPrevValue = 8;
857         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
859         intPrevValue = 7;                       
860         
861         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
862         intiter != SplitPoints.end(); ++intiter){
863         
864                 SLiter = SplitLength.find(intiter->first);
865         
866                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
867                 
868                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
869                 PropertyName = PropertyElement.GetNextToken();                          
870                 PropertyValue = PropertyElement.GetNextToken();
871                 
872                 intPrevValue = intiter->second;
873                 
874                 // Process properties.
875                 
876                 size_t intPropertyValueLen = PropertyValue.Len();
877                 
878                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
879                         
880                         PropertyValue.Trim();
881                         PropertyValue.RemoveLast();
882                         
883                 }                               
884                 
885                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
886                         
887                         PropertyValue.Remove(0, 1);
888                         
889                 }                               
890                 
891                 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
893                         if (FirstToken == TRUE){
894         
895                                 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
896                                 FirstToken = FALSE;
897         
898                         } else {
899         
900                                 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
901         
902                         }
904                 }
905         
906         }       
908         wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
909         
910         wxString GenderComponent;
911         
912         if (GenderData.CountTokens() >= 2){
913         
914                 Gender = GenderData.GetNextToken();
915                 GenderDetails = GenderData.GetString();
916         
917                 CaptureString(&GenderDetails, FALSE);
918                                                 
919         } else {
920         
921                 Gender = GenderData.GetNextToken();
922         
923         }
924         
925         if (!PropertyTokens.IsEmpty()){
926         
927                 GenderTokens = PropertyTokens;
928         
929         }
933 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
935         // Process date. Preserve the remainder in the string.
937         std::map<int, int> SplitPoints;
938         std::map<int, int> SplitLength;
939         std::map<int, int>::iterator SLiter;                    
940         wxString PropertyData;
941         wxString PropertyName;
942         wxString PropertyValue;
943         wxString PropertyTokens;
944         bool BirthdayText = FALSE;
945         int intPrevValue = 6;
947         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
949         intPrevValue = 5;
951         // Look for type before continuing.
953         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
954         intiter != SplitPoints.end(); ++intiter){
956                 SLiter = SplitLength.find(intiter->first);
958                 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
959         
960                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
961                 PropertyName = PropertyElement.GetNextToken();                          
962                 PropertyValue = PropertyElement.GetNextToken();
963         
964                 intPrevValue = intiter->second;
965         
966                 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
967         
968                         CaptureString(&PropertySeg2, FALSE);
969                         Birthday = PropertySeg2;
970                         BirthdayText = TRUE;
971         
972                 }
974         }
976         // Setup blank lines for later on.
977         
978         intPrevValue = 5;
979         bool FirstToken = TRUE;
981         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
982         intiter != SplitPoints.end(); ++intiter){
984                 SLiter = SplitLength.find(intiter->first);
986                 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
987         
988                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
989                 PropertyName = PropertyElement.GetNextToken();                          
990                 PropertyValue = PropertyElement.GetNextToken();
991         
992                 intPrevValue = intiter->second;
993         
994                 // Process properties.
995         
996                 CaptureString(&PropertyValue, FALSE);
997         
998                 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
999                 
1000                         PropertyValue.Trim();
1001                         PropertyValue.RemoveLast();
1002                 
1003                 }                               
1004         
1005                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1006                 
1007                         PropertyValue.Remove(0, 1);
1008                 
1009                 }                               
1010         
1011                 if (PropertyName == wxT("ALTID")){
1013                         BirthdayAltID = PropertyValue;
1014         
1015                 } else if (PropertyName == wxT("CALSCALE")){
1016         
1017                         BirthdayCalScale = PropertyValue;
1018         
1019                 } else if (PropertyName != wxT("VALUE")) {
1020         
1021                         // Something else we don't know about so append
1022                         // to the tokens variable.
1023                 
1024                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1025                 
1026                                 if (FirstToken == TRUE){
1027         
1028                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1029                                         FirstToken = FALSE;
1030         
1031                                 } else {
1032         
1033                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1034         
1035                                 }
1036                                 
1037                         }
1038                         
1039                 }
1041         }       
1043         // Add the data to the variables and form.
1044         
1045         if (BirthdayText == FALSE){
1046         
1047                 Birthday = PropertySeg2;
1049         }
1050         
1051         if (!PropertyTokens.IsEmpty()){
1052         
1053                 BirthdayTokens = PropertyTokens;
1055         }
1059 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1061         // Process date. Preserve the remainder in the string.
1063         std::map<int, int> SplitPoints;
1064         std::map<int, int> SplitLength;
1065         std::map<int, int>::iterator SLiter;                    
1066         wxString PropertyData;
1067         wxString PropertyName;
1068         wxString PropertyValue;
1069         wxString PropertyTokens;
1070         bool AnniversaryText = FALSE;
1071         int intPrevValue = 13;
1073         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1075         intPrevValue = 12;
1077         // Look for type before continuing.
1079         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1080         intiter != SplitPoints.end(); ++intiter){
1082                 SLiter = SplitLength.find(intiter->first);
1084                 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1085         
1086                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1087                 PropertyName = PropertyElement.GetNextToken();                          
1088                 PropertyValue = PropertyElement.GetNextToken();
1089         
1090                 intPrevValue = intiter->second;
1091         
1092                 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1093         
1094                         CaptureString(&PropertySeg2, FALSE);
1095                         Anniversary = PropertySeg2;
1096                         AnniversaryText = TRUE;
1097         
1098                 }
1100         }
1102         // Setup blank lines for later on.
1103         
1104         intPrevValue = 12;
1105         bool FirstToken = TRUE;
1107         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1108         intiter != SplitPoints.end(); ++intiter){
1110                 SLiter = SplitLength.find(intiter->first);
1112                 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1113         
1114                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1115                 PropertyName = PropertyElement.GetNextToken();                          
1116                 PropertyValue = PropertyElement.GetNextToken();
1117         
1118                 intPrevValue = intiter->second;
1119         
1120                 // Process properties.
1121         
1122                 CaptureString(&PropertyValue, FALSE);
1123         
1124                 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1125                 
1126                         PropertyValue.Trim();
1127                         PropertyValue.RemoveLast();
1128                 
1129                 }                               
1130         
1131                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1132                 
1133                         PropertyValue.Remove(0, 1);
1134                 
1135                 }                               
1136         
1137                 if (PropertyName == wxT("ALTID")){
1139                         AnniversaryAltID = PropertyValue;
1140         
1141                 } else if (PropertyName == wxT("CALSCALE")){
1142         
1143                         AnniversaryCalScale = PropertyValue;
1144         
1145                 } else if (PropertyName != wxT("VALUE")) {
1146         
1147                         // Something else we don't know about so append
1148                         // to the tokens variable.
1149                 
1150                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1151                 
1152                                 if (FirstToken == TRUE){
1153         
1154                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1155                                         FirstToken = FALSE;
1156         
1157                                 } else {
1158         
1159                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1160         
1161                                 }
1162                                 
1163                         }
1164                         
1165                 }
1167         }       
1169         // Add the data to the variables and form.
1170         
1171         if (AnniversaryText == FALSE){
1172         
1173                 Anniversary = PropertySeg2;
1175         }
1176         
1177         if (!PropertyTokens.IsEmpty()){
1178         
1179                 AnniversaryTokens = PropertyTokens;
1181         }
1185 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1187         std::map<int, int> SplitPoints;
1188         std::map<int, int> SplitLength;
1190         int intPrevValue = 4;
1191         int intPref = 0;                        
1192         
1193         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1194         
1195         intPrevValue = 3;
1196         
1197         PropertyType PropType = PROPERTY_NONE;
1198         
1199         // Look for type before continuing.
1200         
1201         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1202         
1203         intPrevValue = 3;
1204         
1205         std::map<int, wxString> *TZList = NULL;
1206         std::map<int, wxString> *TZListType = NULL;
1207         std::map<int, wxString> *TZListMediatype = NULL;
1208         std::map<int, wxString> *TZListAltID = NULL;
1209         std::map<int, wxString> *TZListPID = NULL;
1210         std::map<int, wxString> *TZListTokens = NULL;           
1211         std::map<int, int> *TZListPref = NULL;
1212         
1213         switch(PropType){
1214                 case PROPERTY_NONE:
1215                         TZList = &GeneralTZList;
1216                         TZListType = &GeneralTZListType;
1217                         TZListMediatype = &GeneralTZListMediatype;
1218                         TZListAltID = &GeneralTZListAltID;
1219                         TZListPID = &GeneralTZListPID;
1220                         TZListTokens = &GeneralTZListTokens;
1221                         TZListPref = &GeneralTZListPref;
1222                         break;
1223                 case PROPERTY_HOME:
1224                         TZList = &HomeTZList;
1225                         TZListType = &HomeTZListType;
1226                         TZListMediatype = &HomeTZListMediatype;
1227                         TZListAltID = &HomeTZListAltID;
1228                         TZListPID = &HomeTZListPID;
1229                         TZListTokens = &HomeTZListTokens;
1230                         TZListPref = &HomeTZListPref;
1231                         break;
1232                 case PROPERTY_WORK:
1233                         TZList = &BusinessTZList;
1234                         TZListType = &BusinessTZListType;
1235                         TZListMediatype = &BusinessTZListMediatype;
1236                         TZListAltID = &BusinessTZListAltID;
1237                         TZListPID = &BusinessTZListPID;
1238                         TZListTokens = &BusinessTZListTokens;
1239                         TZListPref = &BusinessTZListPref;
1240                         break;
1241         }
1242         
1243         std::map<int, int>::iterator SLiter;    
1244         wxString PropertyData;
1245         wxString PropertyName;
1246         wxString PropertyValue;
1247         wxString PropertyTokens;
1248         bool FirstToken = TRUE;
1249         
1250         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1251         intiter != SplitPoints.end(); ++intiter){
1252         
1253                 SLiter = SplitLength.find(intiter->first);
1254         
1255                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1256                 
1257                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1258                 PropertyName = PropertyElement.GetNextToken();                          
1259                 PropertyValue = PropertyElement.GetNextToken();
1260                 
1261                 intPrevValue = intiter->second;
1262                 
1263                 CaptureString(&PropertyValue, FALSE);
1265                 if (PropertyName == wxT("ALTID")){
1267                         TZListAltID->erase(*TimeZoneCount);
1268                         TZListAltID->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1269                 
1270                 } else if (PropertyName == wxT("PID")){
1272                         TZListPID->erase(*TimeZoneCount);
1273                         TZListPID->insert(std::make_pair(*TimeZoneCount, PropertyValue));       
1275                 } else if (PropertyName == wxT("PREF")){
1277                         int PriorityNumber = 0;
1278                         bool ValidNumber = TRUE;
1279                         
1280                         try{
1281                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1282                         }
1283                         
1284                         catch(std::invalid_argument &e){
1285                                 ValidNumber = FALSE;
1286                         }
1288                         if (ValidNumber == TRUE){
1290                                 TZListPref->erase(*TimeZoneCount);
1291                                 TZListPref->insert(std::make_pair(*TimeZoneCount, PriorityNumber));
1293                         }
1294                 
1295                 } else if (PropertyName == wxT("MEDIATYPE")){
1297                         TZListMediatype->erase(*TimeZoneCount);
1298                         TZListMediatype->insert(std::make_pair(*TimeZoneCount, PropertyValue)); 
1300                 } else {
1301                 
1302                         // Something else we don't know about so append
1303                         // to the tokens variable.
1304                 
1305                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1306                 
1307                                 if (FirstToken == TRUE){
1308                         
1309                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1310                                         FirstToken = FALSE;
1311                         
1312                                 } else {
1313                         
1314                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1315                         
1316                                 }
1317                 
1318                         }
1319                 
1320                 }
1321                 
1322         }
1323         
1324         TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1325         
1326         // Add the name token data.
1327         
1328         if (!PropertyTokens.IsEmpty()){
1329         
1330                 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1331         
1332         }
1337 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1339         size_t intPropertyLen = PropertySeg1.Len();
1340         std::map<int, int> SplitPoints;
1341         std::map<int, int> SplitLength;
1342         std::map<int, int>::iterator SLiter;                    
1343         wxString PropertyData;
1344         wxString PropertyName;
1345         wxString PropertyValue;
1346         wxString PropertyTokens;
1347         wxString AddressLabel;
1348         wxString AddressLang;
1349         wxString AddressAltID;
1350         wxString AddressPID;
1351         wxString AddressTokens;
1352         wxString AddressGeo;
1353         wxString AddressTimezone;
1354         wxString AddressType;
1355         wxString AddressMediatype;
1356         wxString AddressPOBox;
1357         wxString AddressExtended;
1358         wxString AddressStreet;
1359         wxString AddressLocality;
1360         wxString AddressCity;
1361         wxString AddressRegion;
1362         wxString AddressPostalCode;
1363         wxString AddressCountry;
1364         bool FirstToken = TRUE;                 
1365         int intSplitsFound = 0;
1366         int intSplitSize = 0;
1367         int intPrevValue = 5;
1368         int intPref = 0;                        
1369         int intType = 0;
1370         long ListCtrlIndex;
1371         
1372         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1373         
1374         intPrevValue = 4;
1375         
1376         PropertyType PropType = PROPERTY_NONE;
1377                 
1378         // Look for type before continuing.
1379         
1380         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1381         
1382         intPrevValue = 4;
1383         
1384         std::map<int, wxString> *AddressList = NULL;
1385         std::map<int, wxString> *AddressListTown = NULL;
1386         std::map<int, wxString> *AddressListCounty = NULL;
1387         std::map<int, wxString> *AddressListPostCode = NULL;
1388         std::map<int, wxString> *AddressListCountry = NULL;
1389         std::map<int, wxString> *AddressListLabel = NULL;
1390         std::map<int, wxString> *AddressListLang = NULL;                
1391         std::map<int, wxString> *AddressListAltID = NULL;
1392         std::map<int, wxString> *AddressListPID = NULL;
1393         std::map<int, wxString> *AddressListTokens = NULL;
1394         std::map<int, wxString> *AddressListGeo = NULL;
1395         std::map<int, wxString> *AddressListTimezone = NULL;            
1396         std::map<int, wxString> *AddressListType = NULL;
1397         std::map<int, wxString> *AddressListMediatype = NULL;
1398         std::map<int, int> *AddressListPref = NULL;
1400         switch(PropType){
1401                 case PROPERTY_NONE:
1402                         AddressList = &GeneralAddressList;
1403                         AddressListTown = &GeneralAddressListTown;
1404                         AddressListCounty = &GeneralAddressListCounty;
1405                         AddressListPostCode = &GeneralAddressListPostCode;
1406                         AddressListCountry = &GeneralAddressListCountry;
1407                         AddressListLabel = &GeneralAddressListLabel;
1408                         AddressListLang = &GeneralAddressListLang;              
1409                         AddressListAltID = &GeneralAddressListAltID;
1410                         AddressListPID = &GeneralAddressListPID;
1411                         AddressListTokens = &GeneralAddressListTokens;
1412                         AddressListGeo = &GeneralAddressListGeo;
1413                         AddressListTimezone = &GeneralAddressListTimezone;
1414                         AddressListType = &GeneralAddressListType;
1415                         AddressListMediatype = &GeneralAddressListMediatype;
1416                         AddressListPref = &GeneralAddressListPref;              
1417                         break;
1418                 case PROPERTY_HOME:
1419                         AddressList = &HomeAddressList;
1420                         AddressListTown = &HomeAddressListTown;
1421                         AddressListCounty = &HomeAddressListCounty;
1422                         AddressListPostCode = &HomeAddressListPostCode;
1423                         AddressListCountry = &HomeAddressListCountry;
1424                         AddressListLabel = &HomeAddressListLabel;
1425                         AddressListLang = &HomeAddressListLang;         
1426                         AddressListAltID = &HomeAddressListAltID;
1427                         AddressListPID = &HomeAddressListPID;
1428                         AddressListTokens = &HomeAddressListTokens;
1429                         AddressListGeo = &HomeAddressListGeo;
1430                         AddressListTimezone = &HomeAddressListTimezone;
1431                         AddressListType = &HomeAddressListType;
1432                         AddressListMediatype = &HomeAddressListMediatype;
1433                         AddressListPref = &HomeAddressListPref;
1434                         break;
1435                 case PROPERTY_WORK:
1436                         AddressList = &BusinessAddressList;
1437                         AddressListTown = &BusinessAddressListTown;
1438                         AddressListCounty = &BusinessAddressListCounty;
1439                         AddressListPostCode = &BusinessAddressListPostCode;
1440                         AddressListCountry = &BusinessAddressListCountry;
1441                         AddressListLabel = &BusinessAddressListLabel;
1442                         AddressListLang = &BusinessAddressListLang;             
1443                         AddressListAltID = &BusinessAddressListAltID;
1444                         AddressListPID = &BusinessAddressListPID;
1445                         AddressListTokens = &BusinessAddressListTokens;
1446                         AddressListGeo = &BusinessAddressListGeo;
1447                         AddressListTimezone = &BusinessAddressListTimezone;
1448                         AddressListType = &BusinessAddressListType;
1449                         AddressListMediatype = &BusinessAddressListMediatype;
1450                         AddressListPref = &BusinessAddressListPref;
1451                         break;
1452         }
1453         
1454         intPrevValue = 4;
1455         
1456         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1457         intiter != SplitPoints.end(); ++intiter){
1458         
1459                 SLiter = SplitLength.find(intiter->first);
1460         
1461                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1462                 
1463                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1464                 PropertyName = PropertyElement.GetNextToken();                          
1465                 PropertyValue = PropertyElement.GetNextToken();
1466                 
1467                 intPrevValue = intiter->second;
1468                 
1469                 CaptureString(&PropertyValue, FALSE);
1470                 
1471                 // Process properties.
1472                 
1473                 if (PropertyName == wxT("LABEL")){
1474                 
1475                         AddressListLabel->erase(*AddressCount);
1476                         AddressListLabel->insert(std::make_pair(*AddressCount, PropertyValue));
1477                                 
1478                 } else if (PropertyName == wxT("LANGUAGE")){
1479                 
1480                         AddressListLang->erase(*AddressCount);
1481                         AddressListLang->insert(std::make_pair(*AddressCount, PropertyValue));                  
1482                 
1483                 } else if (PropertyName == wxT("ALTID")){
1485                         AddressListAltID->erase(*AddressCount);
1486                         AddressListAltID->insert(std::make_pair(*AddressCount, PropertyValue));
1487                 
1488                 } else if (PropertyName == wxT("PID")){
1490                         AddressListPID->erase(*AddressCount);
1491                         AddressListPID->insert(std::make_pair(*AddressCount, PropertyValue));
1492                 
1493                 } else if (PropertyName == wxT("GEO")){
1494                 
1495                         AddressListGeo->erase(*AddressCount);
1496                         AddressListGeo->insert(std::make_pair(*AddressCount, PropertyValue));
1497                 
1498                 } else if (PropertyName == wxT("TZ")){
1500                         AddressListTimezone->erase(*AddressCount);
1501                         AddressListTimezone->insert(std::make_pair(*AddressCount, PropertyValue));
1502                 
1503                 } else if (PropertyName == wxT("MEDIATYPE")){
1505                         AddressListMediatype->erase(*AddressCount);
1506                         AddressListMediatype->insert(std::make_pair(*AddressCount, PropertyValue));
1507                 
1508                 } else if (PropertyName == wxT("PREF")){
1509                         
1510                         int PriorityNumber = 0;
1511                         bool ValidNumber = TRUE;
1512                         
1513                         try{
1514                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1515                         }
1516                         
1517                         catch(std::invalid_argument &e){
1518                                 ValidNumber = FALSE;
1519                         }
1521                         if (ValidNumber == TRUE){
1523                                 AddressListPref->erase(*AddressCount);
1524                                 AddressListPref->insert(std::make_pair(*AddressCount, PriorityNumber));
1526                         }
1527                 
1528                 } else {
1529                 
1530                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1531                         
1532                                 if (FirstToken == TRUE){
1533                                 
1534                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1535                                         FirstToken = FALSE;
1536                                 
1537                                 } else {
1538                                 
1539                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1540                                 
1541                                 }
1542                         
1543                         }
1544                 
1545                 }
1546         
1547         }                       
1548         
1549         // Split the address. 
1551         //std::map<int, int>::iterator SLiter;
1552         intPropertyLen = PropertySeg2.Len();
1553         SplitPoints.clear();
1554         SplitLength.clear();
1555         intSplitsFound = 0;
1556         intSplitSize = 0;
1557         intPrevValue = 0;
1558         
1559         for (int i = 0; i <= intPropertyLen; i++){
1561                 intSplitSize++;
1562         
1563                 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1564         
1565                         intSplitsFound++;
1566                         SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1567                         
1568                         if (intSplitsFound == 6){ 
1569                         
1570                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1571                                 break; 
1572                                 
1573                         } else {
1574                         
1575                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1576                         
1577                         }
1578                         
1579                         intSplitSize = 0;                                       
1580         
1581                 }
1583         }
1584         
1585         // Split the data into several parts.                   
1586         
1587         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1588         intiter != SplitPoints.end(); ++intiter){
1589                         
1590                 if (intiter->first == 1){
1591                 
1592                         // Deal with PO Box.
1593                         
1594                         SLiter = SplitLength.find(1);
1595                                                                 
1596                         //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
1597                         AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1598                         intPrevValue = intiter->second;
1599                 
1600                 } else if (intiter->first == 2){
1601                 
1602                         // Deal with extended address.
1603                         
1604                         SLiter = SplitLength.find(2);
1605                         
1606                         AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1607                         //txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1608                         intPrevValue = intiter->second;
1609                 
1610                 } else if (intiter->first == 3){
1611                 
1612                         // Deal with street address.
1613                         
1614                         SLiter = SplitLength.find(3);
1615                                                                 
1616                         AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1617                         //txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1618                         intPrevValue = intiter->second;
1619                 
1620                 } else if (intiter->first == 4){
1621                 
1622                         // Deal with locality
1624                         SLiter = SplitLength.find(4);
1625                         
1626                         AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1627                         //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1628                         intPrevValue = intiter->second;
1629                         
1630                         //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1631                 
1632                 } else if (intiter->first == 5){
1633                 
1634                         // Deal with region.
1636                         SLiter = SplitLength.find(5);
1637                         
1638                         AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1639                         //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1640                         intPrevValue = intiter->second;
1641                         
1642                         //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1643                 
1644                 } else if (intiter->first == 6){
1645                 
1646                         // Deal with post code.
1648                         SLiter = SplitLength.find(6);
1649                         
1650                         AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1651                         //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1652                         intPrevValue = intiter->second;
1653                         
1654                         // Deal with country.
1655                                                 
1656                         AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1657                         //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1658                         
1659                         break;
1660                 
1661                 }
1662         
1663         }       
1664         
1665         // Add the data to the General/Home/Work address variables.
1666         
1667         CaptureString(&AddressStreet, FALSE); 
1668         CaptureString(&AddressLocality, FALSE);
1669         CaptureString(&AddressRegion, FALSE);
1670         CaptureString(&AddressPostalCode, FALSE);
1671         CaptureString(&AddressCountry, FALSE);
1672                 
1673         if (!PropertyTokens.IsEmpty()){
1674         
1675                 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1676         
1677         }
1679         AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));      
1680         AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1681         AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1682         AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1683         AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1685         switch(PropType){
1686                 case PROPERTY_NONE:
1687                         AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1688                         break;
1689                 case PROPERTY_HOME:
1690                         AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1691                         break;
1692                 case PROPERTY_WORK:
1693                         AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));    
1694                         break;
1695         }
1696         
1697         AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1701 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1703         std::map<int, int> SplitPoints;
1704         std::map<int, int> SplitLength;
1706         int intPrevValue = 7;
1707         int intPref = 0;                        
1708         
1709         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1710         
1711         intPrevValue = 6;
1712         
1713         PropertyType PropType = PROPERTY_NONE;
1714                 
1715         // Look for type before continuing.
1716         
1717         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1718         
1719         std::map<int, wxString> *EmailList = NULL;
1720         std::map<int, wxString> *EmailListType = NULL;
1721         std::map<int, wxString> *EmailListAltID = NULL;
1722         std::map<int, wxString> *EmailListPID = NULL;
1723         std::map<int, wxString> *EmailListTokens = NULL;                
1724         std::map<int, int> *EmailListPref = NULL;
1726         switch(PropType){
1727                 case PROPERTY_NONE:
1728                         EmailList = &GeneralEmailList;
1729                         EmailListType = &GeneralEmailListType;
1730                         EmailListAltID = &GeneralEmailListAltID;
1731                         EmailListPID = &GeneralEmailListPID;
1732                         EmailListTokens = &GeneralEmailListTokens;              
1733                         EmailListPref = &GeneralEmailListPref;  
1734                         break;
1735                 case PROPERTY_HOME:
1736                         EmailList = &HomeEmailList;
1737                         EmailListType = &HomeEmailListType;
1738                         EmailListAltID = &HomeEmailListAltID;
1739                         EmailListPID = &HomeEmailListPID;
1740                         EmailListTokens = &HomeEmailListTokens;         
1741                         EmailListPref = &HomeEmailListPref;     
1742                         break;
1743                 case PROPERTY_WORK:
1744                         EmailList = &BusinessEmailList;
1745                         EmailListType = &BusinessEmailListType;
1746                         EmailListAltID = &BusinessEmailListAltID;
1747                         EmailListPID = &BusinessEmailListPID;
1748                         EmailListTokens = &BusinessEmailListTokens;             
1749                         EmailListPref = &BusinessEmailListPref; 
1750                         break;
1751         }
1752         
1753         intPrevValue = 6;
1754         
1755         std::map<int,int>::iterator SLiter;
1756         wxString PropertyData;
1757         wxString PropertyName;
1758         wxString PropertyValue;
1759         wxString PropertyTokens;
1760         bool FirstToken = TRUE;
1761         
1762         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1763         intiter != SplitPoints.end(); ++intiter){
1764         
1765                 SLiter = SplitLength.find(intiter->first);
1766         
1767                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1768                 
1769                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1770                 PropertyName = PropertyElement.GetNextToken();                          
1771                 PropertyValue = PropertyElement.GetNextToken();
1772                 
1773                 intPrevValue = intiter->second;
1774                 
1775                 CaptureString(&PropertyValue, FALSE);
1776                 
1777                 // Process properties.
1778                 
1779                 if (PropertyName == wxT("ALTID")){
1781                         EmailListAltID->erase(*EmailCount);
1782                         EmailListAltID->insert(std::make_pair(*EmailCount, PropertyValue));
1783                 
1784                 } else if (PropertyName == wxT("PID")){
1786                         EmailListPID->erase(*EmailCount);
1787                         EmailListPID->insert(std::make_pair(*EmailCount, PropertyValue));
1788                 
1789                 } else if (PropertyName == wxT("PREF")){
1790                         
1791                         int PriorityNumber = 0;
1792                         bool ValidNumber = TRUE;
1793                         
1794                         try{
1795                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1796                         }
1797                         
1798                         catch(std::invalid_argument &e){
1799                                 ValidNumber = FALSE;
1800                         }
1802                         if (ValidNumber == TRUE){
1804                                 EmailListPref->erase(*EmailCount);
1805                                 EmailListPref->insert(std::make_pair(*EmailCount, PriorityNumber));
1807                         }
1808                 
1809                 } else {
1810                 
1811                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1812                         
1813                                 if (FirstToken == TRUE){
1814                                 
1815                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1816                                         FirstToken = FALSE;
1817                                 
1818                                 } else {
1819                                 
1820                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1821                                 
1822                                 }
1823                         
1824                         }
1825                 
1826                 }
1827         
1828         }
1829         
1830         EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1831         
1832         // Add the name token data.
1833         
1834         if (!PropertyTokens.IsEmpty()){
1835         
1836                 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1837         
1838         }       
1843 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1845         std::map<int, int> SplitPoints;
1846         std::map<int, int> SplitLength;
1848         int intPrevValue = 6;
1849         int intPref = 0;                        
1850         
1851         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1852         
1853         intPrevValue = 5;
1854         
1855         PropertyType PropType = PROPERTY_NONE;
1856                 
1857         // Look for type before continuing.
1858         
1859         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1860         
1861         std::map<int, wxString> *IMList = NULL;
1862         std::map<int, wxString> *IMListType = NULL;
1863         std::map<int, wxString> *IMListAltID = NULL;
1864         std::map<int, wxString> *IMListPID = NULL;
1865         std::map<int, wxString> *IMListTokens = NULL;
1866         std::map<int, wxString> *IMListMediatype = NULL;        
1867         std::map<int, int> *IMListPref = NULL;
1869         switch(PropType){
1870                 case PROPERTY_NONE:
1871                         IMList = &GeneralIMList;
1872                         IMListType = &GeneralIMListType;
1873                         IMListAltID = &GeneralIMListAltID;
1874                         IMListPID = &GeneralIMListPID;
1875                         IMListTokens = &GeneralIMListTokens;
1876                         IMListMediatype = &GeneralIMListMediatype;
1877                         IMListPref = &GeneralIMListPref;        
1878                         break;
1879                 case PROPERTY_HOME:
1880                         IMList = &HomeIMList;
1881                         IMListType = &HomeIMListType;
1882                         IMListAltID = &HomeIMListAltID;
1883                         IMListPID = &HomeIMListPID;
1884                         IMListTokens = &HomeIMListTokens;
1885                         IMListMediatype = &HomeIMListMediatype;         
1886                         IMListPref = &HomeIMListPref;   
1887                         break;
1888                 case PROPERTY_WORK:
1889                         IMList = &BusinessIMList;
1890                         IMListType = &BusinessIMListType;
1891                         IMListAltID = &BusinessIMListAltID;
1892                         IMListPID = &BusinessIMListPID;
1893                         IMListTokens = &BusinessIMListTokens;   
1894                         IMListMediatype = &BusinessIMListMediatype;     
1895                         IMListPref = &BusinessIMListPref;       
1896                         break;
1897         }
1898         
1899         intPrevValue = 5;
1900         
1901         std::map<int,int>::iterator SLiter;
1902         wxString PropertyData;
1903         wxString PropertyName;
1904         wxString PropertyValue;
1905         wxString PropertyTokens;
1906         bool FirstToken = TRUE;
1907         
1908         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1909         intiter != SplitPoints.end(); ++intiter){
1910         
1911                 SLiter = SplitLength.find(intiter->first);
1912         
1913                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1914                 
1915                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1916                 PropertyName = PropertyElement.GetNextToken();                          
1917                 PropertyValue = PropertyElement.GetNextToken();
1918                 
1919                 intPrevValue = intiter->second;
1920                 
1921                 CaptureString(&PropertyValue, FALSE);
1922                 
1923                 // Process properties.
1924                 
1925                 if (PropertyName == wxT("ALTID")){
1927                         IMListAltID->erase(*IMCount);
1928                         IMListAltID->insert(std::make_pair(*IMCount, PropertyValue));
1929                 
1930                 } else if (PropertyName == wxT("PID")){
1932                         IMListPID->erase(*IMCount);
1933                         IMListPID->insert(std::make_pair(*IMCount, PropertyValue));
1934                 
1935                 } else if (PropertyName == wxT("MEDIATYPE")){
1937                         IMListMediatype->erase(*IMCount);
1938                         IMListMediatype->insert(std::make_pair(*IMCount, PropertyValue));
1939                 
1940                 } else if (PropertyName == wxT("PREF")){
1941                         
1942                         int PriorityNumber = 0;
1943                         bool ValidNumber = TRUE;
1944                         
1945                         try{
1946                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
1947                         }
1948                         
1949                         catch(std::invalid_argument &e){
1950                                 ValidNumber = FALSE;
1951                         }
1953                         if (ValidNumber == TRUE){
1955                                 IMListPref->erase(*IMCount);
1956                                 IMListPref->insert(std::make_pair(*IMCount, PriorityNumber));
1958                         }
1959                 
1960                 } else {
1961                 
1962                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1963                         
1964                                 if (FirstToken == TRUE){
1965                                 
1966                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1967                                         FirstToken = FALSE;
1968                                 
1969                                 } else {
1970                                 
1971                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1972                                 
1973                                 }
1974                         
1975                         }
1976                 
1977                 }
1978         
1979         }
1980                 
1981         IMList->insert(std::make_pair(*IMCount, PropertySeg2));
1982         
1983         // Add the name token data.
1984         
1985         if (!PropertyTokens.IsEmpty()){
1986         
1987                 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
1988         
1989         }
1993 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
1995         std::map<int, int> SplitPoints;
1996         std::map<int, int> SplitLength;
1997         std::map<int, int>::iterator SLiter;
1998         
1999         int intPref = 0;
2000         
2001         PropertyType PropType = PROPERTY_NONE;
2002                 
2003         // Look for type before continuing.
2004         
2005         wxString TelTypeUI;
2006         wxString TelTypeDetail;
2007         wxString PropertyData;
2008         wxString PropertyName;
2009         wxString PropertyValue;
2010         wxString PropertyTokens;
2011         
2012         std::map<int,int> TypeSplitPoints;
2013         std::map<int,int> TypeSplitLength;
2014         std::map<int,int>::iterator TSLiter;
2015         
2016         int intSplitSize = 0;
2017         int intSplitsFound = 0;
2018         int intSplitPoint = 0;
2019         int intType = 0;
2020         int intPrevValue = 5;
2021                 
2022         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2023         
2024         intPrevValue = 4;
2025         
2026         // Look for type before continuing.
2027         
2028         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2029         intiter != SplitPoints.end(); ++intiter){
2030         
2031                 SLiter = SplitLength.find(intiter->first);
2032         
2033                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2034                 
2035                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2036                 PropertyName = PropertyElement.GetNextToken();                          
2037                 PropertyValue = PropertyElement.GetNextToken();
2038                 
2039                 intPrevValue = intiter->second;
2041                 if (PropertyName == wxT("TYPE")){
2042                 
2043                         // Process each value in type and translate each
2044                         // part.
2045                 
2046                         // Strip out the quotes if they are there.
2047                 
2048                         size_t intPropertyValueLen = PropertyValue.Len();
2049                 
2050                         if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2051                         
2052                                 PropertyValue.Trim();
2053                                 PropertyValue.RemoveLast();
2054                         
2055                         }                               
2056                 
2057                         if (PropertyValue.Mid(0, 1) == wxT("\"")){
2058                         
2059                                 PropertyValue.Remove(0, 1);
2060                         
2061                         }
2062                         
2063                         TelTypeDetail = PropertyValue;
2064                         
2065                         intSplitSize = 0;
2066                         intSplitsFound = 0;
2067                         intSplitPoint = 0;
2068                         
2069                         for (int i = 0; i <= intPropertyValueLen; i++){
2070         
2071                                 intSplitSize++;
2072         
2073                                 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2074         
2075                                         if (intSplitsFound == 0){
2077                                                 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2078                                                 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2079                         
2080                                         } else {
2081                         
2082                                                 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2083                                                 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2084                         
2085                                         }                       
2087                                         intSplitsFound++;
2088                                         i++;
2089                                         intSplitPoint = i;
2090                                         intSplitSize = 0;
2091         
2092                                 }
2093         
2094                         }
2095                         
2096                         TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2097                         TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));                                                           
2098                 
2099                         int intTypeSeek = 0;
2100                 
2101                         for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin(); 
2102                         typeiter != TypeSplitPoints.end(); ++typeiter){
2103                         
2104                                 wxString TypePropertyName;
2105                                 
2106                                 TSLiter = TypeSplitLength.find(typeiter->first);
2107                                 
2108                                 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2109                                 
2110                                 if (intTypeSeek == 0){
2111                                 
2112                                 
2113                                 } else {
2114                                                                                 
2115                                         TelTypeUI.Append(wxT(","));                                                     
2116                                 
2117                                 }
2118                         
2119                                 if (TypePropertyName == wxT("home")){
2120                                 
2121                                         PropType = PROPERTY_HOME;
2122                                 
2123                                 } else if (TypePropertyName == wxT("work")){
2124                                 
2125                                         PropType = PROPERTY_WORK;
2126                                                                         
2127                                 }
2128                                 
2129                                 
2130                                 if (TypePropertyName == wxT("text")){
2131                                 
2132                                         TelTypeUI.Append(_("text"));
2133                                         intTypeSeek++;
2134                                 
2135                                 } else if (TypePropertyName == wxT("voice")){
2136                                 
2137                                         TelTypeUI.Append(_("voice"));
2138                                         intTypeSeek++;
2139                                 
2140                                 } else if (TypePropertyName == wxT("fax")){
2141                                 
2142                                         TelTypeUI.Append(_("fax"));
2143                                         intTypeSeek++;
2144                                 
2145                                 } else if (TypePropertyName == wxT("cell")){
2146                                 
2147                                         TelTypeUI.Append(_("mobile"));
2148                                         intTypeSeek++;
2149                                 
2150                                 } else if (TypePropertyName == wxT("video")){
2151                                 
2152                                         TelTypeUI.Append(_("video"));
2153                                         intTypeSeek++;
2154                                 
2155                                 } else if (TypePropertyName == wxT("pager")){
2156                                 
2157                                         TelTypeUI.Append(_("pager"));
2158                                         intTypeSeek++;
2159                                 
2160                                 } else if (TypePropertyName == wxT("textphone")){
2161                                 
2162                                         TelTypeUI.Append(_("textphone"));
2163                                         intTypeSeek++;
2164                                 
2165                                 }
2166                         
2167                         }
2168                 
2169                 }
2170                 
2171         }
2172         
2173         std::map<int, wxString> *TelephoneList = NULL;
2174         std::map<int, wxString> *TelephoneListType = NULL;
2175         std::map<int, wxString> *TelephoneListAltID = NULL;
2176         std::map<int, wxString> *TelephoneListPID = NULL;
2177         std::map<int, wxString> *TelephoneListTokens = NULL;
2178         std::map<int, wxString> *TelephoneListTypeInfo = NULL;  
2179         std::map<int, int> *TelephoneListPref = NULL;
2181         switch(PropType){
2182                 case PROPERTY_NONE:
2183                         TelephoneList = &GeneralTelephoneList;
2184                         TelephoneListType = &GeneralTelephoneListType;
2185                         TelephoneListAltID = &GeneralTelephoneListAltID;
2186                         TelephoneListPID = &GeneralTelephoneListPID;
2187                         TelephoneListTokens = &GeneralTelephoneListTokens;
2188                         TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2189                         TelephoneListPref = &GeneralTelephoneListPref;  
2190                         break;
2191                 case PROPERTY_HOME:
2192                         TelephoneList = &HomeTelephoneList;
2193                         TelephoneListType = &HomeTelephoneListType;
2194                         TelephoneListAltID = &HomeTelephoneListAltID;
2195                         TelephoneListPID = &HomeTelephoneListPID;
2196                         TelephoneListTokens = &HomeTelephoneListTokens;
2197                         TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;     
2198                         TelephoneListPref = &HomeTelephoneListPref;     
2199                         break;
2200                 case PROPERTY_WORK:
2201                         TelephoneList = &BusinessTelephoneList;
2202                         TelephoneListType = &BusinessTelephoneListType;
2203                         TelephoneListAltID = &BusinessTelephoneListAltID;
2204                         TelephoneListPID = &BusinessTelephoneListPID;
2205                         TelephoneListTokens = &BusinessTelephoneListTokens;     
2206                         TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo; 
2207                         TelephoneListPref = &BusinessTelephoneListPref; 
2208                         break;
2209         }
2210                 
2211         // Process the properties.
2212         
2213         bool FirstToken = TRUE;
2214         
2215         intPrevValue = 5;
2216         SplitPoints.clear();
2217         SplitLength.clear();
2219         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2221         intPrevValue = 4;
2222         
2223         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2224         intiter != SplitPoints.end(); ++intiter){
2225         
2226                 SLiter = SplitLength.find(intiter->first);
2227         
2228                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2229                 
2230                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2231                 PropertyName = PropertyElement.GetNextToken();                          
2232                 PropertyValue = PropertyElement.GetNextToken();
2233                 
2234                 intPrevValue = intiter->second;
2235                 
2236                 CaptureString(&PropertyValue, FALSE);
2237                 
2238                 // Process properties.
2239                 
2240                 if (PropertyName == wxT("ALTID")){
2242                         TelephoneListAltID->erase(*TelephoneCount);
2243                         TelephoneListAltID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2244                 
2245                 } else if (PropertyName == wxT("PID")){
2247                         TelephoneListPID->erase(*TelephoneCount);
2248                         TelephoneListPID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2249                 
2250                 } else if (PropertyName == wxT("PREF")){
2251                         
2252                         int PriorityNumber = 0;
2253                         bool ValidNumber = TRUE;
2254                         
2255                         try{
2256                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2257                         }
2258                         
2259                         catch(std::invalid_argument &e){
2260                                 ValidNumber = FALSE;
2261                         }
2263                         if (ValidNumber == TRUE){
2265                                 TelephoneListPref->erase(*TelephoneCount);
2266                                 TelephoneListPref->insert(std::make_pair(*TelephoneCount, PriorityNumber));
2268                         }
2269                 
2270                 } else {
2271                 
2272                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2273                         
2274                                 if (FirstToken == TRUE){
2275                                 
2276                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2277                                         FirstToken = FALSE;
2278                                 
2279                                 } else {
2280                                 
2281                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2282                                 
2283                                 }
2284                         
2285                         }
2286                 
2287                 }
2288         
2289         }
2290                 
2291         TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2292         TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2293         
2294         // Add the name token data.
2295         
2296         if (!PropertyTokens.IsEmpty()){
2297         
2298                 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2299         
2300         }
2304 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2306         std::map<int, int> SplitPoints;
2307         std::map<int, int> SplitLength;
2309         int intPrevValue = 6;
2310         int intPref = 0;                        
2311         
2312         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2313         
2314         intPrevValue = 5;
2315         
2316         PropertyType PropType = PROPERTY_NONE;
2317                 
2318         // Look for type before continuing.
2319         
2320         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2321         
2322         std::map<int, wxString> *LanguageList = NULL;
2323         std::map<int, wxString> *LanguageListType = NULL;
2324         std::map<int, wxString> *LanguageListAltID = NULL;
2325         std::map<int, wxString> *LanguageListPID = NULL;
2326         std::map<int, wxString> *LanguageListTokens = NULL;
2327         std::map<int, int> *LanguageListPref = NULL;
2329         switch(PropType){
2330                 case PROPERTY_NONE:
2331                         LanguageList = &GeneralLanguageList;
2332                         LanguageListType = &GeneralLanguageListType;
2333                         LanguageListAltID = &GeneralLanguageListAltID;
2334                         LanguageListPID = &GeneralLanguageListPID;
2335                         LanguageListTokens = &GeneralLanguageListTokens;
2336                         LanguageListPref = &GeneralLanguageListPref;    
2337                         break;
2338                 case PROPERTY_HOME:
2339                         LanguageList = &HomeLanguageList;
2340                         LanguageListType = &HomeLanguageListType;
2341                         LanguageListAltID = &HomeLanguageListAltID;
2342                         LanguageListPID = &HomeLanguageListPID;
2343                         LanguageListTokens = &HomeLanguageListTokens;   
2344                         LanguageListPref = &HomeLanguageListPref;       
2345                         break;
2346                 case PROPERTY_WORK:
2347                         LanguageList = &BusinessLanguageList;
2348                         LanguageListType = &BusinessLanguageListType;
2349                         LanguageListAltID = &BusinessLanguageListAltID;
2350                         LanguageListPID = &BusinessLanguageListPID;
2351                         LanguageListTokens = &BusinessLanguageListTokens;       
2352                         LanguageListPref = &BusinessLanguageListPref;
2353                         break;
2354         }
2355         
2356         intPrevValue = 5;
2357         
2358         std::map<int,int>::iterator SLiter;
2359         wxString PropertyData;
2360         wxString PropertyName;
2361         wxString PropertyValue;
2362         wxString PropertyTokens;
2363         bool FirstToken = TRUE;
2364         
2365         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2366         intiter != SplitPoints.end(); ++intiter){
2367         
2368                 SLiter = SplitLength.find(intiter->first);
2369         
2370                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2371                 
2372                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2373                 PropertyName = PropertyElement.GetNextToken();                          
2374                 PropertyValue = PropertyElement.GetNextToken();
2375                 
2376                 intPrevValue = intiter->second;
2377                 
2378                 CaptureString(&PropertyValue, FALSE);
2379                 
2380                 // Process properties.
2381                 
2382                 if (PropertyName == wxT("ALTID")){
2384                         LanguageListAltID->erase(*LanguageCount);
2385                         LanguageListAltID->insert(std::make_pair(*LanguageCount, PropertyValue));
2386                 
2387                 } else if (PropertyName == wxT("PID")){
2389                         LanguageListPID->erase(*LanguageCount);
2390                         LanguageListPID->insert(std::make_pair(*LanguageCount, PropertyValue));
2391                 
2392                 } else if (PropertyName == wxT("PREF")){
2393                         
2394                         int PriorityNumber = 0;
2395                         bool ValidNumber = TRUE;
2396                         
2397                         try{
2398                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2399                         }
2400                         
2401                         catch(std::invalid_argument &e){
2402                                 ValidNumber = FALSE;
2403                         }
2405                         if (ValidNumber == TRUE){
2407                                 LanguageListPref->erase(*LanguageCount);
2408                                 LanguageListPref->insert(std::make_pair(*LanguageCount, PriorityNumber));
2410                         }
2411                 
2412                 } else {
2413                 
2414                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2415                         
2416                                 if (FirstToken == TRUE){
2417                                 
2418                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2419                                         FirstToken = FALSE;
2420                                 
2421                                 } else {
2422                                 
2423                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2424                                 
2425                                 }
2426                         
2427                         }
2428                 
2429                 }
2430         
2431         }
2432                 
2433         LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2434         
2435         // Add the name token data.
2436         
2437         if (!PropertyTokens.IsEmpty()){
2438         
2439                 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2440         
2441         }
2445 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2447         std::map<int, int> SplitPoints;
2448         std::map<int, int> SplitLength;
2450         int intPrevValue = 5;
2451         int intPref = 0;                        
2452         
2453         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2454         
2455         intPrevValue = 4;
2456         
2457         PropertyType PropType = PROPERTY_NONE;
2458                 
2459         // Look for type before continuing.
2460         
2461         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2462         
2463         std::map<int, wxString> *GeopositionList = NULL;
2464         std::map<int, wxString> *GeopositionListType = NULL;
2465         std::map<int, wxString> *GeopositionListAltID = NULL;
2466         std::map<int, wxString> *GeopositionListPID = NULL;
2467         std::map<int, wxString> *GeopositionListTokens = NULL;
2468         std::map<int, wxString> *GeopositionListMediatype = NULL;
2469         std::map<int, int> *GeopositionListPref = NULL;
2471         switch(PropType){
2472                 case PROPERTY_NONE:
2473                         GeopositionList = &GeneralGeographyList;
2474                         GeopositionListType = &GeneralGeographyListType;
2475                         GeopositionListAltID = &GeneralGeographyListAltID;
2476                         GeopositionListPID = &GeneralGeographyListPID;
2477                         GeopositionListTokens = &GeneralGeographyListTokens;
2478                         GeopositionListMediatype = &GeneralGeographyListMediatype;
2479                         GeopositionListPref = &GeneralGeographyListPref;        
2480                         break;
2481                 case PROPERTY_HOME:
2482                         GeopositionList = &HomeGeographyList;
2483                         GeopositionListType = &HomeGeographyListType;
2484                         GeopositionListAltID = &HomeGeographyListAltID;
2485                         GeopositionListPID = &HomeGeographyListPID;
2486                         GeopositionListTokens = &HomeGeographyListTokens;
2487                         GeopositionListMediatype = &HomeGeographyListMediatype;
2488                         GeopositionListPref = &HomeGeographyListPref;   
2489                         break;
2490                 case PROPERTY_WORK:
2491                         GeopositionList = &BusinessGeographyList;
2492                         GeopositionListType = &BusinessGeographyListType;
2493                         GeopositionListAltID = &BusinessGeographyListAltID;
2494                         GeopositionListPID = &BusinessGeographyListPID;
2495                         GeopositionListTokens = &BusinessGeographyListTokens;
2496                         GeopositionListMediatype = &BusinessGeographyListMediatype;     
2497                         GeopositionListPref = &BusinessGeographyListPref;
2498                         break;
2499         }
2500         
2501         intPrevValue = 4;
2502         
2503         std::map<int,int>::iterator SLiter;
2504         wxString PropertyData;
2505         wxString PropertyName;
2506         wxString PropertyValue;
2507         wxString PropertyTokens;
2508         bool FirstToken = TRUE;
2509         
2510         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2511         intiter != SplitPoints.end(); ++intiter){
2512         
2513                 SLiter = SplitLength.find(intiter->first);
2514         
2515                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2516                 
2517                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2518                 PropertyName = PropertyElement.GetNextToken();                          
2519                 PropertyValue = PropertyElement.GetNextToken();
2520                 
2521                 intPrevValue = intiter->second;
2522                 
2523                 CaptureString(&PropertyValue, FALSE);
2524                 
2525                 // Process properties.
2526                 
2527                 if (PropertyName == wxT("ALTID")){
2529                         GeopositionListAltID->erase(*GeographicCount);
2530                         GeopositionListAltID->insert(std::make_pair(*GeographicCount, PropertyValue));
2531                 
2532                 } else if (PropertyName == wxT("PID")){
2534                         GeopositionListPID->erase(*GeographicCount);
2535                         GeopositionListPID->insert(std::make_pair(*GeographicCount, PropertyValue));
2536                 
2537                 } else if (PropertyName == wxT("MEDIATYPE")){
2539                         GeopositionListMediatype->erase(*GeographicCount);
2540                         GeopositionListMediatype->insert(std::make_pair(*GeographicCount, PropertyValue));
2541                 
2542                 } else if (PropertyName == wxT("PREF")){
2543                         
2544                         int PriorityNumber = 0;
2545                         bool ValidNumber = TRUE;
2546                         
2547                         try{
2548                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2549                         }
2550                         
2551                         catch(std::invalid_argument &e){
2552                                 ValidNumber = FALSE;
2553                         }
2555                         if (ValidNumber == TRUE){
2557                                 GeopositionListPref->erase(*GeographicCount);
2558                                 GeopositionListPref->insert(std::make_pair(*GeographicCount, PriorityNumber));
2560                         }
2561                 
2562                 } else {
2563                 
2564                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2565                         
2566                                 if (FirstToken == TRUE){
2567                                 
2568                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2569                                         FirstToken = FALSE;
2570                                 
2571                                 } else {
2572                                 
2573                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2574                                 
2575                                 }
2576                         
2577                         }
2578                 
2579                 }
2580         
2581         }
2582                 
2583         GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2584         
2585         // Add the name token data.
2586         
2587         if (!PropertyTokens.IsEmpty()){
2588         
2589                 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2590         
2591         }
2595 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2597         size_t intPropertyLen = PropertySeg1.Len();
2598         std::map<int, int> SplitPoints;
2599         std::map<int, int> SplitLength;
2600         std::map<int, int>::iterator SLiter;                    
2601         wxString PropertyData;
2602         wxString PropertyName;
2603         wxString PropertyValue;
2604         wxString PropertyTokens;
2605         wxString RelatedType;
2606         wxString RelatedTypeOriginal;                   
2607         wxString RelatedName;
2608         bool FirstToken = TRUE;                 
2609         int intSplitsFound = 0;
2610         int intSplitSize = 0;
2611         int intPrevValue = 9;
2612         int intPref = 0;
2613         long ListCtrlIndex;
2614         
2615         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2616         
2617         intPrevValue = 8;
2618         
2619         // Look for type before continuing.
2620         
2621         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2622         intiter != SplitPoints.end(); ++intiter){
2623         
2624                 SLiter = SplitLength.find(intiter->first);
2625         
2626                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2627                 
2628                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2629                 PropertyName = PropertyElement.GetNextToken();                          
2630                 PropertyValue = PropertyElement.GetNextToken();
2631                 
2632                 intPrevValue = intiter->second;
2633                 
2634                 // Process these.
2635                 
2636                 RelatedTypeOriginal = PropertyValue;
2637                 
2638                 if (PropertyName == wxT("TYPE")){
2639                 
2640                         if (PropertyValue == wxT("contact")){
2642                                 RelatedType = _("Contact");
2644                         } else if (PropertyValue == wxT("acquaintance")){
2646                                 RelatedType = _("Acquaintance");
2648                         } else if (PropertyValue == wxT("friend")){
2650                                 RelatedType = _("Friend");
2652                         } else if (PropertyValue == wxT("met")){
2654                                 RelatedType = _("Met");
2656                         } else if (PropertyValue == wxT("co-worker")){
2658                                 RelatedType = _("Co-worker");
2660                         } else if (PropertyValue == wxT("colleague")){
2662                                 RelatedType = _("Colleague");
2664                         } else if (PropertyValue == wxT("co-resident")){
2666                                 RelatedType = _("Co-resident");
2668                         } else if (PropertyValue == wxT("neighbor")){
2670                                 RelatedType = _("Neighbour");
2672                         } else if (PropertyValue == wxT("child")){
2674                                 RelatedType = _("Child");
2676                         } else if (PropertyValue == wxT("parent")){
2678                                 RelatedType = _("Parent");
2680                         } else if (PropertyValue == wxT("sibling")){
2682                                 RelatedType = _("Sibling");
2684                         } else if (PropertyValue == wxT("spouse")){
2686                                 RelatedType = _("Spouse");
2688                         } else if (PropertyValue == wxT("kin")){
2690                                 RelatedType = _("Kin");
2692                         } else if (PropertyValue == wxT("muse")){
2694                                 RelatedType = _("Muse");
2696                         } else if (PropertyValue == wxT("crush")){
2698                                 RelatedType = _("Crush");
2700                         } else if (PropertyValue == wxT("date")){
2702                                 RelatedType = _("Date");
2704                         } else if (PropertyValue == wxT("sweetheart")){
2706                                 RelatedType = _("Sweetheart");
2708                         } else if (PropertyValue == wxT("me")){
2710                                 RelatedType = _("Me");
2712                         } else if (PropertyValue == wxT("agent")){
2714                                 RelatedType = _("Agent");
2716                         } else if (PropertyValue == wxT("emergency")){
2718                                 RelatedType = _("Emergency");
2720                         } else {
2722                                 RelatedType = PropertyValue;
2724                         }
2725                 
2726                 }
2727         
2728         }
2729         
2730         intPrevValue = 8;                       
2731         
2732         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2733         intiter != SplitPoints.end(); ++intiter){
2734         
2735                 SLiter = SplitLength.find(intiter->first);
2736         
2737                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2738                 
2739                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2740                 PropertyName = PropertyElement.GetNextToken();                          
2741                 PropertyValue = PropertyElement.GetNextToken();
2742                 
2743                 intPrevValue = intiter->second;
2744                 
2745                 // Process properties.
2746                 
2747                 size_t intPropertyValueLen = PropertyValue.Len();
2748                 
2749                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2750                         
2751                         PropertyValue.Trim();
2752                         PropertyValue.RemoveLast();
2753                         
2754                 }                               
2755                 
2756                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2757                         
2758                         PropertyValue.Remove(0, 1);
2759                         
2760                 }
2761                 
2762                 CaptureString(&PropertyValue, FALSE);
2763                         
2764                 if (PropertyName == wxT("ALTID")){
2766                         GeneralRelatedListAltID.erase(*RelatedCount);
2767                         GeneralRelatedListAltID.insert(std::make_pair(*RelatedCount, PropertyValue));
2768                 
2769                 } else if (PropertyName == wxT("PID")){
2771                         GeneralRelatedListPID.erase(*RelatedCount);
2772                         GeneralRelatedListPID.insert(std::make_pair(*RelatedCount, PropertyValue));
2773                 
2774                 } else if (PropertyName == wxT("PREF")){
2775                         
2776                         int PriorityNumber = 0;
2777                         bool ValidNumber = TRUE;
2778                         
2779                         try{
2780                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2781                         }
2782                         
2783                         catch(std::invalid_argument &e){
2784                                 ValidNumber = FALSE;
2785                         }
2787                         if (ValidNumber == TRUE){
2789                                 GeneralRelatedListPref.erase(*RelatedCount);
2790                                 GeneralRelatedListPref.insert(std::make_pair(*RelatedCount, PriorityNumber));
2792                         }
2793                 
2794                 } else if (PropertyName == wxT("LANGUAGE")){
2795                 
2796                         GeneralRelatedListLanguage.erase(*RelatedCount);
2797                         GeneralRelatedListLanguage.insert(std::make_pair(*RelatedCount, PropertyValue));
2798                 
2799                 } else if (PropertyName != wxT("TYPE")) {
2800                 
2801                         // Something else we don't know about so append
2802                         // to the tokens variable.
2803                 
2804                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2805                 
2806                                 if (FirstToken == TRUE){
2807                         
2808                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2809                                         FirstToken = FALSE;
2810                         
2811                                 } else {
2812                         
2813                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2814                         
2815                                 }
2816                 
2817                         }
2818                 
2819                 }
2820         
2821         }                                       
2822         
2823         // Add the data to the General/Home/Work address variables.
2824                                 
2825         GeneralRelatedList.erase(*RelatedCount);
2826         GeneralRelatedListRelType.erase(*RelatedCount);
2827         GeneralRelatedListType.erase(*RelatedCount);
2828         GeneralRelatedListTokens.erase(*RelatedCount);
2829         GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2830         GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));                   
2831         GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2832         GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2836 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2838         std::map<int, int> SplitPoints;
2839         std::map<int, int> SplitLength;
2840         std::map<int, int>::iterator SLiter;                    
2841         wxString PropertyData;
2842         wxString PropertyName;
2843         wxString PropertyValue;
2844         wxString PropertyTokens;
2845         bool FirstToken = TRUE;
2846         int intPrevValue = 5;
2847         int intPref = 0;                        
2848         int intType = 0;
2849         long ListCtrlIndex;
2850         
2851         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2852         
2853         intPrevValue = 4;
2854         
2855         PropertyType PropType = PROPERTY_NONE;
2856                 
2857         // Look for type before continuing.
2858         
2859         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2860         
2861         // Setup the pointers.
2862         
2863         std::map<int, wxString> *WebsiteList = NULL;
2864         std::map<int, wxString> *WebsiteListAltID = NULL;
2865         std::map<int, wxString> *WebsiteListPID = NULL;
2866         std::map<int, wxString> *WebsiteListType = NULL;
2867         std::map<int, wxString> *WebsiteListTokens = NULL;
2868         std::map<int, wxString> *WebsiteListMediatype = NULL;
2869         std::map<int, int> *WebsiteListPref = NULL;
2870         
2871         // Setup blank lines for later on.
2872         
2873         switch(PropType){
2874                 case PROPERTY_NONE:
2875                         WebsiteList = &GeneralWebsiteList;
2876                         WebsiteListType = &GeneralWebsiteListType;
2877                         WebsiteListAltID = &GeneralWebsiteListAltID;
2878                         WebsiteListPID = &GeneralWebsiteListPID;
2879                         WebsiteListTokens = &GeneralWebsiteListTokens;
2880                         WebsiteListMediatype = &GeneralWebsiteListMediatype;
2881                         WebsiteListPref = &GeneralWebsiteListPref;      
2882                         break;
2883                 case PROPERTY_HOME:
2884                         WebsiteList = &HomeWebsiteList;
2885                         WebsiteListType = &HomeWebsiteListType;
2886                         WebsiteListAltID = &HomeWebsiteListAltID;
2887                         WebsiteListPID = &HomeWebsiteListPID;
2888                         WebsiteListTokens = &HomeWebsiteListTokens;
2889                         WebsiteListMediatype = &HomeWebsiteListMediatype;
2890                         WebsiteListPref = &HomeWebsiteListPref; 
2891                         break;
2892                 case PROPERTY_WORK:
2893                         WebsiteList = &BusinessWebsiteList;
2894                         WebsiteListType = &BusinessWebsiteListType;
2895                         WebsiteListAltID = &BusinessWebsiteListAltID;
2896                         WebsiteListPID = &BusinessWebsiteListPID;
2897                         WebsiteListTokens = &BusinessWebsiteListTokens;
2898                         WebsiteListMediatype = &BusinessWebsiteListMediatype;   
2899                         WebsiteListPref = &BusinessWebsiteListPref;
2900                         break;
2901         }
2902         
2903         intPrevValue = 4;
2904         
2905         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2906         intiter != SplitPoints.end(); ++intiter){
2907         
2908                 SLiter = SplitLength.find(intiter->first);
2909         
2910                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2911                 
2912                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2913                 PropertyName = PropertyElement.GetNextToken();                          
2914                 PropertyValue = PropertyElement.GetNextToken();
2915                 
2916                 intPrevValue = intiter->second;
2917                 
2918                 // Process properties.
2919                 
2920                 size_t intPropertyValueLen = PropertyValue.Len();
2921                 
2922                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2923                         
2924                         PropertyValue.Trim();
2925                         PropertyValue.RemoveLast();
2926                         
2927                 }                               
2928                 
2929                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2930                         
2931                         PropertyValue.Remove(0, 1);
2932                         
2933                 }
2934                 
2935                 CaptureString(&PropertyValue, FALSE);
2936                 
2937                 if (PropertyName == wxT("ALTID")){
2939                         WebsiteListAltID->erase(*URLCount);
2940                         WebsiteListAltID->insert(std::make_pair(*URLCount, PropertyValue));
2941                 
2942                 } else if (PropertyName == wxT("PID")){
2944                         WebsiteListPID->erase(*URLCount);
2945                         WebsiteListPID->insert(std::make_pair(*URLCount, PropertyValue));
2946                         
2947                 } else if (PropertyName == wxT("PREF")){
2948                         
2949                         int PriorityNumber = 0;
2950                         bool ValidNumber = TRUE;
2951                         
2952                         try{
2953                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
2954                         }
2955                         
2956                         catch(std::invalid_argument &e){
2957                                 ValidNumber = FALSE;
2958                         }
2960                         if (ValidNumber == TRUE){
2962                                 WebsiteListPref->erase(*URLCount);
2963                                 WebsiteListPref->insert(std::make_pair(*URLCount, PriorityNumber));
2965                         }
2966                                         
2967                 } else if (PropertyName == wxT("MEDIATYPE")){
2968                 
2969                         WebsiteListMediatype->erase(*URLCount);
2970                         WebsiteListMediatype->insert(std::make_pair(*URLCount, PropertyValue));
2971                 
2972                 } else {
2973                 
2974                         // Something else we don't know about so append
2975                         // to the tokens variable.
2976                 
2977                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2978                 
2979                                 if (FirstToken == TRUE){
2980                         
2981                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2982                                         FirstToken = FALSE;
2983                         
2984                                 } else {
2985                         
2986                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2987                         
2988                                 }
2989                 
2990                         }
2991                 
2992                 }
2993         
2994         }
2995         
2996         // Add the data to the General/Home/Work address variables.
2997         
2998         CaptureString(&PropertySeg2, FALSE);
2999                         
3000         WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3001         
3002         if (!PropertyTokens.IsEmpty()){
3003         
3004                 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3005                         
3006         }
3007         
3010 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3012         std::map<int, int> SplitPoints;
3013         std::map<int, int> SplitLength;
3014         std::map<int, int>::iterator SLiter;                    
3015         wxString PropertyData;
3016         wxString PropertyName;
3017         wxString PropertyValue;
3018         wxString PropertyTokens;
3019         bool FirstToken = TRUE;
3020         int intPrevValue = 7;
3021         int intPref = 0;                        
3022         int intType = 0;
3023         long ListCtrlIndex;
3024         
3025         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3026         
3027         intPrevValue = 6;
3028         
3029         PropertyType PropType = PROPERTY_NONE;
3030                 
3031         // Look for type before continuing.
3032         
3033         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3034         
3035         // Setup the pointers.
3036         
3037         std::map<int, wxString> *TitleList = NULL;
3038         std::map<int, wxString> *TitleListAltID = NULL;
3039         std::map<int, wxString> *TitleListPID = NULL;
3040         std::map<int, wxString> *TitleListType = NULL;
3041         std::map<int, wxString> *TitleListTokens = NULL;
3042         std::map<int, wxString> *TitleListLanguage = NULL;
3043         std::map<int, int> *TitleListPref = NULL;
3044         
3045         // Setup blank lines for later on.
3046         
3047         switch(PropType){
3048                 case PROPERTY_NONE:
3049                         TitleList = &GeneralTitleList;
3050                         TitleListType = &GeneralTitleListType;
3051                         TitleListAltID = &GeneralTitleListAltID;
3052                         TitleListPID = &GeneralTitleListPID;
3053                         TitleListTokens = &GeneralTitleListTokens;
3054                         TitleListLanguage = &GeneralTitleListLanguage;
3055                         TitleListPref = &GeneralTitleListPref;  
3056                         break;
3057                 case PROPERTY_HOME:
3058                         TitleList = &HomeTitleList;
3059                         TitleListType = &HomeTitleListType;
3060                         TitleListAltID = &HomeTitleListAltID;
3061                         TitleListPID = &HomeTitleListPID;
3062                         TitleListTokens = &HomeTitleListTokens;
3063                         TitleListLanguage = &HomeTitleListLanguage;
3064                         TitleListPref = &HomeTitleListPref;     
3065                         break;
3066                 case PROPERTY_WORK:
3067                         TitleList = &BusinessTitleList;
3068                         TitleListType = &BusinessTitleListType;
3069                         TitleListAltID = &BusinessTitleListAltID;
3070                         TitleListPID = &BusinessTitleListPID;
3071                         TitleListTokens = &BusinessTitleListTokens;
3072                         TitleListLanguage = &BusinessTitleListLanguage; 
3073                         TitleListPref = &BusinessTitleListPref;
3074                         break;
3075         }
3077         intPrevValue = 6;
3078                 
3079         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3080         intiter != SplitPoints.end(); ++intiter){
3081         
3082                 SLiter = SplitLength.find(intiter->first);
3083         
3084                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3085                 
3086                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3087                 PropertyName = PropertyElement.GetNextToken();                          
3088                 PropertyValue = PropertyElement.GetNextToken();
3089                 
3090                 intPrevValue = intiter->second;
3091                 
3092                 // Process properties.
3093                 
3094                 size_t intPropertyValueLen = PropertyValue.Len();
3095                 
3096                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3097                         
3098                         PropertyValue.Trim();
3099                         PropertyValue.RemoveLast();
3100                         
3101                 }                               
3102                 
3103                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3104                         
3105                         PropertyValue.Remove(0, 1);
3106                         
3107                 }                               
3108                 
3109                 CaptureString(&PropertyValue, FALSE);
3110                 
3111                 if (PropertyName == wxT("ALTID")){
3112                 
3113                         TitleListAltID->erase(*TitleCount);
3114                         TitleListAltID->insert(std::make_pair(*TitleCount, PropertyValue));
3115                 
3116                 } else if (PropertyName == wxT("PID")){
3118                         TitleListPID->erase(*TitleCount);
3119                         TitleListPID->insert(std::make_pair(*TitleCount, PropertyValue));
3120                 
3121                 } else if (PropertyName == wxT("PREF")){
3122                                 
3123                         int PriorityNumber = 0;
3124                         bool ValidNumber = TRUE;
3125                         
3126                         try{
3127                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3128                         }
3129                         
3130                         catch(std::invalid_argument &e){
3131                                 ValidNumber = FALSE;
3132                         }
3134                         if (ValidNumber == TRUE){
3136                                 TitleListPref->erase(*TitleCount);
3137                                 TitleListPref->insert(std::make_pair(*TitleCount, PriorityNumber));
3139                         }
3140                                         
3141                 } else if (PropertyName == wxT("LANGUAGE")){
3142                 
3143                         TitleListLanguage->erase(*TitleCount);
3144                         TitleListLanguage->insert(std::make_pair(*TitleCount, PropertyValue));
3145                 
3146                 } else {
3147                 
3148                         // Something else we don't know about so append
3149                         // to the tokens variable.
3150                 
3151                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3152                 
3153                                 if (FirstToken == TRUE){
3154                         
3155                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3156                                         FirstToken = FALSE;
3157                         
3158                                 } else {
3159                         
3160                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3161                         
3162                                 }
3163                 
3164                         }
3165                 
3166                 }
3167         
3168         }
3169         
3170         // Add the data to the General/Home/Work address variables.
3171         
3172         CaptureString(&PropertySeg2, FALSE);
3174         TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3175         
3176         if (!PropertyTokens.IsEmpty()){
3177         
3178                 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3179                         
3180         }
3184 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3186         std::map<int, int> SplitPoints;
3187         std::map<int, int> SplitLength;
3188         std::map<int, int>::iterator SLiter;                    
3189         wxString PropertyData;
3190         wxString PropertyName;
3191         wxString PropertyValue;
3192         wxString PropertyTokens;
3193         bool FirstToken = TRUE;
3194         int intPrevValue = 6;
3195         int intPref = 0;                        
3196         int intType = 0;
3197         long ListCtrlIndex;
3198         
3199         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3200         
3201         intPrevValue = 5;
3202         
3203         PropertyType PropType = PROPERTY_NONE;
3204                 
3205         // Look for type before continuing.
3206         
3207         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3208         
3209         // Setup the pointers.
3210         
3211         std::map<int, wxString> *RoleList = NULL;
3212         std::map<int, wxString> *RoleListAltID = NULL;
3213         std::map<int, wxString> *RoleListPID = NULL;
3214         std::map<int, wxString> *RoleListType = NULL;
3215         std::map<int, wxString> *RoleListTokens = NULL;
3216         std::map<int, wxString> *RoleListLanguage = NULL;
3217         std::map<int, int> *RoleListPref = NULL;
3218         
3219         // Setup blank lines for later on.
3220         
3221         switch(PropType){
3222                 case PROPERTY_NONE:
3223                         RoleList = &GeneralRoleList;
3224                         RoleListType = &GeneralRoleListType;
3225                         RoleListAltID = &GeneralRoleListAltID;
3226                         RoleListPID = &GeneralRoleListPID;
3227                         RoleListTokens = &GeneralRoleListTokens;
3228                         RoleListLanguage = &GeneralRoleListLanguage;
3229                         RoleListPref = &GeneralRoleListPref;    
3230                         break;
3231                 case PROPERTY_HOME:
3232                         RoleList = &HomeRoleList;
3233                         RoleListType = &HomeRoleListType;
3234                         RoleListAltID = &HomeRoleListAltID;
3235                         RoleListPID = &HomeRoleListPID;
3236                         RoleListTokens = &HomeRoleListTokens;
3237                         RoleListLanguage = &HomeRoleListLanguage;
3238                         RoleListPref = &HomeRoleListPref;       
3239                         break;
3240                 case PROPERTY_WORK:
3241                         RoleList = &BusinessRoleList;
3242                         RoleListType = &BusinessRoleListType;
3243                         RoleListAltID = &BusinessRoleListAltID;
3244                         RoleListPID = &BusinessRoleListPID;
3245                         RoleListTokens = &BusinessRoleListTokens;
3246                         RoleListLanguage = &BusinessRoleListLanguage;   
3247                         RoleListPref = &BusinessRoleListPref;
3248                         break;
3249         }
3251         intPrevValue = 5;
3252                 
3253         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3254         intiter != SplitPoints.end(); ++intiter){
3255         
3256                 SLiter = SplitLength.find(intiter->first);
3257         
3258                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3259                 
3260                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3261                 PropertyName = PropertyElement.GetNextToken();                          
3262                 PropertyValue = PropertyElement.GetNextToken();
3263                 
3264                 intPrevValue = intiter->second;
3265                 
3266                 // Process properties.
3267                 
3268                 size_t intPropertyValueLen = PropertyValue.Len();
3269                 
3270                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3271                         
3272                         PropertyValue.Trim();
3273                         PropertyValue.RemoveLast();
3274                         
3275                 }                               
3276                 
3277                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3278                         
3279                         PropertyValue.Remove(0, 1);
3280                         
3281                 }                               
3282                 
3283                 CaptureString(&PropertyValue, FALSE);
3284                 
3285                 if (PropertyName == wxT("ALTID")){
3286                 
3287                         RoleListAltID->erase(*RoleCount);
3288                         RoleListAltID->insert(std::make_pair(*RoleCount, PropertyValue));
3289                 
3290                 } else if (PropertyName == wxT("PID")){
3292                         RoleListPID->erase(*RoleCount);
3293                         RoleListPID->insert(std::make_pair(*RoleCount, PropertyValue));
3294                 
3295                 } else if (PropertyName == wxT("PREF")){
3296                                 
3297                         int PriorityNumber = 0;
3298                         bool ValidNumber = TRUE;
3299                         
3300                         try{
3301                                 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3302                         }
3303                         
3304                         catch(std::invalid_argument &e){
3305                                 ValidNumber = FALSE;
3306                         }
3308                         if (ValidNumber == TRUE){
3310                                 RoleListPref->erase(*RoleCount);
3311                                 RoleListPref->insert(std::make_pair(*RoleCount, PriorityNumber));
3313                         }
3314                                         
3315                 } else if (PropertyName == wxT("LANGUAGE")){
3316                 
3317                         RoleListLanguage->erase(*RoleCount);
3318                         RoleListLanguage->insert(std::make_pair(*RoleCount, PropertyValue));
3319                 
3320                 } else {
3321                 
3322                         // Something else we don't know about so append
3323                         // to the tokens variable.
3324                 
3325                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3326                 
3327                                 if (FirstToken == TRUE){
3328                         
3329                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3330                                         FirstToken = FALSE;
3331                         
3332                                 } else {
3333                         
3334                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3335                         
3336                                 }
3337                 
3338                         }
3339                 
3340                 }
3341         
3342         }
3343         
3344         // Add the data to the General/Home/Work address variables.
3345         
3346         CaptureString(&PropertySeg2, FALSE);
3348         RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3349         
3350         if (!PropertyTokens.IsEmpty()){
3351         
3352                 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3353                         
3354         }
3358 void SplitValues(wxString *PropertyLine, 
3359         std::map<int,int> *SplitPoints, 
3360         std::map<int,int> *SplitLength, 
3361         int intSize){
3362         
3363         size_t intPropertyLen = PropertyLine->Len();
3364         int intSplitsFound = 0;
3365         int intSplitSize = 0;
3366         int intSplitSeek = 0;
3367         
3368         for (int i = intSize; i <= intPropertyLen; i++){
3370                 intSplitSize++;
3371         
3372                 if (PropertyLine->Mid(i, 1) == wxT(";") &&
3373                     PropertyLine->Mid((i - 1), 1) != wxT("\\")){
3374            
3375                     if (intSplitsFound == 0){
3376             
3377                         SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
3378           
3379                     } else {
3380            
3381                         SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3382             
3383                     }
3384             
3385                     SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
3386             
3387                     intSplitsFound++;
3388                     intSplitSeek = i;
3389                     intSplitSize = 0;
3390             
3391                 }
3393         }
3395         if (intSplitsFound == 0){
3397                 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
3398                 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
3400         } else {
3402                 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3403                 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
3405         }
3409 void CheckType(wxString *PropertySeg1, 
3410         std::map<int,int> *SplitPoints, 
3411         std::map<int,int> *SplitLength, 
3412         int *intPrevValue, 
3413         PropertyType *PropType){
3414         
3415         wxString PropertyData;
3416         wxString PropertyName;
3417         wxString PropertyValue;
3418         std::map<int,int>::iterator SLiter;
3419         
3420         for (std::map<int, int>::iterator intiter = SplitPoints->begin(); 
3421         intiter != SplitPoints->end(); ++intiter){
3422         
3423                 SLiter = SplitLength->find(intiter->first);
3424         
3425                 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
3426                 
3427                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3428                 PropertyName = PropertyElement.GetNextToken();                          
3429                 PropertyValue = PropertyElement.GetNextToken();
3430                 
3431                 *intPrevValue = intiter->second;
3432                 
3433                 if (PropertyName == wxT("TYPE")){
3434                                 
3435                         if (PropertyValue == wxT("work")){
3436                         
3437                                 *PropType = PROPERTY_WORK;
3438                                                         
3439                         } else if (PropertyValue == wxT("home")){
3441                                 *PropType = PROPERTY_HOME;
3442                                                         
3443                         } else {
3444                         
3445                                 *PropType = PROPERTY_NONE;
3446                         
3447                         }
3448                 
3449                         return;
3450                 
3451                 }
3452         
3453         }
3454         
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy