diff options
| author | Miguel Costa <miguel.costa@qt.io> | 2023-05-17 17:57:01 +0200 |
|---|---|---|
| committer | Miguel Costa <miguel.costa@qt.io> | 2023-06-12 11:03:35 +0000 |
| commit | 8e3a43c0db50774b7b8b661f6a812e37e2408ab3 (patch) | |
| tree | 0d9f9b8e2fd0c333d06f8f228ade4f0f37ec2ec6 /include/qdotnetfunction.h | |
| parent | 36f17aa80578620338705905b5a73166faf92307 (diff) | |
Add wrapper facilities for .NET types
Auxiliary types for writing C++ wrapper classes to encapsulate the
low-level interoperability with managed types.
In particular, the QDotNetObject C++ class can be extended to implement
unmanaged proxies for .NET types, allowing native code to seamlessly
interact through a C++ interface with managed code.
Extending both QDotNetObject and QObject in the same wrapper class is
the basis for a close, seamless integration between Qt applications
and .NET code.
Change-Id: Ib6d9472ff113868551ead1375764db7dd79643ea
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'include/qdotnetfunction.h')
| -rw-r--r-- | include/qdotnetfunction.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/qdotnetfunction.h b/include/qdotnetfunction.h index 531a795..b2b2168 100644 --- a/include/qdotnetfunction.h +++ b/include/qdotnetfunction.h @@ -42,6 +42,17 @@ public: return QDotNetInbound<T>::convert(funcPtr(QDotNetOutbound<TArg>::convert(arg)...)); } + typename QDotNetInbound<T>::TargetType invoke(const QDotNetRef &obj, + typename QDotNetOutbound<TArg>::SourceType... arg) const + { + return operator()(arg...); + } + typename QDotNetInbound<T>::TargetType invoke(nullptr_t nullObj, + typename QDotNetOutbound<TArg>::SourceType... arg) const + { + return operator()(arg...); + } + private: using Delegate = typename QDotNetInbound<T>::InboundType(QDOTNETFUNCTION_CALLTYPE *)( typename QDotNetOutbound<TArg>::OutboundType...); @@ -65,6 +76,15 @@ public: funcPtr(QDotNetOutbound<TArg>::convert(arg)...); } + void invoke(const QDotNetRef &obj, typename QDotNetOutbound<TArg>::SourceType... arg) const + { + operator()(arg...); + } + void invoke(nullptr_t nullObj, typename QDotNetOutbound<TArg>::SourceType... arg) const + { + operator()(arg...); + } + private: using Delegate = void(QDOTNETFUNCTION_CALLTYPE *)( typename QDotNetOutbound<TArg>::OutboundType...); |
