mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-08 03:40:21 -04:00
fixed exceptions and typeDesc for constraints
This commit is contained in:
parent
b6b87d65f7
commit
f08a70dbd7
@ -363,6 +363,7 @@ MultiArg<T>::MultiArg(const std::string& flag,
|
||||
Constraint<T>* constraint,
|
||||
Visitor* v)
|
||||
: Arg( flag, name, desc, req, true, v ),
|
||||
_typeDesc( constraint->shortID() ),
|
||||
_constraint( constraint )
|
||||
{ }
|
||||
|
||||
@ -375,6 +376,7 @@ MultiArg<T>::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<T>::_extractValue( const std::string& val )
|
||||
if ( ! _constraint->check( _values.back() ) )
|
||||
throw( CmdLineParseException( "Value '" + val +
|
||||
"' does not meet constraint: " +
|
||||
_constraint->description() ) );
|
||||
_constraint->description(),
|
||||
toString() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -402,6 +402,7 @@ ValueArg<T>::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<T>::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<T>::processArg(int *i, std::vector<std::string>& args)
|
||||
template<class T>
|
||||
std::string ValueArg<T>::shortID(const std::string& val) const
|
||||
{
|
||||
return Arg::shortID( _typeDesc );
|
||||
return Arg::shortID( _typeDesc );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -490,7 +492,7 @@ std::string ValueArg<T>::shortID(const std::string& val) const
|
||||
template<class T>
|
||||
std::string ValueArg<T>::longID(const std::string& val) const
|
||||
{
|
||||
return Arg::longID( _typeDesc );
|
||||
return Arg::longID( _typeDesc );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@ -513,7 +515,8 @@ void ValueArg<T>::_extractValue( const std::string& val )
|
||||
if ( ! _constraint->check( _value ) )
|
||||
throw( CmdLineParseException( "Value '" + val +
|
||||
"' does not meet constraint: " +
|
||||
_constraint->description() ) );
|
||||
_constraint->description(),
|
||||
toString() ) );
|
||||
}
|
||||
|
||||
} // namespace TCLAP
|
||||
|
Loading…
x
Reference in New Issue
Block a user