lemon/arg_parser.h
changeset 95 cc7e6b8b59bf
parent 90 2981a73d49a3
child 108 889d0c289d19
     1.1 --- a/lemon/arg_parser.h	Tue Mar 18 13:57:15 2008 +0100
     1.2 +++ b/lemon/arg_parser.h	Tue Mar 18 16:45:21 2008 +0100
     1.3 @@ -127,7 +127,7 @@
     1.4  
     1.5      ///\param name The name of the option. The leading '-' must be omitted.
     1.6      ///\param help A help string.
     1.7 -    ///\param value A default value for the option
     1.8 +    ///\param value A default value for the option.
     1.9      ///\param obl Indicate if the option is mandatory.
    1.10      ArgParser &intOption(const std::string &name,
    1.11  		    const std::string &help,
    1.12 @@ -137,7 +137,7 @@
    1.13  
    1.14      ///\param name The name of the option. The leading '-' must be omitted.
    1.15      ///\param help A help string.
    1.16 -    ///\param value A default value for the option
    1.17 +    ///\param value A default value for the option.
    1.18      ///\param obl Indicate if the option is mandatory.
    1.19      ArgParser &doubleOption(const std::string &name,
    1.20  		      const std::string &help,
    1.21 @@ -147,9 +147,9 @@
    1.22  
    1.23      ///\param name The name of the option. The leading '-' must be omitted.
    1.24      ///\param help A help string.
    1.25 -    ///\param value A default value for the option
    1.26 +    ///\param value A default value for the option.
    1.27      ///\param obl Indicate if the option is mandatory.
    1.28 -    ////\note A mandatory bool obtion is of very little use.)
    1.29 +    ///\note A mandatory bool obtion is of very little use.
    1.30      ArgParser &boolOption(const std::string &name,
    1.31  		      const std::string &help,
    1.32  		      bool value=false, bool obl=false);
    1.33 @@ -158,7 +158,7 @@
    1.34  
    1.35      ///\param name The name of the option. The leading '-' must be omitted.
    1.36      ///\param help A help string.
    1.37 -    ///\param value A default value for the option
    1.38 +    ///\param value A default value for the option.
    1.39      ///\param obl Indicate if the option is mandatory.
    1.40      ArgParser &stringOption(const std::string &name,
    1.41  		      const std::string &help,
    1.42 @@ -196,7 +196,7 @@
    1.43      ///\param help A help string.
    1.44      ///\param obl Indicate if the option is mandatory.
    1.45      ///\retval ref The value of the argument will be written to this variable.
    1.46 -    ////\note A mandatory bool obtion is of very little use.)
    1.47 +    ///\note A mandatory bool obtion is of very little use.
    1.48      ArgParser &refOption(const std::string &name,
    1.49  		      const std::string &help,
    1.50  		      bool &ref, bool obl=false);
    1.51 @@ -205,8 +205,8 @@
    1.52  
    1.53      ///\param name The name of the option. The leading '-' must be omitted.
    1.54      ///\param help A help string.
    1.55 +    ///\param obl Indicate if the option is mandatory.
    1.56      ///\retval ref The value of the argument will be written to this variable.
    1.57 -    ///\param obl Indicate if the option is mandatory.
    1.58      ArgParser &refOption(const std::string &name,
    1.59  		      const std::string &help,
    1.60  		      std::string &ref, bool obl=false);
    1.61 @@ -311,9 +311,9 @@
    1.62        operator bool() 
    1.63        {
    1.64  	Opts::iterator i = _parser._opts.find(_name);
    1.65 -	LEMON_ASSERT(i==_parser._opts.end(),
    1.66 +	LEMON_ASSERT(i!=_parser._opts.end(),
    1.67  		     std::string()+"Unkown option: '"+_name+"'");
    1.68 -	LEMON_ASSERT(i->second.type!=ArgParser::BOOL,
    1.69 +	LEMON_ASSERT(i->second.type==ArgParser::BOOL,
    1.70  		     std::string()+"'"+_name+"' is a bool option");
    1.71  	return *(i->second.bool_p);
    1.72        }
    1.73 @@ -321,9 +321,9 @@
    1.74        operator std::string()
    1.75        {
    1.76  	Opts::iterator i = _parser._opts.find(_name);
    1.77 -	LEMON_ASSERT(i==_parser._opts.end(),
    1.78 +	LEMON_ASSERT(i!=_parser._opts.end(),
    1.79  		     std::string()+"Unkown option: '"+_name+"'");
    1.80 -	LEMON_ASSERT(i->second.type!=ArgParser::STRING,
    1.81 +	LEMON_ASSERT(i->second.type==ArgParser::STRING,
    1.82  		     std::string()+"'"+_name+"' is a string option");
    1.83  	return *(i->second.string_p);
    1.84        }
    1.85 @@ -331,10 +331,10 @@
    1.86        operator double() 
    1.87        {
    1.88  	Opts::iterator i = _parser._opts.find(_name);
    1.89 -	LEMON_ASSERT(i==_parser._opts.end(),
    1.90 +	LEMON_ASSERT(i!=_parser._opts.end(),
    1.91  		     std::string()+"Unkown option: '"+_name+"'");
    1.92 -	LEMON_ASSERT(i->second.type!=ArgParser::DOUBLE &&
    1.93 -		     i->second.type!=ArgParser::INTEGER,
    1.94 +	LEMON_ASSERT(i->second.type==ArgParser::DOUBLE ||
    1.95 +		     i->second.type==ArgParser::INTEGER,
    1.96  		     std::string()+"'"+_name+"' is a floating point option");
    1.97  	return i->second.type==ArgParser::DOUBLE ?
    1.98  	  *(i->second.double_p) : *(i->second.int_p);
    1.99 @@ -343,9 +343,9 @@
   1.100        operator int() 
   1.101        {
   1.102  	Opts::iterator i = _parser._opts.find(_name);
   1.103 -	LEMON_ASSERT(i==_parser._opts.end(),
   1.104 +	LEMON_ASSERT(i!=_parser._opts.end(),
   1.105  		     std::string()+"Unkown option: '"+_name+"'");
   1.106 -	LEMON_ASSERT(i->second.type!=ArgParser::INTEGER,
   1.107 +	LEMON_ASSERT(i->second.type==ArgParser::INTEGER,
   1.108  		     std::string()+"'"+_name+"' is an integer option");
   1.109  	return *(i->second.int_p);
   1.110        }