11#include <boost/program_options.hpp>
18template <
typename E>
class EnumWrapper;
19template <
typename E> std::istream&
operator>>(std::istream&, EnumWrapper<E>&);
60 typedef std::map<std::string, E> MapType;
75 operator E()
const {
return value; }
82 static void setMap(
const MapType& inMap)
88 friend std::istream&
operator>><E>(std::istream& is,
EnumWrapper<E>&);
97template <
typename E>
typename EnumWrapper<E>::MapType EnumWrapper<E>::map;
107 }
catch (
const std::out_of_range& oor) {
108 throw boost::program_options::validation_error(
109 boost::program_options::validation_error::invalid_option);
std::istream & operator>>(std::istream &, EnumWrapper< E > &)
A templated input operator that uses the defined map to set the value of the wrapped enum.
E operator()(const std::string &key)
static void setMap(const MapType &inMap)