diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-12 12:48:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-12 14:33:02 +0100 |
commit | 138064713af2db8e797e3aa441657f6a7500cc46 (patch) | |
tree | 36a99ea8036143801207f35d3c816c60d48abbf7 /include/rtl | |
parent | 8ad6257d456c595a47669846fc3ef5337653bd03 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/rtl')
-rw-r--r-- | include/rtl/ref.hxx | 12 |
1 files changed, 12 insertions, 0 deletions
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... |