template<typename T>
class Option: public OptBase
{
+ private:
+ T &data;
+
public:
Option(char s, const std::string &l, T &d, ArgType a): OptBase(s, l, a), data(d) { }
throw usage_error("Invalid argument for --"+lng+" ("+e.what()+")");
}
}
- private:
- T &data;
};
template<typename T>
class ListOption: public OptBase
{
+ private:
+ T &data;
+
public:
ListOption(char s, const std::string &l, T &d, ArgType a): OptBase(s, l, a), data(d)
{ if(arg_type!=REQUIRED_ARG) throw std::invalid_argument("ListOption arg_type!=REQUIRED"); }
throw usage_error("Invalid argument for --"+lng+" ("+e.what()+")");
}
}
- private:
- T &data;
};
bool help;
std::string generate_help() const;
};
-template<> inline void GetOpt::Option<bool>::store() { data = true; }
-template<> inline void GetOpt::Option<unsigned>::store() { ++data; }
+template<> inline void GetOpt::Option<bool>::store()
+{ data = true; }
+
+template<> inline void GetOpt::Option<unsigned>::store()
+{ ++data; }
template<> inline void GetOpt::Option<std::string>::store(const std::string &a)
{ data = a; }