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 | |
4 | #include <QtQml/private/qqmlmetatype_p.h> |
5 | #include <QtQml/qqmlmoduleregistration.h> |
6 | #include <QtCore/qversionnumber.h> |
7 | |
8 | QT_BEGIN_NAMESPACE |
9 | |
10 | struct QQmlModuleRegistrationPrivate |
11 | { |
12 | const QString uri; |
13 | }; |
14 | |
15 | QQmlModuleRegistration::QQmlModuleRegistration(const char *uri, void (*registerFunction)()) : |
16 | d(new QQmlModuleRegistrationPrivate { .uri: QString::fromUtf8(utf8: uri) }) |
17 | { |
18 | QQmlMetaType::qmlInsertModuleRegistration(uri: d->uri, registerFunction); |
19 | } |
20 | |
21 | #if QT_DEPRECATED_SINCE(6, 0) |
22 | QQmlModuleRegistration::QQmlModuleRegistration( |
23 | const char *uri, int majorVersion, void (*registerFunction)()) : |
24 | QQmlModuleRegistration(uri, registerFunction) |
25 | { |
26 | Q_UNUSED(majorVersion); |
27 | } |
28 | #endif |
29 | |
30 | QQmlModuleRegistration::~QQmlModuleRegistration() |
31 | { |
32 | QQmlMetaType::qmlRemoveModuleRegistration(uri: d->uri); |
33 | delete d; |
34 | } |
35 | |
36 | QT_END_NAMESPACE |
37 |