summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-04-23 19:36:53 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-04-29 21:34:54 +0200
commit0a87d8fed89eacf74eec4dda9e7fb5ec19a32ed5 (patch)
tree8d3a673d30070e7d97709830073b03335498e5e5
parentc97ddabb78b17fa8fb568fc7511aab82f0da63c4 (diff)
Introduce cppu::getXWeak and cppu::OWeakObject::getXWeak
To avoid explicit static casts when XWeak or XInterface is needed Change-Id: I0496a5b8dcd48743bceeef9f90904811acd556cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150807 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--include/cppuhelper/weak.hxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/cppuhelper/weak.hxx b/include/cppuhelper/weak.hxx
index b8e4e9955d9b..a1a920ce4193 100644
--- a/include/cppuhelper/weak.hxx
+++ b/include/cppuhelper/weak.hxx
@@ -147,6 +147,10 @@ public:
*/
SAL_CALL operator css::uno::Reference< css::uno::XInterface > ()
{ return this; }
+
+#if defined LIBO_INTERNAL_ONLY
+ css::uno::XWeak* getXWeak() { return this; }
+#endif
};
/// @cond INTERNAL
@@ -167,6 +171,10 @@ static inline css::uno::XInterface * acquire(OWeakObject * instance)
instance->acquire();
return instance;
}
+
+#if defined LIBO_INTERNAL_ONLY
+static inline css::uno::XWeak* getXWeak(OWeakObject* instance) { return instance; }
+#endif
/// @endcond
}