From daa8c8c9811772ffe0ca21639b365f438d5c35bc Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 28 Dec 2015 04:40:48 +0000 Subject: [PATCH] Replaced string processing in URL with ProcessStringValue. --- source/contacteditor/ContactDataObject.cpp | 49 ++++++++-------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index ec9a03d..323475c 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -3054,6 +3054,7 @@ void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, } intPrevValue = 4; + bool PropertyMatched = FALSE; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ @@ -3087,45 +3088,31 @@ void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, CaptureString(&PropertyValue, FALSE); - if (PropertyName == wxT("ALTID")){ - - WebsiteListAltID->erase(*URLCount); - WebsiteListAltID->insert(std::make_pair(*URLCount, PropertyValue)); + ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched); + ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched); + ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched); - } else if (PropertyName == wxT("PID")){ - - WebsiteListPID->erase(*URLCount); - WebsiteListPID->insert(std::make_pair(*URLCount, PropertyValue)); - - } else if (PropertyName == wxT("PREF")){ - - ProcessIntegerValue(WebsiteListPref, &PropertyValue, URLCount); - - } else if (PropertyName == wxT("MEDIATYPE")){ + if (PropertyMatched == TRUE){ - WebsiteListMediatype->erase(*URLCount); - WebsiteListMediatype->insert(std::make_pair(*URLCount, PropertyValue)); + PropertyMatched = FALSE; + continue; - } else { + } - // Something else we don't know about so append - // to the tokens variable. + if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ + + if (FirstToken == TRUE){ - if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){ + PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); + FirstToken = FALSE; - if (FirstToken == TRUE){ - - PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); - FirstToken = FALSE; - - } else { - - PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); - - } + } else { - } + PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); + } + } } -- 2.39.2