summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/com/sun/star/uno/Reference.h16
-rw-r--r--include/com/sun/star/uno/Reference.hxx14
2 files changed, 30 insertions, 0 deletions
diff --git a/include/com/sun/star/uno/Reference.h b/include/com/sun/star/uno/Reference.h
index 85c0d929ea9c..1a6e6a10cee5 100644
--- a/include/com/sun/star/uno/Reference.h
+++ b/include/com/sun/star/uno/Reference.h
@@ -559,6 +559,22 @@ public:
@return interface reference of demanded type (may be null)
*/
SAL_WARN_UNUSED_RESULT inline static Reference< interface_type > SAL_CALL query( XInterface * pInterface );
+#if defined LIBO_INTERNAL_ONLY
+ /** Queries this for the required interface, and returns the requested reference, possibly empty.
+ A syntactic sugar for 'Reference< other_type > xOther(xThis, UNO_QUERY)' that avoids some
+ verbocity.
+
+ @return new reference
+ */
+ template< class other_type > inline Reference< other_type > query();
+ /** Queries this for the required interface, and returns the requested reference, or throws
+ on failure. A syntactic sugar for 'Reference< other_type > xOther(xThis, UNO_QUERY_THROW)'
+ that avoids some verbocity.
+
+ @return new reference
+ */
+ template< class other_type > inline Reference< other_type > queryThrow();
+#endif
};
}
diff --git a/include/com/sun/star/uno/Reference.hxx b/include/com/sun/star/uno/Reference.hxx
index 7632c55045ca..12511d7d280f 100644
--- a/include/com/sun/star/uno/Reference.hxx
+++ b/include/com/sun/star/uno/Reference.hxx
@@ -385,6 +385,20 @@ inline Reference< interface_type > Reference< interface_type >::query(
castFromXInterface(iquery( pInterface )), SAL_NO_ACQUIRE );
}
+#if defined LIBO_INTERNAL_ONLY
+template< class interface_type > template< class other_type >
+inline Reference< other_type > Reference< interface_type >::query()
+{
+ return Reference< other_type >(*this, UNO_QUERY);
+}
+
+template< class interface_type > template< class other_type >
+inline Reference< other_type > Reference< interface_type >::queryThrow()
+{
+ return Reference< other_type >(*this, UNO_QUERY_THROW);
+}
+#endif
+
inline bool BaseReference::operator == ( XInterface * pInterface ) const
{