Only add wstring versions of toString if wchar_t has been defined. This fixes some issues on embedded platforms where wstring isn't available.

This commit is contained in:
Marco Nilsson 2012-12-19 10:38:03 +01:00
parent cf5ced59d1
commit 6498a5112c
2 changed files with 4 additions and 0 deletions

View File

@ -73,6 +73,7 @@ inline std::string toString( const std::string& value ) {
return "\"" + value + "\""; return "\"" + value + "\"";
} }
#ifdef wchar_t
inline std::string toString( const std::wstring& value ) { inline std::string toString( const std::wstring& value ) {
std::ostringstream oss; std::ostringstream oss;
oss << "\""; oss << "\"";
@ -81,6 +82,7 @@ inline std::string toString( const std::wstring& value ) {
oss << "\""; oss << "\"";
return oss.str(); return oss.str();
} }
#endif
inline std::string toString( const char* const value ) { inline std::string toString( const char* const value ) {
return value ? Catch::toString( std::string( value ) ) : std::string( "{null string}" ); return value ? Catch::toString( std::string( value ) ) : std::string( "{null string}" );

View File

@ -545,6 +545,7 @@ inline std::string toString( const std::string& value ) {
return "\"" + value + "\""; return "\"" + value + "\"";
} }
#ifdef wchar_t
inline std::string toString( const std::wstring& value ) { inline std::string toString( const std::wstring& value ) {
std::ostringstream oss; std::ostringstream oss;
oss << "\""; oss << "\"";
@ -553,6 +554,7 @@ inline std::string toString( const std::wstring& value ) {
oss << "\""; oss << "\"";
return oss.str(); return oss.str();
} }
#endif
inline std::string toString( const char* const value ) { inline std::string toString( const char* const value ) {
return value ? Catch::toString( std::string( value ) ) : std::string( "{null string}" ); return value ? Catch::toString( std::string( value ) ) : std::string( "{null string}" );