mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Explicitly convert int to char during transform on string (equivalent of PR #756)
This commit is contained in:
parent
79acc0504b
commit
862d13138c
5
include/external/clara.h
vendored
5
include/external/clara.h
vendored
@ -396,9 +396,12 @@ namespace Clara {
|
|||||||
inline void convertInto( std::string const& _source, std::string& _dest ) {
|
inline void convertInto( std::string const& _source, std::string& _dest ) {
|
||||||
_dest = _source;
|
_dest = _source;
|
||||||
}
|
}
|
||||||
|
char toLowerCh(char c) {
|
||||||
|
return static_cast<char>( ::tolower( c ) );
|
||||||
|
}
|
||||||
inline void convertInto( std::string const& _source, bool& _dest ) {
|
inline void convertInto( std::string const& _source, bool& _dest ) {
|
||||||
std::string sourceLC = _source;
|
std::string sourceLC = _source;
|
||||||
std::transform( sourceLC.begin(), sourceLC.end(), sourceLC.begin(), ::tolower );
|
std::transform( sourceLC.begin(), sourceLC.end(), sourceLC.begin(), toLowerCh );
|
||||||
if( sourceLC == "y" || sourceLC == "1" || sourceLC == "true" || sourceLC == "yes" || sourceLC == "on" )
|
if( sourceLC == "y" || sourceLC == "1" || sourceLC == "true" || sourceLC == "yes" || sourceLC == "on" )
|
||||||
_dest = true;
|
_dest = true;
|
||||||
else if( sourceLC == "n" || sourceLC == "0" || sourceLC == "false" || sourceLC == "no" || sourceLC == "off" )
|
else if( sourceLC == "n" || sourceLC == "0" || sourceLC == "false" || sourceLC == "no" || sourceLC == "off" )
|
||||||
|
Loading…
Reference in New Issue
Block a user