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// Qt-Security score:significant reason:trivial-impl-only
5
6#ifndef QCOLLATOR_P_H
7#define QCOLLATOR_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtCore/private/qglobal_p.h>
21#include "qcollator.h"
22#include <QList>
23#if QT_CONFIG(icu)
24#include <unicode/ucol.h>
25#elif defined(Q_OS_MACOS)
26#include <CoreServices/CoreServices.h>
27#elif defined(Q_OS_WIN)
28#include <qt_windows.h>
29#endif
30
31QT_BEGIN_NAMESPACE
32
33#if QT_CONFIG(icu)
34typedef UCollator *CollatorType;
35typedef QByteArray CollatorKeyType;
36const CollatorType NoCollator = nullptr;
37
38#elif defined(Q_OS_MACOS)
39typedef CollatorRef CollatorType;
40typedef QList<UCCollationValue> CollatorKeyType;
41const CollatorType NoCollator = 0;
42
43#elif defined(Q_OS_WIN)
44typedef QByteArray CollatorKeyType;
45typedef int CollatorType;
46const CollatorType NoCollator = 0;
47
48#else // posix - ignores CollatorType collator, only handles system locale
49typedef QList<wchar_t> CollatorKeyType;
50typedef bool CollatorType;
52#endif
53
55{
56public:
60 bool numericMode = false;
61 bool ignorePunctuation = false;
62 bool dirty = true;
63
65
66 QCollatorPrivate(const QLocale &locale) : locale(locale) {}
68 bool isC() const { return locale.language() == QLocale::C; }
69
70 void clear() {
73 }
74
76 {
77 if (dirty)
78 init();
79 }
80
81 // Implemented by each back-end, in its own way:
82 void init();
83 void cleanup();
84
85private:
87};
88
90{
91 friend class QCollator;
92public:
93 template <typename...T>
94 explicit QCollatorSortKeyPrivate(T &&...args)
95 : QSharedData()
96 , m_key(std::forward<T>(args)...)
97 {
98 }
99
101
102private:
104};
105
106
107QT_END_NAMESPACE
108
109#endif // QCOLLATOR_P_H
QAtomicInt ref
Definition qcollator_p.h:57
bool isC() const
Definition qcollator_p.h:68
void ensureInitialized()
Definition qcollator_p.h:75
QCollatorPrivate(const QLocale &locale)
Definition qcollator_p.h:66
CollatorType collator
Definition qcollator_p.h:64
Qt::CaseSensitivity caseSensitivity
Definition qcollator_p.h:59
CollatorKeyType m_key
QCollatorSortKeyPrivate(T &&...args)
Definition qcollator_p.h:94
Combined button and popup list for selecting options.
const CollatorType NoCollator
Definition qcollator_p.h:51
bool CollatorType
Definition qcollator_p.h:50
GenerationalCollator(const QCollator &copy)
Definition qcollator.cpp:24