From ad0e6e0d4a97c56cbd74e9ac616ca0573e08b942 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 28 Dec 2015 04:43:42 +0000 Subject: [PATCH] Replaced string processing in TITLE with ProcessStringValue. --- source/contacteditor/ContactDataObject.cpp | 47 ++++++++-------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index 323475c..546cd21 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -3199,6 +3199,7 @@ void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg } intPrevValue = 6; + bool PropertyMatched = FALSE; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ @@ -3232,45 +3233,31 @@ void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg CaptureString(&PropertyValue, FALSE); - if (PropertyName == wxT("ALTID")){ + ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched); + ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched); - TitleListAltID->erase(*TitleCount); - TitleListAltID->insert(std::make_pair(*TitleCount, PropertyValue)); + if (PropertyMatched == TRUE){ - } else if (PropertyName == wxT("PID")){ - - TitleListPID->erase(*TitleCount); - TitleListPID->insert(std::make_pair(*TitleCount, PropertyValue)); + PropertyMatched = FALSE; + continue; - } else if (PropertyName == wxT("PREF")){ + } - ProcessIntegerValue(TitleListPref, &PropertyValue, TitleCount); - - } else if (PropertyName == wxT("LANGUAGE")){ - - TitleListLanguage->erase(*TitleCount); - TitleListLanguage->insert(std::make_pair(*TitleCount, PropertyValue)); - - } else { + if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ + + if (FirstToken == TRUE){ - // Something else we don't know about so append - // to the tokens variable. + PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); + FirstToken = FALSE; - if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ + } else { - if (FirstToken == TRUE){ - - PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); - FirstToken = FALSE; - - } else { - - PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); - - } + PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); } - + } } -- 2.39.2