X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3458e408ba53337baf1b0a56f3eff51a9b32c193..cbc9145c04bd3ea0a228906c8363fa8f47e3acf9:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 53a6e680fb..98a635bc49 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -86,44 +86,8 @@ extern const wxChar WXDLLIMPEXP_BASE *wxEmptyString = &g_strEmpty.dummy; #if wxUSE_STD_IOSTREAM -// MS Visual C++ version 5.0 provides the new STL headers as well as the old -// iostream ones. -// -// ATTN: you can _not_ use both of these in the same program! - #include -wxSTD istream& operator>>(wxSTD istream& is, wxString& WXUNUSED(str)) -{ -#if 0 - int w = is.width(0); - if ( is.ipfx(0) ) { - streambuf *sb = is.rdbuf(); - str.erase(); - while ( true ) { - int ch = sb->sbumpc (); - if ( ch == EOF ) { - is.setstate(ios::eofbit); - break; - } - else if ( isspace(ch) ) { - sb->sungetc(); - break; - } - - str += ch; - if ( --w == 1 ) - break; - } - } - - is.isfx(); - if ( str.length() == 0 ) - is.setstate(ios::failbit); -#endif - return is; -} - wxSTD ostream& operator<<(wxSTD ostream& os, const wxString& str) { #ifdef __BORLANDC__ @@ -1617,19 +1581,18 @@ wxString& wxString::Trim(bool bFromRight) if ( bFromRight ) { // find last non-space character - iterator psz = begin() + length() - 1; - while ( wxSafeIsspace(*psz) && (psz >= begin()) ) - psz--; - + reverse_iterator psz = rbegin(); + while ( (psz != rend()) && wxSafeIsspace(*psz) ) + psz++; + // truncate at trailing space start - *++psz = wxT('\0'); - erase(psz, end()); + erase(psz.base(), end()); } else { // find first non-space character iterator psz = begin(); - while ( wxSafeIsspace(*psz) ) + while ( (psz != end()) && wxSafeIsspace(*psz) ) psz++; // fix up data and length