diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-04-08 17:45:08 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-04-08 17:45:08 +0200 |
commit | 9222f5d065bb2aafcfef93e77c58a82672a9ad22 (patch) | |
tree | 0dfad9f13099a73ecf3893e9cbdd5020b55cd7b3 /include/com | |
parent | c4dca26eafd60dc4c4f19e0be0b8e086108b3048 (diff) |
A UNO Any can't contain an Any
...and css::uno::makeAny<css::uno::Any>() was never meant to be used. Introduce
css::uno::toAny for the (template-code) cases that shall return an Any for both
Any and non-Any inputs.
Change-Id: Ifa977d73f1da71b2fedde7e8140b19497c4a0257
Diffstat (limited to 'include/com')
-rw-r--r-- | include/com/sun/star/uno/Any.h | 13 | ||||
-rw-r--r-- | include/com/sun/star/uno/Any.hxx | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h index 3ab2a4486647..13547409d7e8 100644 --- a/include/com/sun/star/uno/Any.h +++ b/include/com/sun/star/uno/Any.h @@ -260,6 +260,19 @@ inline Any SAL_CALL makeAny( const C & value ); template<> inline Any SAL_CALL makeAny( bool const & value ); +template<> Any SAL_CALL makeAny(Any const &) SAL_DELETED_FUNCTION; + +/** Wrap a value in an Any, if necessary. + + The difference to makeAny is that makeAny cannot be called on an Any, while + toAny just returns the given Any. + + @since LibreOffice 4.5 +*/ +template<typename T> inline Any toAny(T const & value); + +template<> inline Any toAny(Any const & value); + class BaseReference; /** Template binary <<= operator to set the value of an any. diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx index 2b314e976b6f..f4b4db91b806 100644 --- a/include/com/sun/star/uno/Any.hxx +++ b/include/com/sun/star/uno/Any.hxx @@ -204,6 +204,10 @@ inline Any SAL_CALL makeAny( const rtl::OUStringConcat< C1, C2 >& value ) } #endif +template<typename T> Any toAny(T const & value) { return makeAny(value); } + +template<> Any toAny(Any const & value) { return value; } + template< class C > inline void SAL_CALL operator <<= ( Any & rAny, const C & value ) { |