X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/876f6cee1ffa7ac785ab4614490f13b7c32ba37a..37d0e9f60320b0858ead5e2556693f4c5404dc0b:/src/common/txtstrm.cpp diff --git a/src/common/txtstrm.cpp b/src/common/txtstrm.cpp index 3fc683abd6..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); } @@ -252,6 +252,17 @@ wxTextInputStream& wxTextInputStream::operator>>(char& c) return *this; } +#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE + +wxTextInputStream& wxTextInputStream::operator>>(wchar_t& wc) +{ + wc = GetChar(); + + return *this; +} + +#endif // wxUSE_UNICODE + wxTextInputStream& wxTextInputStream::operator>>(wxInt16& i) { i = (wxInt16)Read16(); @@ -395,7 +406,7 @@ void wxTextOutputStream::WriteString(const wxString& string) } out << c; - } + } // We must not write the trailing NULL here #if wxUSE_UNICODE @@ -406,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) ); @@ -486,16 +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 wxUint16 version, 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. -#if !wxUSE_UNICODE || wxWCHAR_T_IS_REAL_TYPE - return stream << wxT('\n'); -#else - return stream << wxT("\n"); -#endif + return stream.PutChar(wxT('\n')); } #endif