Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qqmltypemodule.cpp
Go to the documentation of this file.
1
// Copyright (C) 2019 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant
4
5
#
include
"qqmltypemodule_p.h"
6
7
#
include
<
private
/
qqmltype_p_p
.
h
>
8
9
#
include
<
QtCore
/
qmutex
.
h
>
10
11
QT_BEGIN_NAMESPACE
12
13
void
QQmlTypeModule
::
addMinorVersion
(quint8 version)
14
{
15
for
(
int
oldVersion = m_minMinorVersion.loadRelaxed();
16
oldVersion > version && !m_minMinorVersion.testAndSetOrdered(oldVersion, version);
17
oldVersion = m_minMinorVersion.loadRelaxed()) {
18
}
19
20
for
(
int
oldVersion = m_maxMinorVersion.loadRelaxed();
21
oldVersion < version && !m_maxMinorVersion.testAndSetOrdered(oldVersion, version);
22
oldVersion = m_maxMinorVersion.loadRelaxed()) {
23
}
24
}
25
26
void
QQmlTypeModule
::
add
(QQmlTypePrivate *type)
27
{
28
QMutexLocker lock(&m_mutex);
29
30
if
(type->version.hasMinorVersion())
31
addMinorVersion(type->version.minorVersion());
32
33
QList<QQmlTypePrivate *> &list = m_typeHash[type->elementName];
34
for
(
int
ii = 0; ii < list.size(); ++ii) {
35
QQmlTypePrivate *in_list = list.at(ii);
36
Q_ASSERT(in_list);
37
if
(in_list->version.minorVersion() < type->version.minorVersion()) {
38
list.insert(ii, type);
39
return
;
40
}
else
if
(in_list->version.minorVersion() == type->version.minorVersion()) {
41
list[ii] = type;
42
return
;
43
}
44
}
45
list.append(type);
46
}
47
48
void
QQmlTypeModule
::
remove
(
const
QQmlTypePrivate *type)
49
{
50
QMutexLocker lock(&m_mutex);
51
for
(
auto
elementIt = m_typeHash.begin(); elementIt != m_typeHash.end(); ++elementIt)
52
QQmlMetaType::removeQQmlTypePrivate(elementIt.value(), type);
53
}
54
55
QQmlType
QQmlTypeModule
::findType(
const
QList<QQmlTypePrivate *> *types, QTypeRevision version)
56
{
57
if
(types) {
58
for
(
int
ii = 0; ii < types->size(); ++ii)
59
if
(types->at(ii)->version.minorVersion() <= version.minorVersion())
60
return
QQmlType(types->at(ii));
61
}
62
63
return
QQmlType();
64
}
65
66
void
QQmlTypeModule
::
walkCompositeSingletons
(
const
std
::function<
void
(
const
QQmlType &)> &callback)
const
67
{
68
QMutexLocker lock(&m_mutex);
69
for
(
auto
typeCandidates = m_typeHash.begin(), end = m_typeHash.end();
70
typeCandidates != end; ++typeCandidates) {
71
for
(
auto
type: typeCandidates.value()) {
72
if
(type->regType == QQmlType::CompositeSingletonType)
73
callback(QQmlType(type));
74
}
75
}
76
}
77
78
QT_END_NAMESPACE
QQmlTypeModule
Definition
qqmltypemodule_p.h:39
QQmlTypeModule::walkCompositeSingletons
void walkCompositeSingletons(const std::function< void(const QQmlType &)> &callback) const
Definition
qqmltypemodule.cpp:66
QQmlTypeModule::remove
void remove(const QQmlTypePrivate *type)
Definition
qqmltypemodule.cpp:48
QQmlTypeModule::addMinorVersion
void addMinorVersion(quint8 minorVersion)
Definition
qqmltypemodule.cpp:13
QQmlTypeModule::add
void add(QQmlTypePrivate *)
Definition
qqmltypemodule.cpp:26
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qtdeclarative
src
qml
qml
qqmltypemodule.cpp
Generated on
for Qt by
1.18.0