X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fcbe123e4881886b9f5b78a1482af73ecbe5da6c..ce6f8d6fb3613a15232ccbd4ebefc22194bcbdc9:/src/common/txtstrm.cpp diff --git a/src/common/txtstrm.cpp b/src/common/txtstrm.cpp index 0f23ce65ab..ede8a1c5ea 100644 --- a/src/common/txtstrm.cpp +++ b/src/common/txtstrm.cpp @@ -132,7 +132,7 @@ wxUint32 wxTextInputStream::Read32(int base) if(!m_input) return 0; wxString word = ReadWord(); - if(word.IsEmpty()) + if(word.empty()) return 0; return wxStrtoul(word.c_str(), 0, base); } @@ -153,7 +153,7 @@ wxInt32 wxTextInputStream::Read32S(int base) if(!m_input) return 0; wxString word = ReadWord(); - if(word.IsEmpty()) + if(word.empty()) return 0; return wxStrtol(word.c_str(), 0, base); } @@ -172,7 +172,7 @@ double wxTextInputStream::ReadDouble() { if(!m_input) return 0; wxString word = ReadWord(); - if(word.IsEmpty()) + if(word.empty()) return 0; return wxStrtod(word.c_str(), 0); } @@ -406,7 +406,7 @@ void wxTextOutputStream::WriteString(const wxString& string) } out << c; - } + } // We must not write the trailing NULL here #if wxUSE_UNICODE @@ -417,6 +417,16 @@ void wxTextOutputStream::WriteString(const wxString& string) #endif } +wxTextOutputStream& wxTextOutputStream::PutChar(wxChar c) +{ +#if wxUSE_UNICODE + WriteString( wxString(&c, m_conv, 1) ); +#else + WriteString( wxString(&c, wxConvLocal, 1) ); +#endif + return *this; +} + wxTextOutputStream& wxTextOutputStream::operator<<(const wxChar *string) { WriteString( wxString(string) ); @@ -497,17 +507,7 @@ wxTextOutputStream& wxTextOutputStream::operator<<(float f) wxTextOutputStream &endl( wxTextOutputStream &stream ) { - //RN: Normally a single char on builds without a real - //wchar_t will call the version that corresponds to the - //numeric value of wchar_t itself (wxUint16 if 2 bytes etc.), - //which is not what we want (will print a 10 numeric value, - //not a newline). Thus, we need to send it a string in that - // case instead so that it correctly prints the newline. -#if !wxUSE_UNICODE || wxWCHAR_T_IS_REAL_TYPE - return stream << wxT('\n'); -#else - return stream << wxT("\n"); -#endif + return stream.PutChar(wxT('\n')); } #endif