X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e87271f35887a50e011c7c97fc63c35f5d623e50..7beba2fc73283f5b750227459da57e66bcd475f5:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 4a667a59cc..c18e35f606 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -36,7 +36,7 @@ #include "wx/string.h" #include "wx/intl.h" #if wxUSE_THREADS - #include + #include "wx/thread.h" #endif #endif @@ -176,6 +176,12 @@ istream& operator>>(istream& is, wxString& WXUNUSED(str)) return is; } +ostream& operator<<(ostream& os, const wxString& str) +{ + os << str.c_str(); + return os; +} + #endif //std::string compatibility // ---------------------------------------------------------------------------- @@ -1844,7 +1850,7 @@ int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const } // add item at the end -void wxArrayString::Add(const wxString& str) +size_t wxArrayString::Add(const wxString& str) { if ( m_autoSort ) { // insert the string at the correct position to keep the array sorted @@ -1869,6 +1875,8 @@ void wxArrayString::Add(const wxString& str) wxASSERT_MSG( lo == hi, wxT("binary search broken") ); Insert(str, lo); + + return (size_t)lo; } else { wxASSERT( str.GetStringData()->IsValid() ); @@ -1879,7 +1887,9 @@ void wxArrayString::Add(const wxString& str) str.GetStringData()->Lock(); // just append - m_pItems[m_nCount++] = (wxChar *)str.c_str(); + m_pItems[m_nCount] = (wxChar *)str.c_str(); // const_cast + + return m_nCount++; } } @@ -1888,8 +1898,6 @@ void wxArrayString::Insert(const wxString& str, size_t nIndex) { wxASSERT( str.GetStringData()->IsValid() ); - wxCHECK_RET( !m_autoSort, wxT("can't use this method with sorted arrays") ); - wxCHECK_RET( nIndex <= m_nCount, wxT("bad index in wxArrayString::Insert") ); Grow();