summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qcollator_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-08-27 12:57:14 +0200
committerLars Knoll <lars.knoll@digia.com>2014-09-10 21:11:11 +0200
commitc17563eca879845deef542173f5fb479c9aa2d0e (patch)
treeb967050c3502458043998288292d6da952252649 /src/corelib/tools/qcollator_p.h
parent6316a681f3f3dde46d5ab5c915f31a2098b463bb (diff)
Fix several issues in QCollator
Refactor the code and move more things into the cross platform code path. Make sure the flags survive changing the locale of QCollator. Use the correct locale on Windows, WinRT and OS X. We now pass all QCollator autotests on these platforms. Task-number: QTBUG-40778 Change-Id: Ic2d3334b5018c323a35a3ea8fc1d7ab5f99b4e62 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qcollator_p.h')
-rw-r--r--src/corelib/tools/qcollator_p.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator_p.h
index 50e1a01f82..c303cfbcff 100644
--- a/src/corelib/tools/qcollator_p.h
+++ b/src/corelib/tools/qcollator_p.h
@@ -49,6 +49,8 @@
#include <unicode/ucol.h>
#elif defined(Q_OS_OSX)
#include <CoreServices/CoreServices.h>
+#elif defined(Q_OS_WIN)
+#include <qt_windows.h>
#endif
QT_BEGIN_NAMESPACE
@@ -58,17 +60,16 @@ typedef UCollator *CollatorType;
typedef QByteArray CollatorKeyType;
#elif defined(Q_OS_OSX)
+typedef CollatorRef CollatorType;
typedef QVector<UCCollationValue> CollatorKeyType;
-struct CollatorType {
- CollatorType(int opt) : collator(NULL), options(opt) {}
-
- CollatorRef collator;
- UInt32 options;
-};
#elif defined(Q_OS_WIN)
typedef QString CollatorKeyType;
typedef int CollatorType;
+# ifdef Q_OS_WINRT
+# define USE_COMPARESTRINGEX
+# endif
+
#else //posix
typedef QVector<wchar_t> CollatorKeyType;
typedef int CollatorType;
@@ -79,6 +80,17 @@ class Q_CORE_EXPORT QCollatorPrivate
public:
QAtomicInt ref;
QLocale locale;
+#if defined(Q_OS_WIN)
+#ifdef USE_COMPARESTRINGEX
+ QString localeName;
+#else
+ LCID localeID;
+#endif
+#endif
+ Qt::CaseSensitivity caseSensitivity;
+ bool numericMode;
+ bool ignorePunctuation;
+ bool dirty;
CollatorType collator;
@@ -91,7 +103,12 @@ public:
void cleanup();
QCollatorPrivate()
- : ref(1), collator(0)
+ : ref(1),
+ caseSensitivity(Qt::CaseSensitive),
+ numericMode(false),
+ ignorePunctuation(false),
+ dirty(true),
+ collator(0)
{ cleanup(); }
~QCollatorPrivate() { cleanup(); }