Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Replaced string processing in SOUND and LOGO with ProcessStringValue.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 28 Dec 2015 05:04:34 +0000 (05:04 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 28 Dec 2015 05:04:55 +0000 (05:04 +0000)
source/contacteditor/ContactDataObject.cpp

index 51fb95d..fd9aa4f 100644 (file)
@@ -4203,6 +4203,7 @@ void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2
        CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
 
        intPrevValue = 5;
+       bool PropertyMatched = FALSE;
 
        for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
        intiter != SplitPoints.end(); ++intiter){
@@ -4236,42 +4237,28 @@ void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2
                
                CaptureString(&PropertyValue, FALSE);
                
-               if (PropertyName == wxT("ALTID")){
-
-                       LogosListAltID.erase(*LogoCount);
-                       LogosListAltID.insert(std::make_pair(*LogoCount, PropertyValue));
-               
-               } else if (PropertyName == wxT("PID")){
-
-                       LogosListPID.erase(*LogoCount);
-                       LogosListPID.insert(std::make_pair(*LogoCount, PropertyValue));
+               ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
+               ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
+               ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
+               ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
                
-               } else if (PropertyName == wxT("PREF")){
-
-                       ProcessIntegerValue(&LogosListPref, &PropertyValue, LogoCount);
+               if (PropertyMatched == TRUE){
                
-               } else if (PropertyName == wxT("MEDIATYPE")){
+                       PropertyMatched = FALSE;
+                       continue;
                
-                       LogosListMediatype.erase(*LogoCount);
-                       LogosListMediatype.insert(std::make_pair(*LogoCount, PropertyValue));
-                                       
-               } else {
+               }
+
+               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
                
-                       // Something else we don't know about so append
-                       // to the tokens variable.
+                       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);
                        
                        }
                
@@ -4404,6 +4391,7 @@ void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg
        CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
 
        intPrevValue = 6;
+       bool PropertyMatched = FALSE;
 
        for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
        intiter != SplitPoints.end(); ++intiter){
@@ -4437,47 +4425,29 @@ void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg
                
                CaptureString(&PropertyValue, FALSE);
                
-               if (PropertyName == wxT("ALTID")){
-
-                       SoundsListAltID.erase(*SoundCount);
-                       SoundsListAltID.insert(std::make_pair(*SoundCount, PropertyValue));
-               
-               } else if (PropertyName == wxT("PID")){
-
-                       SoundsListPID.erase(*SoundCount);
-                       SoundsListPID.insert(std::make_pair(*SoundCount, PropertyValue));
+               ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
+               ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
+               ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
+               ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
+               ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
                
-               } else if (PropertyName == wxT("PREF")){
-
-                       ProcessIntegerValue(&SoundsListPref, &PropertyValue, SoundCount);
-               
-               } else if (PropertyName == wxT("MEDIATYPE")){
+               if (PropertyMatched == TRUE){
                
-                       SoundsListMediatype.erase(*SoundCount);
-                       SoundsListMediatype.insert(std::make_pair(*SoundCount, PropertyValue));
-
-               } else if (PropertyName == wxT("LANGUAGE")){
+                       PropertyMatched = FALSE;
+                       continue;
                
-                       SoundsListLanguage.erase(*SoundCount);
-                       SoundsListLanguage.insert(std::make_pair(*SoundCount, PropertyValue));
+               }
 
-               } else {
+               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
                
-                       // Something else we don't know about so append
-                       // to the tokens variable.
+                       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);
                        
                        }
                
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