X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a8f1f1b23b32cb72c5aef4df2ec52049e7d82fcd..fce7f77fc48c8c02126a76dd566ef8433feb4ca8:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 34776e1caa..7fe2592efb 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -79,7 +79,7 @@ static const struct } g_strEmpty = { {-1, 0, 0}, wxT('\0') }; // empty C style string: points to 'string data' byte of g_strEmpty -extern const wxChar WXDLLEXPORT *wxEmptyString = &g_strEmpty.dummy; +extern const wxChar WXDLLIMPEXP_BASE *wxEmptyString = &g_strEmpty.dummy; // ---------------------------------------------------------------------------- // global functions @@ -1906,6 +1906,8 @@ void wxArrayString::Shrink() } } +#if WXWIN_COMPATIBILITY_2_4 + // return a wxString[] as required for some control ctors. wxString* wxArrayString::GetStringArray() const { @@ -1921,6 +1923,8 @@ wxString* wxArrayString::GetStringArray() const return array; } +#endif // WXWIN_COMPATIBILITY_2_4 + // searches the array for an item (forward or backwards) int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const { @@ -2051,7 +2055,7 @@ void wxArrayString::SetCount(size_t count) } // removes item from array (by index) -void wxArrayString::Remove(size_t nIndex, size_t nRemove) +void wxArrayString::RemoveAt(size_t nIndex, size_t nRemove) { wxCHECK_RET( nIndex < m_nCount, wxT("bad index in wxArrayString::Remove") ); wxCHECK_RET( nIndex + nRemove <= m_nCount, @@ -2074,7 +2078,7 @@ void wxArrayString::Remove(const wxChar *sz) wxCHECK_RET( iIndex != wxNOT_FOUND, wxT("removing inexistent element in wxArrayString::Remove") ); - Remove(iIndex); + RemoveAt(iIndex); } // ---------------------------------------------------------------------------- @@ -2142,16 +2146,16 @@ void wxArrayString::Sort(CompareFunction compareFunction) END_SORT(); } -void wxArrayString::Sort(bool reverseOrder) -{ - START_SORT(); +typedef int (wxC_CALLING_CONV * wxStringCompareFn)(const void *first, const void *second); - wxASSERT( !gs_compareFunction ); // must have been reset to NULL - gs_sortAscending = !reverseOrder; - - DoSort(); +void wxArrayString::Sort(CompareFunction2 compareFunction) +{ + qsort(m_pItems, m_nCount, sizeof(wxChar *), (wxStringCompareFn)compareFunction); +} - END_SORT(); +void wxArrayString::Sort(bool reverseOrder) +{ + Sort(reverseOrder ? wxStringSortDescending : wxStringSortAscending); } void wxArrayString::DoSort() @@ -2177,3 +2181,12 @@ bool wxArrayString::operator==(const wxArrayString& a) const return TRUE; } +int wxStringSortAscending(wxString* s1, wxString* s2) +{ + return wxStrcmp(s1->c_str(), s2->c_str()); +} + +int wxStringSortDescending(wxString* s1, wxString* s2) +{ + return -wxStrcmp(s1->c_str(), s2->c_str()); +}