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 QString 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:
59#if defined(Q_OS_WIN) && !QT_CONFIG(icu)
61#endif
63 bool numericMode = false;
64 bool ignorePunctuation = false;
65 bool dirty = true;
66
68
69 QCollatorPrivate(const QLocale &locale) : locale(locale) {}
71 bool isC() { return locale.language() == QLocale::C; }
72
73 void clear() {
76 }
77
79 {
80 if (dirty)
81 init();
82 }
83
84 // Implemented by each back-end, in its own way:
85 void init();
86 void cleanup();
87
88private:
90};
91
93{
94 friend class QCollator;
95public:
96 template <typename...T>
97 explicit QCollatorSortKeyPrivate(T &&...args)
98 : QSharedData()
99 , m_key(std::forward<T>(args)...)
100 {
101 }
102
104
105private:
107};
108
109
110QT_END_NAMESPACE
111
112#endif // QCOLLATOR_P_H
QAtomicInt ref
Definition qcollator_p.h:57
void ensureInitialized()
Definition qcollator_p.h:78
QCollatorPrivate(const QLocale &locale)
Definition qcollator_p.h:69
CollatorType collator
Definition qcollator_p.h:67
Qt::CaseSensitivity caseSensitivity
Definition qcollator_p.h:62
CollatorKeyType m_key
QCollatorSortKeyPrivate(T &&...args)
Definition qcollator_p.h:97
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