summaryrefslogtreecommitdiff
path: root/include/com
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-05-05 11:42:23 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-05-05 14:26:32 +0200
commitabac7828ae85ecb42e73e83141f6e6c475b66db2 (patch)
tree6193de3f3ed7fa8cc385207d7dfcb11d984b1a23 /include/com
parent6e2e8b1fe932fef6cf4d5bf7ccda604dfc2f70ad (diff)
Deprecate css::uno::makeAny; completely disable it for LIBO_INTERNAL_ONLY
There is just no good reason not to use a css::uno::Any constructor instead, so simplify the code base. For URE backwards compatibility, keep it around as deprecated for !LIBO_INTERNAL_ONLY. Change-Id: I9409d8853cac270d47377a31ba35a1fc23fa9800 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133879 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/com')
-rw-r--r--include/com/sun/star/uno/Any.h16
-rw-r--r--include/com/sun/star/uno/Any.hxx18
2 files changed, 14 insertions, 20 deletions
diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h
index e2fc8af41f62..123952142517 100644
--- a/include/com/sun/star/uno/Any.h
+++ b/include/com/sun/star/uno/Any.h
@@ -48,7 +48,7 @@ class Type;
/** C++ class representing an IDL any.
This class is used to transport any type defined in IDL. The class inherits from the
binary C representation of uno_Any.
- You can insert a value by either using the <<= operators or the template function makeAny().
+ You can insert a value by using the <<= operators.
No any can hold an any. You can extract values from an any by using the >>= operators which
return true if the any contains an assignable value (no data loss), e.g. the any contains a
short and you >>= it into a long variable.
@@ -303,12 +303,13 @@ template<> bool Any::has<sal_uInt16>() const SAL_DELETED_FUNCTION;
/// @endcond
#endif
+#if !defined LIBO_INTERNAL_ONLY
/** Template function to generically construct an any from a C++ value.
- This can be useful with an explicitly specified template parameter, when the
+ @deprecated Just use an Any constructor with an appropriately typed argument. (When the
(UNO) type recorded in the Any instance shall be different from what would
- be deduced from the (C++) type of the argument if no template parameter were
- specified explicitly.
+ be deduced from the (C++) type of the argument, cast the argument to the appropriate type
+ first.)
@tparam C value type
@param value a value
@@ -317,16 +318,15 @@ template<> bool Any::has<sal_uInt16>() const SAL_DELETED_FUNCTION;
template< class C >
inline Any SAL_CALL makeAny( const C & value );
-#if !defined LIBO_INTERNAL_ONLY
template<> inline Any SAL_CALL makeAny(sal_uInt16 const & value);
-#endif
template<> Any SAL_CALL makeAny(Any const &) SAL_DELETED_FUNCTION;
+#endif
/** 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.
+ (A difference to the deprecated makeAny is that makeAny cannot be called on an Any, while
+ toAny just returns the given Any.)
@since LibreOffice 5.0
*/
diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx
index 1427cb4c14f6..5613269c2b57 100644
--- a/include/com/sun/star/uno/Any.hxx
+++ b/include/com/sun/star/uno/Any.hxx
@@ -230,38 +230,32 @@ inline bool Any::operator != ( const Any & rAny ) const
}
+#if !defined LIBO_INTERNAL_ONLY
template< class C >
inline Any SAL_CALL makeAny( const C & value )
{
return Any(value);
}
-#if !defined LIBO_INTERNAL_ONLY
template<> Any makeAny(sal_uInt16 const & value)
{ return Any(&value, cppu::UnoType<cppu::UnoUnsignedShortType>::get()); }
#endif
-template<typename T> Any toAny(T const & value) { return makeAny(value); }
+template<typename T> Any toAny(T const & value) {
+ return Any(value);
+}
template<> Any toAny(Any const & value) { return value; }
#if defined LIBO_INTERNAL_ONLY
template<typename T1, typename T2>
-Any makeAny(rtl::OUStringConcat<T1, T2> && value)
-{ return Any(std::move(value)); }
-
-template<typename T1, typename T2>
Any toAny(rtl::OUStringConcat<T1, T2> && value)
-{ return makeAny(std::move(value)); }
-
-template<typename T>
-Any makeAny(rtl::OUStringNumber<T> && value)
-{ return Any(OUString(std::move(value))); }
+{ return Any(std::move(value)); }
template<typename T>
Any toAny(rtl::OUStringNumber<T> && value)
-{ return makeAny(std::move(value)); }
+{ return Any(std::move(value)); }
template<typename T> bool fromAny(Any const & any, T * value) {
assert(value != nullptr);