Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Replaced code from PREF in MEMBER with ProcessIntegerValue.
[xestiaab/.git] / source / contacteditor / ContactDataObject.cpp
index ffca460..1f2ee93 100644 (file)
@@ -611,24 +611,8 @@ void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySe
                
                } else if (PropertyName == wxT("PREF")){
                        
-                       int PriorityNumber = 0;
-                       bool ValidNumber = TRUE;
-                       
-                       try{
-                               PriorityNumber = std::stoi(PropertyValue.ToStdString());
-                       }
-                       
-                       catch(std::invalid_argument &e){
-                               ValidNumber = FALSE;
-                       }
+                       ProcessIntegerValue(this, &SourceListPref, &PropertyValue, SourceCount);
 
-                       if (ValidNumber == TRUE){
-
-                               SourceListPref.erase(*SourceCount);
-                               SourceListPref.insert(std::make_pair(*SourceCount, PriorityNumber));
-
-                       }
-               
                } else if (PropertyName == wxT("MEDIATYPE")){
                
                        SourceListMediatype.erase(*SourceCount);
@@ -785,23 +769,7 @@ void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySe
                
                } else if (PropertyName == wxT("PREF")){
 
-                       int PriorityNumber = 0;
-                       bool ValidNumber = TRUE;
-                       
-                       try{
-                               PriorityNumber = std::stoi(PropertyValue.ToStdString());
-                       }
-                       
-                       catch(std::invalid_argument &e){
-                               ValidNumber = FALSE;
-                       }
-
-                       if (ValidNumber == TRUE){
-
-                               GroupsListPref.erase(*GroupCount);
-                               GroupsListPref.insert(std::make_pair(*GroupCount, PriorityNumber));
-               
-                       }
+                       ProcessIntegerValue(this, &GroupsListPref, &PropertyValue, GroupCount);
                
                } else if (PropertyName == wxT("MEDIATYPE")){
 
@@ -5877,6 +5845,31 @@ void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySe
 
 }
 
+void ProcessIntegerValue(ContactDataObject *ContactData,
+       std::map<int,int> *PrefPtr, 
+       wxString *PropertyValue, 
+       int *ItemCount){
+
+       int PriorityNumber = 0; 
+       bool ValidNumber = TRUE;
+                       
+       try{
+               PriorityNumber = std::stoi(PropertyValue->ToStdString());
+       }
+                       
+       catch(std::invalid_argument &e){
+               ValidNumber = FALSE;
+       }
+
+       if (ValidNumber == TRUE){
+
+               PrefPtr->erase(*ItemCount);
+               PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
+
+       }
+
+}
+
 void SplitValues(wxString *PropertyLine, 
        std::map<int,int> *SplitPoints, 
        std::map<int,int> *SplitLength, 
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