fixed exceptions and typeDesc for constraints

This commit is contained in:
mes5k 2005-01-07 04:00:48 +00:00
parent b6b87d65f7
commit f08a70dbd7
2 changed files with 12 additions and 6 deletions

View File

@ -363,6 +363,7 @@ MultiArg<T>::MultiArg(const std::string& flag,
Constraint<T>* constraint, Constraint<T>* constraint,
Visitor* v) Visitor* v)
: Arg( flag, name, desc, req, true, v ), : Arg( flag, name, desc, req, true, v ),
_typeDesc( constraint->shortID() ),
_constraint( constraint ) _constraint( constraint )
{ } { }
@ -375,6 +376,7 @@ MultiArg<T>::MultiArg(const std::string& flag,
CmdLineInterface& parser, CmdLineInterface& parser,
Visitor* v) Visitor* v)
: Arg( flag, name, desc, req, true, v ), : Arg( flag, name, desc, req, true, v ),
_typeDesc( constraint->shortID() ),
_constraint( constraint ) _constraint( constraint )
{ {
parser.add( this ); parser.add( this );
@ -484,7 +486,8 @@ void MultiArg<T>::_extractValue( const std::string& val )
if ( ! _constraint->check( _values.back() ) ) if ( ! _constraint->check( _values.back() ) )
throw( CmdLineParseException( "Value '" + val + throw( CmdLineParseException( "Value '" + val +
"' does not meet constraint: " + "' does not meet constraint: " +
_constraint->description() ) ); _constraint->description(),
toString() ) );
} }

View File

@ -402,6 +402,7 @@ ValueArg<T>::ValueArg(const std::string& flag,
Visitor* v) Visitor* v)
: Arg(flag, name, desc, req, true, v), : Arg(flag, name, desc, req, true, v),
_value( val ), _value( val ),
_typeDesc( constraint->shortID() ),
_constraint( constraint ) _constraint( constraint )
{ } { }
@ -416,6 +417,7 @@ ValueArg<T>::ValueArg(const std::string& flag,
Visitor* v) Visitor* v)
: Arg(flag, name, desc, req, true, v), : Arg(flag, name, desc, req, true, v),
_value( val ), _value( val ),
_typeDesc( constraint->shortID() ),
_constraint( constraint ) _constraint( constraint )
{ {
parser.add( this ); parser.add( this );
@ -513,7 +515,8 @@ void ValueArg<T>::_extractValue( const std::string& val )
if ( ! _constraint->check( _value ) ) if ( ! _constraint->check( _value ) )
throw( CmdLineParseException( "Value '" + val + throw( CmdLineParseException( "Value '" + val +
"' does not meet constraint: " + "' does not meet constraint: " +
_constraint->description() ) ); _constraint->description(),
toString() ) );
} }
} // namespace TCLAP } // namespace TCLAP