changeset 2975:e62e296a5714

use Toolbox::IsIntegeer instead of try_lexical_convert that is not available on some platform
author am@osimis.io
date Thu, 06 Dec 2018 11:16:23 +0100
parents 5f64ecbdfcb4
children ee0b2c5ad49b 5947aeedf41f
files Core/EnumerationDictionary.h Resources/CMake/OrthancFrameworkConfiguration.cmake TODO
diffstat 3 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Core/EnumerationDictionary.h	Thu Dec 06 10:39:27 2018 +0100
+++ b/Core/EnumerationDictionary.h	Thu Dec 06 11:16:23 2018 +0100
@@ -37,7 +37,6 @@
 
 #include "Toolbox.h"
 #include <boost/lexical_cast.hpp>
-#include <boost/lexical_cast/try_lexical_convert.hpp>
 #include <string>
 #include <map>
 
@@ -85,10 +84,9 @@
 
       Enumeration Translate(const std::string& str) const
       {
-        int numericalValue; // at this stage, we don't know if str is an alias or a numerical value
-        if (boost::conversion::try_lexical_convert<int>(str, numericalValue))
+        if (Toolbox::IsInteger(str))
         {
-          return static_cast<Enumeration>(numericalValue);
+          return static_cast<Enumeration>(boost::lexical_cast<int>(str));
         }
 
         typename StringToEnumeration::const_iterator
--- a/Resources/CMake/OrthancFrameworkConfiguration.cmake	Thu Dec 06 10:39:27 2018 +0100
+++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake	Thu Dec 06 11:16:23 2018 +0100
@@ -125,6 +125,7 @@
   ${ORTHANC_ROOT}/Core/Cache/MemoryCache.cpp
   ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp
   ${ORTHANC_ROOT}/Core/DicomFormat/DicomTag.cpp
+  ${ORTHANC_ROOT}/Core/EnumerationDictionary.h
   ${ORTHANC_ROOT}/Core/Enumerations.cpp
   ${ORTHANC_ROOT}/Core/FileStorage/MemoryStorageArea.cpp
   ${ORTHANC_ROOT}/Core/Logging.cpp
--- a/TODO	Thu Dec 06 10:39:27 2018 +0100
+++ b/TODO	Thu Dec 06 11:16:23 2018 +0100
@@ -134,8 +134,6 @@
   Release() and Acquire())
 * Avoid direct calls to FromDcmtkBridge (make most of its 
   methods private), go through ParsedDicomFile wherever possible
-* avoid boost::bad_lexical_cast exception at least in happy path 
-  by using boost::conversion::try_lexical_convert
 
 =================
 Platform-specific