Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qnativeinterface_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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 reason:default
4
5#ifndef QNATIVEINTERFACE_P_H
6#define QNATIVEINTERFACE_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 <QtCore/private/qglobal_p.h>
20#include <QtCore/qloggingcategory.h>
21
23
24QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY(lcNativeInterface, Q_CORE_EXPORT)
25
26// Provides a definition for the interface destructor
27#define QT_DEFINE_NATIVE_INTERFACE_2(Namespace, InterfaceClass)
28 QT_PREPEND_NAMESPACE(Namespace)::InterfaceClass::~InterfaceClass() = default
29
30#define QT_DEFINE_NATIVE_INTERFACE(...)
31 QT_OVERLOADED_MACRO(QT_DEFINE_NATIVE_INTERFACE, QNativeInterface, __VA_ARGS__)
32#define QT_DEFINE_PRIVATE_NATIVE_INTERFACE(...)
33 QT_OVERLOADED_MACRO(QT_DEFINE_NATIVE_INTERFACE, QNativeInterface::Private, __VA_ARGS__)
34
35#define QT_NATIVE_INTERFACE_RETURN_IF(NativeInterface, baseType)
36 {
37 using QNativeInterface::Private::TypeInfo;
38 qCDebug(lcNativeInterface, "Comparing requested interface name %s with available %s",
39 name, TypeInfo<NativeInterface>::name());
40 if (qstrcmp(name, TypeInfo<NativeInterface>::name()) == 0) {
41 qCDebug(lcNativeInterface,
42 "Match for interface %s. Comparing revisions (requested %d / available %d)",
43 name, revision, TypeInfo<NativeInterface>::revision());
44 if (revision == TypeInfo<NativeInterface>::revision()) {
45 qCDebug(lcNativeInterface, "Full match. Returning dynamic cast of %p", baseType);
46 return dynamic_cast<NativeInterface *>(baseType);
47 } else {
48 qCWarning(lcNativeInterface,
49 "Native interface revision mismatch (requested %d / available %d) for "
50 "interface %s",
51 revision, TypeInfo<NativeInterface>::revision(), name);
52 return nullptr;
53 }
54 } else {
55 qCDebug(lcNativeInterface, "No match for requested interface name %s", name);
56 }
57 }
58
59QT_END_NAMESPACE
60
61#endif // QNATIVEINTERFACE_P_H
Combined button and popup list for selecting options.
constexpr qsizetype lengthHelperPointer(const Char *data) noexcept
QByteArrayView qToByteArrayViewIgnoringNull(const QByteArrayLike &b) noexcept
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
#define __has_builtin(x)
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION unsigned int qt_int_sqrt(unsigned int n)
\inmodule QtCore \title Global Qt Declarations
Definition qglobal.cpp:100
#define QT_DECLARE_NATIVE_INTERFACE(...)
#define QT_DECLARE_NATIVE_INTERFACE_3(NativeInterface, Revision, BaseType)
#define QT_DEFINE_NATIVE_INTERFACE(...)
QList< QList< qInternalCallback > > callbacks
Definition qglobal.cpp:129
static constexpr char const * name()
static constexpr bool isCompatibleHelper()