Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
31
32#if QT_CONFIG(icu)
33typedef UCollator *CollatorType;
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)
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)
59 LCID localeID;
60#endif
62 bool numericMode = false;
63 bool ignorePunctuation = false;
64 bool dirty = true;
65
67
70 bool isC() { return locale.language() == QLocale::C; }
71
72 void clear() {
73 cleanup();
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:
88 Q_DISABLE_COPY_MOVE(QCollatorPrivate)
89};
90
92{
93 friend class QCollator;
94public:
95 template <typename...T>
97 : QSharedData()
98 , m_key(std::forward<T>(args)...)
99 {
100 }
101
103
104private:
105 Q_DISABLE_COPY_MOVE(QCollatorSortKeyPrivate)
106};
107
108
110
111#endif // QCOLLATOR_P_H
\inmodule QtCore
Definition qatomic.h:112
\inmodule QtCore
Definition qbytearray.h:57
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
\inmodule QtCore
Definition qcollator.h:44
Language language() const
Returns the language of this locale.
Definition qlocale.cpp:1317
\inmodule QtCore
Definition qshareddata.h:19
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
CaseSensitivity
@ CaseSensitive
QT_BEGIN_NAMESPACE typedef QList< wchar_t > CollatorKeyType
Definition qcollator_p.h:48
const CollatorType NoCollator
Definition qcollator_p.h:50
bool CollatorType
Definition qcollator_p.h:49
GLint ref
QJSValueList args