]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/string.cpp
Fix wxExecute process end detect behavior for wxCocoa and wxMac. I have no
[wxWidgets.git] / src / common / string.cpp
index ff87c095c72a80cc715368a53031853795e2facb..9b05497c373daeb489defb129657e14f64556626 100644 (file)
@@ -72,11 +72,10 @@ const size_t wxString::npos = (size_t) -1;
 
 wxSTD ostream& operator<<(wxSTD ostream& os, const wxCStrData& str)
 {
-// FIXME-UTF8: always, not only if wxUSE_UNICODE
-#if wxUSE_UNICODE && !defined(__BORLANDC__)
-    return os << (const wchar_t*)str.AsWCharBuf();
+#if wxUSE_UNICODE && !wxUSE_UNICODE_UTF8
+    return os << (const char *)str.AsCharBuf();
 #else
-    return os << (const char*)str.AsCharBuf();
+    return os << str.AsInternal();
 #endif
 }
 
@@ -97,6 +96,25 @@ wxSTD ostream& operator<<(wxSTD ostream& os, const wxWCharBuffer& str)
 }
 #endif
 
+#if wxUSE_UNICODE && defined(HAVE_WOSTREAM)
+
+wxSTD wostream& operator<<(wxSTD wostream& wos, const wxString& str)
+{
+    return wos << str.wc_str();
+}
+
+wxSTD wostream& operator<<(wxSTD wostream& wos, const wxCStrData& str)
+{
+    return wos << str.AsWChar();
+}
+
+wxSTD wostream& operator<<(wxSTD wostream& wos, const wxWCharBuffer& str)
+{
+    return wos << str.data();
+}
+
+#endif  // wxUSE_UNICODE && defined(HAVE_WOSTREAM)
+
 #endif // wxUSE_STD_IOSTREAM
 
 // ===========================================================================
@@ -975,13 +993,12 @@ int wxString::CmpNoCase(const wxString& s) const
 {
     // FIXME-UTF8: use wxUniChar::ToLower/ToUpper once added
 
-    size_t idx = 0;
     const_iterator i1 = begin();
     const_iterator end1 = end();
     const_iterator i2 = s.begin();
     const_iterator end2 = s.end();
 
-    for ( ; i1 != end1 && i2 != end2; ++idx, ++i1, ++i2 )
+    for ( ; i1 != end1 && i2 != end2; ++i1, ++i2 )
     {
         wxUniChar lower1 = (wxChar)wxTolower(*i1);
         wxUniChar lower2 = (wxChar)wxTolower(*i2);
@@ -1353,7 +1370,7 @@ wxString& wxString::Trim(bool bFromRight)
             // find last non-space character
             reverse_iterator psz = rbegin();
             while ( (psz != rend()) && wxSafeIsspace(*psz) )
-                psz++;
+                ++psz;
 
             // truncate at trailing space start
             erase(psz.base(), end());
@@ -1363,7 +1380,7 @@ wxString& wxString::Trim(bool bFromRight)
             // find first non-space character
             iterator psz = begin();
             while ( (psz != end()) && wxSafeIsspace(*psz) )
-                psz++;
+                ++psz;
 
             // fix up data and length
             erase(begin(), psz);