X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e7aab1094ddc05b3f74bf6a9c71825f0d90819fb..69659fd770f615210efac4b4fa741b3ad6223616:/src/common/arrstr.cpp diff --git a/src/common/arrstr.cpp b/src/common/arrstr.cpp index ace83a6712..fe36a74bf8 100644 --- a/src/common/arrstr.cpp +++ b/src/common/arrstr.cpp @@ -27,7 +27,16 @@ // ArrayString // ============================================================================ -wxArrayString::wxArrayString(size_t sz, const wxChar** a) +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 wchar_t** a) { #if !wxUSE_STL Init(false); @@ -197,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 @@ -211,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 ) @@ -228,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 ); @@ -236,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; } } @@ -355,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);