31 #include <boost/lexical_cast.hpp>
32 #include <boost/format.hpp>
36 using namespace boost;
42 if ((value[0] ==
'<') && (value.find(
'>') != string::npos)) {
43 unsigned int index = value.find(
'>');
44 string type = value.substr(1, index - 1);
45 string rest = value.substr(index + 1);
47 return any(lexical_cast<bool>(rest));
48 }
else if (type ==
"uint") {
49 return any(lexical_cast<unsigned int>(rest));
50 }
else if (type ==
"int") {
51 return any(lexical_cast<int>(rest));
52 }
else if (type ==
"double") {
53 return any(lexical_cast<double>(rest));
55 throw invalid_argument(str(format(
"Unknown option type `%1%'")
any parseTypedValue(const string &value)
Parses value and returns a boost::any object containing an object of the type indicated in value...