Implement wxUILocale::CompareStrings() for Unix systems
This required changing CompareStrings() to be a method of wxUILocale object, rather than just as a static function, as we must only allocate the locale_t object once, and not during each to this function, as this could make it unusably slow when using it as a comparison function when sorting a large list of strings. This is also more efficient under Mac, where we can similarly allocate NSLocale only once and even marginally more efficient under MSW, where we don't have to construct the locale string during each call. And, under all platforms, it also simplifies code by separating this function implementation from the initialization of wxUILocaleImpl. Also document that case-insensitive comparison is not available under Unix and adjust the tests accordingly.
This commit is contained in:
@@ -55,10 +55,9 @@ public:
|
||||
wxString GetInfo(wxLocaleInfo index,
|
||||
wxLocaleCategory cat = wxLOCALE_CAT_DEFAULT) const;
|
||||
|
||||
// Compares two strings, for a locale specified by wxLocaleIdent.
|
||||
static int CompareStrings(const wxString& lhs, const wxString& rhs,
|
||||
const wxLocaleIdent& localeId = wxLocaleIdent(),
|
||||
int flags = wxCompare_CaseSensitive);
|
||||
// Compares two strings in the order defined by this locale.
|
||||
int CompareStrings(const wxString& lhs, const wxString& rhs,
|
||||
int flags = wxCompare_CaseSensitive) const;
|
||||
|
||||
// Note that this class is not supposed to be used polymorphically, hence
|
||||
// its dtor is not virtual.
|
||||
|
Reference in New Issue
Block a user