| ... | ... |
@@ -112,25 +112,25 @@ |
| 112 | 112 |
~ArgParser(); |
| 113 | 113 |
|
| 114 | 114 |
///Add a new integer type option |
| 115 | 115 |
|
| 116 | 116 |
///\param name The name of the option. The leading '-' must be omitted. |
| 117 | 117 |
///\param help A help string. |
| 118 | 118 |
///\retval value The value of the argument will be written to this variable. |
| 119 | 119 |
///\param obl Indicate if the option is mandatory. |
| 120 | 120 |
ArgParser &intOption(const std::string &name, |
| 121 | 121 |
const std::string &help, |
| 122 | 122 |
int value=0, bool obl=false); |
| 123 | 123 |
|
| 124 |
///Add a new floating type option |
|
| 124 |
///Add a new floating point type option |
|
| 125 | 125 |
|
| 126 | 126 |
///\param name The name of the option. The leading '-' must be omitted. |
| 127 | 127 |
///\param help A help string. |
| 128 | 128 |
///\retval value The value of the argument will be written to this variable. |
| 129 | 129 |
///\param obl Indicate if the option is mandatory. |
| 130 | 130 |
ArgParser &doubleOption(const std::string &name, |
| 131 | 131 |
const std::string &help, |
| 132 | 132 |
double value=0, bool obl=false); |
| 133 | 133 |
|
| 134 | 134 |
///Add a new bool type option |
| 135 | 135 |
|
| 136 | 136 |
///\param name The name of the option. The leading '-' must be omitted. |
| ... | ... |
@@ -287,26 +287,26 @@ |
| 287 | 287 |
|
| 288 | 288 |
///Check if an opion has been given to the command. |
| 289 | 289 |
bool given(std::string op) |
| 290 | 290 |
{
|
| 291 | 291 |
Opts::iterator i = _opts.find(op); |
| 292 | 292 |
return i!=_opts.end()?i->second.set:false; |
| 293 | 293 |
} |
| 294 | 294 |
|
| 295 | 295 |
|
| 296 | 296 |
///Magic type for operator[] |
| 297 | 297 |
|
| 298 | 298 |
///This is the type of the return value of ArgParser::operator[](). |
| 299 |
///It automatically converts to int, double, bool or std::string, if it |
|
| 300 |
///match the type of the option, otherwise it throws an exception. |
|
| 299 |
///It automatically converts to int, double, bool or std::string if |
|
| 300 |
///the type of the option matches, otherwise it throws an exception. |
|
| 301 | 301 |
///(i.e. it performs runtime type checking). |
| 302 | 302 |
class RefType |
| 303 | 303 |
{
|
| 304 | 304 |
ArgParser &_parser; |
| 305 | 305 |
std::string _name; |
| 306 | 306 |
public: |
| 307 | 307 |
///\e |
| 308 | 308 |
RefType(ArgParser &p,const std::string &n) :_parser(p),_name(n) {}
|
| 309 | 309 |
///\e |
| 310 | 310 |
operator bool() |
| 311 | 311 |
{
|
| 312 | 312 |
Opts::iterator i = _parser._opts.find(_name); |
0 comments (0 inline)