// Copyright (C) 2016 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 #ifndef QDBUSMETATYPE_H #define QDBUSMETATYPE_H #include #include "QtCore/qmetatype.h" #include #ifndef QT_NO_DBUS QT_BEGIN_NAMESPACE class Q_DBUS_EXPORT QDBusMetaType { public: typedef void (*MarshallFunction)(QDBusArgument &, const void *); typedef void (*DemarshallFunction)(const QDBusArgument &, void *); static void registerMarshallOperators(QMetaType typeId, MarshallFunction, DemarshallFunction); static bool marshall(QDBusArgument &, QMetaType id, const void *data); static bool demarshall(const QDBusArgument &, QMetaType id, void *data); static void registerCustomType(QMetaType type, const QByteArray &signature); static QMetaType signatureToMetaType(const char *signature); static const char *typeToSignature(QMetaType type); }; template QMetaType qDBusRegisterMetaType() { auto mf = [](QDBusArgument &arg, const void *t) { arg << *static_cast(t); }; auto df = [](const QDBusArgument &arg, void *t) { arg >> *static_cast(t); }; QMetaType metaType = QMetaType::fromType(); QDBusMetaType::registerMarshallOperators(metaType, mf, df); return metaType; } QT_END_NAMESPACE #endif // QT_NO_DBUS #endif