From 13bfdba33b3d35b904317cfa675558d3a2b21bf6 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 28 Dec 2015 06:00:16 +0000 Subject: [PATCH] Implemented ProcessNameValue into ContactDataObject. --- source/contacteditor/ContactDataObject.cpp | 262 ++++----------------- 1 file changed, 40 insertions(+), 222 deletions(-) diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index 85b1320..26dae5b 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -484,13 +484,8 @@ void ContactDataObject::ProcessRevision(wxString PropertySeg1, wxString Property intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -566,9 +561,7 @@ void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySe PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; @@ -664,13 +657,8 @@ void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); @@ -715,13 +703,8 @@ void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySe intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); @@ -778,13 +761,8 @@ void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); @@ -853,13 +831,8 @@ void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){ intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); @@ -1000,13 +973,8 @@ void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString Prop intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -1099,13 +1067,8 @@ void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString Property intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); @@ -1158,13 +1121,8 @@ void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySe intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -1237,13 +1195,8 @@ void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString Property intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){ @@ -1265,13 +1218,8 @@ void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString Property intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -1350,13 +1298,8 @@ void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString Prope intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){ @@ -1378,13 +1321,8 @@ void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString Prope intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -1508,14 +1446,9 @@ void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString Property for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ - SLiter = SplitLength.find(intiter->first); - + SLiter = SplitLength.find(intiter->first); PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); @@ -1677,13 +1610,8 @@ void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertyS intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); @@ -1918,13 +1846,8 @@ void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); @@ -2029,13 +1952,8 @@ void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); @@ -2109,13 +2027,8 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ @@ -2306,13 +2219,8 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); @@ -2413,15 +2321,10 @@ void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString Property intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; - + CaptureString(&PropertyValue, FALSE); // Process properties. @@ -2523,13 +2426,8 @@ void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString Proper intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; CaptureString(&PropertyValue, FALSE); @@ -2594,13 +2492,8 @@ void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertyS intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process these. @@ -2707,13 +2600,8 @@ void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertyS intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -2838,13 +2726,8 @@ void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -2970,13 +2853,8 @@ void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -3102,13 +2980,8 @@ void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2 intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -3238,13 +3111,8 @@ void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString Prop intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -3371,13 +3239,8 @@ void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2 intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -3474,13 +3337,8 @@ void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString Property intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -3721,13 +3579,8 @@ void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -3896,13 +3749,8 @@ void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2 intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -4071,13 +3919,8 @@ void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -4247,13 +4090,8 @@ void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString Prope intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -4357,13 +4195,8 @@ void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxStrin intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -4467,13 +4300,8 @@ void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -4578,13 +4406,8 @@ void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); - PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); intPrevValue = intiter->second; // Process properties. @@ -4912,14 +4735,9 @@ void CheckType(wxString *PropertySeg1, for (std::map::iterator intiter = SplitPoints->begin(); intiter != SplitPoints->end(); ++intiter){ - SLiter = SplitLength->find(intiter->first); - + SLiter = SplitLength->find(intiter->first); PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second)); - - wxStringTokenizer PropertyElement (PropertyData, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - + ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); *intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ -- 2.39.5