From 772e3145d141c511dcdcffbc59158a28aa4c3901 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 28 Dec 2015 01:37:21 +0000 Subject: [PATCH] Added the ProcessIntegerValue subroutine. --- source/contacteditor/ContactDataObject.cpp | 25 ++++++++++++++++++++++ source/contacteditor/ContactDataObject.h | 5 +++++ 2 files changed, 30 insertions(+) diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index ffca460..532884d 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -5877,6 +5877,31 @@ void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySe } +void ProcessIntegerValue(ContactDataObject *ContactData, + std::map *KeyListPref, + wxString *PropertyValue, + int *KeyCount){ + + int PriorityNumber = 0; + bool ValidNumber = TRUE; + + try{ + PriorityNumber = std::stoi(PropertyValue->ToStdString()); + } + + catch(std::invalid_argument &e){ + ValidNumber = FALSE; + } + + if (ValidNumber == TRUE){ + + KeyListPref->erase(*KeyCount); + KeyListPref->insert(std::make_pair(*KeyCount, PriorityNumber)); + + } + +} + void SplitValues(wxString *PropertyLine, std::map *SplitPoints, std::map *SplitLength, diff --git a/source/contacteditor/ContactDataObject.h b/source/contacteditor/ContactDataObject.h index 4cf459d..9e1be8a 100644 --- a/source/contacteditor/ContactDataObject.h +++ b/source/contacteditor/ContactDataObject.h @@ -618,4 +618,9 @@ void CheckType(wxString *PropertySeg1, int *intPrevValue, PropertyType *intType); +void ProcessIntegerValue(ContactDataObject *ContactData, + std::map *KeyListPref, + wxString *PropertyValue, + int *KeyCount); + #endif \ No newline at end of file -- 2.39.5