| 1 | // Copyright (C) 2024 Ford Motor Company |
| 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 reason:declarations-only |
| 4 | |
| 5 | #ifndef QREMOTEOBJECTREPPARSER_P_H |
| 6 | #define QREMOTEOBJECTREPPARSER_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 "repparser.h" |
| 20 | #include "qtremoteobjectglobal.h" |
| 21 | |
| 22 | #include <QMetaObject> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | /* |
| 27 | * These methods use a POD or Class definition from RepParser to dynamically create QMetaObject |
| 28 | * definitions and (for PODs and enums) register them with Qt's type system. This requires memory |
| 29 | * allocation, so cleanup is handled by passing a QObject pointer as a reference object. When the |
| 30 | * QObject is destroyed, memory will be freed. This supports multiple QObjects referring to the |
| 31 | * same type, so the addTracker method is provided to set additional QObjects as references. Memory |
| 32 | * will be freed only when the last reference is destroyed. |
| 33 | * |
| 34 | * If creation fails, a nullptr is returned. |
| 35 | */ |
| 36 | |
| 37 | Q_REMOTEOBJECTS_EXPORT QMetaObject *createAndRegisterMetaTypeFromPOD(const POD &pod, QObject *reference); |
| 38 | Q_REMOTEOBJECTS_EXPORT QMetaObject *createAndRegisterReplicaFromASTClass(const ASTClass &astClass, QObject *reference); |
| 39 | Q_REMOTEOBJECTS_EXPORT QMetaObject *createAndRegisterSourceFromASTClass(const ASTClass &astClass, QObject *reference); |
| 40 | |
| 41 | Q_REMOTEOBJECTS_EXPORT bool addTracker(const QByteArray &typeName, QObject *reference); |
| 42 | |
| 43 | QT_END_NAMESPACE |
| 44 | |
| 45 | #endif // QREMOTEOBJECTREPPARSER_P_H |
| 46 | |