diff --git a/include/tclap/MultiArg.h b/include/tclap/MultiArg.h index 3f3984a..06546ab 100644 --- a/include/tclap/MultiArg.h +++ b/include/tclap/MultiArg.h @@ -363,6 +363,7 @@ MultiArg::MultiArg(const std::string& flag, Constraint* constraint, Visitor* v) : Arg( flag, name, desc, req, true, v ), + _typeDesc( constraint->shortID() ), _constraint( constraint ) { } @@ -375,6 +376,7 @@ MultiArg::MultiArg(const std::string& flag, CmdLineInterface& parser, Visitor* v) : Arg( flag, name, desc, req, true, v ), + _typeDesc( constraint->shortID() ), _constraint( constraint ) { parser.add( this ); @@ -484,7 +486,8 @@ void MultiArg::_extractValue( const std::string& val ) if ( ! _constraint->check( _values.back() ) ) throw( CmdLineParseException( "Value '" + val + "' does not meet constraint: " + - _constraint->description() ) ); + _constraint->description(), + toString() ) ); } diff --git a/include/tclap/ValueArg.h b/include/tclap/ValueArg.h index 575f61b..de5ef7e 100644 --- a/include/tclap/ValueArg.h +++ b/include/tclap/ValueArg.h @@ -402,6 +402,7 @@ ValueArg::ValueArg(const std::string& flag, Visitor* v) : Arg(flag, name, desc, req, true, v), _value( val ), + _typeDesc( constraint->shortID() ), _constraint( constraint ) { } @@ -415,8 +416,9 @@ ValueArg::ValueArg(const std::string& flag, CmdLineInterface& parser, Visitor* v) : Arg(flag, name, desc, req, true, v), -_value( val ), -_constraint( constraint ) + _value( val ), + _typeDesc( constraint->shortID() ), + _constraint( constraint ) { parser.add( this ); } @@ -481,7 +483,7 @@ bool ValueArg::processArg(int *i, std::vector& args) template std::string ValueArg::shortID(const std::string& val) const { - return Arg::shortID( _typeDesc ); + return Arg::shortID( _typeDesc ); } /** @@ -490,7 +492,7 @@ std::string ValueArg::shortID(const std::string& val) const template std::string ValueArg::longID(const std::string& val) const { - return Arg::longID( _typeDesc ); + return Arg::longID( _typeDesc ); } template @@ -513,7 +515,8 @@ void ValueArg::_extractValue( const std::string& val ) if ( ! _constraint->check( _value ) ) throw( CmdLineParseException( "Value '" + val + "' does not meet constraint: " + - _constraint->description() ) ); + _constraint->description(), + toString() ) ); } } // namespace TCLAP