Put quote marks around printed characters; also nicely print some escapes

This commit is contained in:
Eric Schmidt 2016-04-20 21:52:20 -06:00 committed by Martin Hořeňovský
parent 1e5176bd69
commit 5121b5b058

View File

@ -146,9 +146,19 @@ std::string toString( bool value ) {
} }
std::string toString( char value ) { std::string toString( char value ) {
return value < ' ' if ( value == '\r' )
? toString( static_cast<unsigned int>( value ) ) return "'\\r'";
: Detail::makeString( value ); if ( value == '\l' )
return "'\\l'";
if ( value == '\n' )
return "'\\n'";
if ( value == '\t' )
return "'\\t'";
if ( '\0' <= value && value < ' ' )
return toString( static_cast<unsigned int>( value ) );
char chstr[] = "' '";
chstr[1] = value;
return chstr;
} }
std::string toString( signed char value ) { std::string toString( signed char value ) {