Back porting hg commit 81563e019fa4
authordeba
Fri, 13 Jun 2008 09:51:45 +0000
changeset 26133d14a3449362
parent 2612 3d65053d01a3
child 2614 77bc9718ddd7
Back porting hg commit 81563e019fa4
lemon/arg_parser.h
     1.1 --- a/lemon/arg_parser.h	Tue Jun 10 11:36:17 2008 +0000
     1.2 +++ b/lemon/arg_parser.h	Fri Jun 13 09:51:45 2008 +0000
     1.3 @@ -310,9 +310,9 @@
     1.4        operator bool() 
     1.5        {
     1.6  	Opts::iterator i = _parser._opts.find(_name);
     1.7 -	LEMON_ASSERT(i==_parser._opts.end(),
     1.8 +	LEMON_ASSERT(i!=_parser._opts.end(),
     1.9  		     std::string()+"Unkown option: '"+_name+"'");
    1.10 -	LEMON_ASSERT(i->second.type!=ArgParser::BOOL,
    1.11 +	LEMON_ASSERT(i->second.type==ArgParser::BOOL,
    1.12  		     std::string()+"'"+_name+"' is a bool option");
    1.13  	return *(i->second.bool_p);
    1.14        }
    1.15 @@ -320,9 +320,9 @@
    1.16        operator std::string()
    1.17        {
    1.18  	Opts::iterator i = _parser._opts.find(_name);
    1.19 -	LEMON_ASSERT(i==_parser._opts.end(),
    1.20 +	LEMON_ASSERT(i!=_parser._opts.end(),
    1.21  		     std::string()+"Unkown option: '"+_name+"'");
    1.22 -	LEMON_ASSERT(i->second.type!=ArgParser::STRING,
    1.23 +	LEMON_ASSERT(i->second.type==ArgParser::STRING,
    1.24  		     std::string()+"'"+_name+"' is a string option");
    1.25  	return *(i->second.string_p);
    1.26        }
    1.27 @@ -330,10 +330,10 @@
    1.28        operator double() 
    1.29        {
    1.30  	Opts::iterator i = _parser._opts.find(_name);
    1.31 -	LEMON_ASSERT(i==_parser._opts.end(),
    1.32 +	LEMON_ASSERT(i!=_parser._opts.end(),
    1.33  		     std::string()+"Unkown option: '"+_name+"'");
    1.34 -	LEMON_ASSERT(i->second.type!=ArgParser::DOUBLE &&
    1.35 -		     i->second.type!=ArgParser::INTEGER,
    1.36 +	LEMON_ASSERT(i->second.type==ArgParser::DOUBLE ||
    1.37 +		     i->second.type==ArgParser::INTEGER,
    1.38  		     std::string()+"'"+_name+"' is a floating point option");
    1.39  	return i->second.type==ArgParser::DOUBLE ?
    1.40  	  *(i->second.double_p) : *(i->second.int_p);
    1.41 @@ -342,9 +342,9 @@
    1.42        operator int() 
    1.43        {
    1.44  	Opts::iterator i = _parser._opts.find(_name);
    1.45 -	LEMON_ASSERT(i==_parser._opts.end(),
    1.46 +	LEMON_ASSERT(i!=_parser._opts.end(),
    1.47  		     std::string()+"Unkown option: '"+_name+"'");
    1.48 -	LEMON_ASSERT(i->second.type!=ArgParser::INTEGER,
    1.49 +	LEMON_ASSERT(i->second.type==ArgParser::INTEGER,
    1.50  		     std::string()+"'"+_name+"' is an integer option");
    1.51  	return *(i->second.int_p);
    1.52        }