diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-10-07 12:11:46 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-10-07 13:03:27 +0200 |
commit | 0efe79f80d6f249040f47162ebbfc82289ca073d (patch) | |
tree | b2326e1c7392367e438a16370f4cfb0ad63b09a0 /src/corelib/global/qglobal.h | |
parent | 4ef79853528dcc908ad3737f7bebf38b059de959 (diff) |
Rename the new platform APIs from QPlatformInterface to QNativeInterface
We were already using the 'native' nomenclature when referring to these
kinds of APIs, e.g. when talking about native handles, or the existing
QPlatformNativeInterface on a QPA level. Using 'native' for the user
facing APIs also distinguishes them from the 'platform' backend layer
in QPA and elsewhere.
Change-Id: I0f3273265904f0f19c0b6d62471f8820d3c3232e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r-- | src/corelib/global/qglobal.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index fa8193853f..25c31e4067 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1284,21 +1284,26 @@ inline int qIntCast(float f) { return int(f); } // Ensures that the interface's typeinfo is exported so that // dynamic casts work reliably, and protects the destructor // so that pointers to the interface can't be deleted. -#define QT_DECLARE_PLATFORM_INTERFACE(InterfaceClass) \ +#define QT_DECLARE_NATIVE_INTERFACE(InterfaceClass) \ protected: virtual ~InterfaceClass(); public: +// Declares an accessor for the native interface +#define QT_DECLARE_NATIVE_INTERFACE_ACCESSOR \ + template <typename NativeInterface> \ + NativeInterface *nativeInterface() const; + // Provides a definition for the interface destructor -#define QT_DEFINE_PLATFORM_INTERFACE2(Namespace, InterfaceClass) \ +#define QT_DEFINE_NATIVE_INTERFACE2(Namespace, InterfaceClass) \ QT_PREPEND_NAMESPACE(Namespace)::InterfaceClass::~InterfaceClass() = default // Provides a definition for the destructor, and an explicit -// template instantiation of the platform interface accessor. -#define QT_DEFINE_PLATFORM_INTERFACE3(Namespace, InterfaceClass, PublicClass) \ - QT_DEFINE_PLATFORM_INTERFACE2(Namespace, InterfaceClass); \ - template Q_DECL_EXPORT QT_PREPEND_NAMESPACE(Namespace)::InterfaceClass *PublicClass::platformInterface() const +// template instantiation of the native interface accessor. +#define QT_DEFINE_NATIVE_INTERFACE3(Namespace, InterfaceClass, PublicClass) \ + QT_DEFINE_NATIVE_INTERFACE2(Namespace, InterfaceClass); \ + template Q_DECL_EXPORT QT_PREPEND_NAMESPACE(Namespace)::InterfaceClass *PublicClass::nativeInterface() const -#define QT_DEFINE_PLATFORM_INTERFACE(...) QT_OVERLOADED_MACRO(QT_DEFINE_PLATFORM_INTERFACE, QPlatformInterface, __VA_ARGS__) -#define QT_DEFINE_PRIVATE_PLATFORM_INTERFACE(...) QT_OVERLOADED_MACRO(QT_DEFINE_PLATFORM_INTERFACE, QPlatformInterface::Private, __VA_ARGS__) +#define QT_DEFINE_NATIVE_INTERFACE(...) QT_OVERLOADED_MACRO(QT_DEFINE_NATIVE_INTERFACE, QNativeInterface, __VA_ARGS__) +#define QT_DEFINE_PRIVATE_NATIVE_INTERFACE(...) QT_OVERLOADED_MACRO(QT_DEFINE_NATIVE_INTERFACE, QNativeInterface::Private, __VA_ARGS__) // This macro can be used to calculate member offsets for types with a non standard layout. // It uses the fact that offsetof() is allowed to support those types since C++17 as an optional |