include/rtl/ref.hxx | 12 ++++++++++++
1 file changed, 12 insertions(+)
New commits:
commit 138064713af2db8e797e3aa441657f6a7500cc46
Author: Noel <[email protected]>
AuthorDate: Fri Feb 12 12:48:54 2021 +0200
Commit: Noel Grandin <[email protected]>
CommitDate: Fri Feb 12 14:33:02 2021 +0100
add conversion operator to rtl::Reference
to make it easier to convert to uno::Reference
Change-Id: I7ec1d66651e21ec71f1eef035d7ed3d6acc70b91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110810
Tested-by: Jenkins
Reviewed-by: Noel Grandin <[email protected]>
diff --git a/include/rtl/ref.hxx b/include/rtl/ref.hxx
index 37cbad4da8c0..38dfe3769e81 100644
--- a/include/rtl/ref.hxx
+++ b/include/rtl/ref.hxx
@@ -31,6 +31,7 @@
#include <functional>
#ifdef LIBO_INTERNAL_ONLY
#include <type_traits>
+#include "com/sun/star/uno/Reference.h"
#endif
#include "sal/types.h"
@@ -107,6 +108,17 @@ public:
if (m_pBody)
m_pBody->acquire();
}
+
+ /** Up-casting conversion operator to convert to css::uno::Interface
+
+ Does not work for up-casts to ambiguous bases.
+ */
+ template< class super_type,
+ std::enable_if_t<std::is_base_of_v<super_type, reference_type>, int> =
0 >
+ inline operator css::uno::Reference<super_type>() const
+ {
+ return css::uno::Reference<super_type>(m_pBody);
+ }
#endif
/** Destructor...
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits