aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmoduleregistration.cpp
blob: a6d7e879b33b26d4ff2413c1d486050f4a981867 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include <QtQml/private/qqmlmetatype_p.h>
#include <QtQml/qqmlmoduleregistration.h>
#include <QtCore/qversionnumber.h>

QT_BEGIN_NAMESPACE

struct QQmlModuleRegistrationPrivate
{
    const QString uri;
};

QQmlModuleRegistration::QQmlModuleRegistration(const char *uri, void (*registerFunction)()) :
    d(new QQmlModuleRegistrationPrivate { QString::fromUtf8(uri) })
{
    QQmlMetaType::qmlInsertModuleRegistration(d->uri, registerFunction);
}

#if QT_DEPRECATED_SINCE(6, 0)
QQmlModuleRegistration::QQmlModuleRegistration(
        const char *uri, int majorVersion, void (*registerFunction)()) :
    QQmlModuleRegistration(uri, registerFunction)
{
    Q_UNUSED(majorVersion);
}
#endif

QQmlModuleRegistration::~QQmlModuleRegistration()
{
    QQmlMetaType::qmlRemoveModuleRegistration(d->uri);
    delete d;
}

QT_END_NAMESPACE