Mercurial > hg > orthanc
comparison Core/EnumerationDictionary.h @ 2708:83c991aeb611 jobs
integration mainline->jobs
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 09 Jul 2018 08:18:22 +0200 |
parents | 2c684841da15 |
children | a191bbd55a2b |
comparison
equal
deleted
inserted
replaced
2701:33de4a82c466 | 2708:83c991aeb611 |
---|---|
82 stringToEnumeration_[boost::lexical_cast<std::string>(static_cast<int>(value))] = value; | 82 stringToEnumeration_[boost::lexical_cast<std::string>(static_cast<int>(value))] = value; |
83 } | 83 } |
84 | 84 |
85 Enumeration Translate(const std::string& str) const | 85 Enumeration Translate(const std::string& str) const |
86 { | 86 { |
87 try | 87 int value; |
88 if (boost::conversion::try_lexical_convert<int>(str, value)) | |
88 { | 89 { |
89 int value = boost::lexical_cast<int>(str); | |
90 return static_cast<Enumeration>(value); | 90 return static_cast<Enumeration>(value); |
91 } | |
92 catch (boost::bad_lexical_cast) | |
93 { | |
94 } | 91 } |
95 | 92 |
96 typename StringToEnumeration::const_iterator | 93 typename StringToEnumeration::const_iterator |
97 found = stringToEnumeration_.find(str); | 94 found = stringToEnumeration_.find(str); |
98 | 95 |