X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a7ea63e21fda950c658a477d59d0818aab993fc9..e887bad5f3a10f5b0c1f173c34c694dda283d0cf:/src/common/arrstr.cpp?ds=sidebyside diff --git a/src/common/arrstr.cpp b/src/common/arrstr.cpp index bfc4d88981..fe36a74bf8 100644 --- a/src/common/arrstr.cpp +++ b/src/common/arrstr.cpp @@ -21,14 +21,22 @@ #endif #include "wx/arrstr.h" +#include "wx/thread.h" // ============================================================================ // ArrayString // ============================================================================ -#include "wx/arrstr.h" +wxArrayString::wxArrayString(size_t sz, const char** a) +{ +#if !wxUSE_STL + Init(false); +#endif + for (size_t i=0; i < sz; i++) + Add(a[i]); +} -wxArrayString::wxArrayString(size_t sz, const wxChar** a) +wxArrayString::wxArrayString(size_t sz, const wchar_t** a) { #if !wxUSE_STL Init(false); @@ -198,7 +206,7 @@ void wxArrayString::Shrink() } // searches the array for an item (forward or backwards) -int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const +int wxArrayString::Index(const wxString& str, bool bCase, bool bFromEnd) const { if ( m_autoSort ) { // use binary search in the sorted array @@ -212,7 +220,7 @@ int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const while ( lo < hi ) { i = (lo + hi)/2; - res = wxStrcmp(sz, m_pItems[i]); + res = str.compare(m_pItems[i]); if ( res < 0 ) hi = i; else if ( res > 0 ) @@ -229,7 +237,7 @@ int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const if ( m_nCount > 0 ) { size_t ui = m_nCount; do { - if ( m_pItems[--ui].IsSameAs(sz, bCase) ) + if ( m_pItems[--ui].IsSameAs(str, bCase) ) return ui; } while ( ui != 0 ); @@ -237,7 +245,7 @@ int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const } else { for( size_t ui = 0; ui < m_nCount; ui++ ) { - if( m_pItems[ui].IsSameAs(sz, bCase) ) + if( m_pItems[ui].IsSameAs(str, bCase) ) return ui; } } @@ -356,7 +364,7 @@ void wxArrayString::RemoveAt(size_t nIndex, size_t nRemove) } // removes item from array (by value) -void wxArrayString::Remove(const wxChar *sz) +void wxArrayString::Remove(const wxString& sz) { int iIndex = Index(sz);