Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qcollator_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2013 Aleix Pol Gonzalez <aleixpol@kde.org>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QCOLLATOR_P_H
6#define QCOLLATOR_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/private/qglobal_p.h>
20#include "qcollator.h"
21#include <QList>
22#if QT_CONFIG(icu)
23#include <unicode/ucol.h>
24#elif defined(Q_OS_MACOS)
25#include <CoreServices/CoreServices.h>
26#elif defined(Q_OS_WIN)
27#include <qt_windows.h>
28#endif
29
30QT_BEGIN_NAMESPACE
31
32#if QT_CONFIG(icu)
33typedef UCollator *CollatorType;
34typedef QByteArray CollatorKeyType;
35const CollatorType NoCollator = nullptr;
36
37#elif defined(Q_OS_MACOS)
38typedef CollatorRef CollatorType;
39typedef QList<UCCollationValue> CollatorKeyType;
40const CollatorType NoCollator = 0;
41
42#elif defined(Q_OS_WIN)
43typedef QString CollatorKeyType;
44typedef int CollatorType;
45const CollatorType NoCollator = 0;
46
47#else // posix - ignores CollatorType collator, only handles system locale
48typedef QList<wchar_t> CollatorKeyType;
49typedef bool CollatorType;
51#endif
52
54{
55public:
58#if defined(Q_OS_WIN) && !QT_CONFIG(icu)
60#endif
62 bool numericMode = false;
63 bool ignorePunctuation = false;
64 bool dirty = true;
65
67
68 QCollatorPrivate(const QLocale &locale) : locale(locale) {}
70 bool isC() { return locale.language() == QLocale::C; }
71
72 void clear() {
75 }
76
78 {
79 if (dirty)
80 init();
81 }
82
83 // Implemented by each back-end, in its own way:
84 void init();
85 void cleanup();
86
87private:
89};
90
92{
93 friend class QCollator;
94public:
95 template <typename...T>
96 explicit QCollatorSortKeyPrivate(T &&...args)
97 : QSharedData()
98 , m_key(std::forward<T>(args)...)
99 {
100 }
101
103
104private:
106};
107
108
109QT_END_NAMESPACE
110
111#endif // QCOLLATOR_P_H
QAtomicInt ref
Definition qcollator_p.h:56
void ensureInitialized()
Definition qcollator_p.h:77
QCollatorPrivate(const QLocale &locale)
Definition qcollator_p.h:68
CollatorType collator
Definition qcollator_p.h:66
Qt::CaseSensitivity caseSensitivity
Definition qcollator_p.h:61
CollatorKeyType m_key
QCollatorSortKeyPrivate(T &&...args)
Definition qcollator_p.h:96
Combined button and popup list for selecting options.
const CollatorType NoCollator
Definition qcollator_p.h:50
bool CollatorType
Definition qcollator_p.h:49
GenerationalCollator(const QCollator &copy)
Definition qcollator.cpp:23