54 mutable map<string,int> __options;
55 vector<string> __arguments;
56 mutable map<string,bool> __options_used;
58 string __command_line;
63 CmdLine(
const int argc,
char** argv);
65 CmdLine(
const vector<string> & args);
68 bool present(
const string & opt)
const;
74 inline const vector<string> &
arguments()
const {
return __arguments;}
77 template<
class T> T
value(
const string & opt)
const;
78 template<
class T> T
value(
const string & opt,
const T & defval)
const;
82 int int_val(
const string & opt)
const;
84 int int_val(
const string & opt,
const int & defval)
const;
89 double double_val(
const string & opt,
const double & defval)
const;
94 string string_val(
const string & opt,
const string & defval)
const;
107 void _report_conversion_failure(
const string & opt,
108 const string & optstring)
const;
119 istringstream optstream(optstring);
121 if (optstream.fail()) _report_conversion_failure(opt, optstring);
126template<>
inline string CmdLine::value<string>(
const string & opt)
const {
131template<
class T> T
CmdLine::value(
const string & opt,
const T & defval)
const {
133 else {
return defval;}
bool all_options_used() const
return true if all options have been asked for at some point or other
int int_val(const string &opt) const
return the integer value corresponding to the given option
double double_val(const string &opt) const
return the double value corresponding to the given option
const vector< string > & arguments() const
return a reference to the vector of command-line arguments (0 is command).
bool present_and_set(const string &opt) const
true if the option is present and corresponds to a value
T value(const string &opt) const
returns the value of the argument converted to type T
string command_line() const
return the full command line
string string_val(const string &opt) const
return the string value corresponding to the given option
bool present(const string &opt) const
true if the option is present