diff options
Diffstat (limited to 'src/corelib/tools/qcollator_p.h')
-rw-r--r-- | src/corelib/tools/qcollator_p.h | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator_p.h index c03a3431db..e89c08447c 100644 --- a/src/corelib/tools/qcollator_p.h +++ b/src/corelib/tools/qcollator_p.h @@ -68,27 +68,31 @@ QT_BEGIN_NAMESPACE #if QT_CONFIG(icu) typedef UCollator *CollatorType; typedef QByteArray CollatorKeyType; +const CollatorType NoCollator = nullptr; #elif defined(Q_OS_OSX) typedef CollatorRef CollatorType; typedef QVector<UCCollationValue> CollatorKeyType; +const CollatorType NoCollator = 0; #elif defined(Q_OS_WIN) typedef QString CollatorKeyType; typedef int CollatorType; +const CollatorType NoCollator = 0; # ifdef Q_OS_WINRT # define USE_COMPARESTRINGEX # endif -#else //posix +#else // posix - ignores CollatorType collator, only handles system locale typedef QVector<wchar_t> CollatorKeyType; -typedef int CollatorType; +typedef bool CollatorType; +const CollatorType NoCollator = false; #endif class QCollatorPrivate { public: - QAtomicInt ref; + QAtomicInt ref = 1; QLocale locale; #if defined(Q_OS_WIN) && !QT_CONFIG(icu) #ifdef USE_COMPARESTRINGEX @@ -97,32 +101,25 @@ public: LCID localeID; #endif #endif - Qt::CaseSensitivity caseSensitivity; - bool numericMode; - bool ignorePunctuation; - bool dirty; + Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive; + bool numericMode = false; + bool ignorePunctuation = false; + bool dirty = true; + + CollatorType collator = NoCollator; - CollatorType collator; + QCollatorPrivate(const QLocale &locale) : locale(locale) {} + ~QCollatorPrivate() { cleanup(); } void clear() { cleanup(); - collator = 0; + collator = NoCollator; } + // Implemented by each back-end, in its own way: void init(); void cleanup(); - QCollatorPrivate() - : ref(1), - caseSensitivity(Qt::CaseSensitive), - numericMode(false), - ignorePunctuation(false), - dirty(true), - collator(0) - { cleanup(); } - - ~QCollatorPrivate() { cleanup(); } - private: Q_DISABLE_COPY(QCollatorPrivate) }; |