Add wxDictionaryStringSortAscending comparison function.

Add "dictionary sort" callbacks and document them and the already existing
wxStringSortAscending() and wxStringSortDescending().

See #16330.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76753 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-06-23 12:02:09 +00:00
parent ba1c305343
commit af77028fcf
3 changed files with 83 additions and 0 deletions

View File

@@ -27,6 +27,22 @@ inline int wxCMPFUNC_CONV wxStringSortDescending(const wxString& s1, const wxStr
return wxStringSortAscending(s2, s1);
}
// This comparison function ignores case when comparing strings differing not
// in case only, i.e. this ensures that "Aa" comes before "AB", unlike with
// wxStringSortAscending().
inline int wxCMPFUNC_CONV
wxDictionaryStringSortAscending(const wxString& s1, const wxString& s2)
{
const int cmp = s1.CmpNoCase(s2);
return cmp ? cmp : s1.Cmp(s2);
}
inline int wxCMPFUNC_CONV
wxDictionaryStringSortDescending(const wxString& s1, const wxString& s2)
{
return wxDictionaryStringSortAscending(s2, s1);
}
#if wxUSE_STD_CONTAINERS
#include "wx/dynarray.h"