Delete the "Any-to-Any" template specializations for LIBO_INTERNAL_ONLY
i.e., css::uno::Any function template specializations Any::has<Any>() const Any::get(Any const &) const operator >>=(Any const &, Any &) operator <<=(Any &, Any const &) that don't make much sense (the first is always true, the rest can be replaced with operator =, which additionally supports move semantics). For 3rd-party compatibility, do this only for LIBO_INTERNAL_ONLY, however. However, some generic template code did benefit from operator >>= working also for Any, so make up for that with a new (LIBO_INTERNAL_ONLY, given that operator >>= still covers if fine for !LIBO_INTERNAL_ONLY) fromAny, complementing the existing toAny. Change-Id: I8b1b5f803f0b909808159916366d53c948206a88 Reviewed-on: https://gerrit.libreoffice.org/30022 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -3621,10 +3621,12 @@ void ServiceType::dumpHppFile(
|
||||
u2b(j.name), "param",
|
||||
codemaker::cpp::IdentifierTranslationMode::NonGlobal));
|
||||
sal_Int32 rank;
|
||||
if (m_typeMgr->getSort(
|
||||
b2u(codemaker::UnoType::decompose(
|
||||
u2b(j.type), &rank)))
|
||||
== codemaker::UnoType::Sort::Char)
|
||||
if (resolveOuterTypedefs(j.type) == "any") {
|
||||
o << "= " << param;
|
||||
} else if (m_typeMgr->getSort(
|
||||
b2u(codemaker::UnoType::decompose(
|
||||
u2b(j.type), &rank)))
|
||||
== codemaker::UnoType::Sort::Char)
|
||||
{
|
||||
o << "= ::css::uno::Any(&" << param
|
||||
<< ", ::cppu::UnoType< ";
|
||||
|
||||
@@ -43,7 +43,7 @@ inline void extract(
|
||||
OUString( "No such argument available!"),
|
||||
xErrorContext, static_cast<sal_Int16>(nArg) );
|
||||
}
|
||||
if (! (seq[nArg] >>= v)) {
|
||||
if (! fromAny(seq[nArg], &v)) {
|
||||
OUStringBuffer buf;
|
||||
buf.append( "Cannot extract ANY { " );
|
||||
buf.append( seq[nArg].getValueType().getTypeName() );
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
|
||||
$(eval $(call gb_CppunitTest_CppunitTest,cppu_any-external))
|
||||
|
||||
$(eval $(call gb_CppunitTest_add_exception_objects,cppu_any-external, \
|
||||
cppu/qa/any-external \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_set_external_code,cppu_any-external))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_libraries,cppu_any-external, \
|
||||
cppu \
|
||||
sal \
|
||||
$(gb_UWINAPI) \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_udk_api,cppu_any-external))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
@@ -21,6 +21,7 @@ $(eval $(call gb_Module_add_targets,cppu,\
|
||||
))
|
||||
|
||||
$(eval $(call gb_Module_add_check_targets,cppu,\
|
||||
CppunitTest_cppu_any-external \
|
||||
CppunitTest_cppu_qa_any \
|
||||
CppunitTest_cppu_qa_recursion \
|
||||
CppunitTest_cppu_qa_reference \
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <cppunit/TestAssert.h>
|
||||
#include <cppunit/TestFixture.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include <cppunit/plugin/TestPlugIn.h>
|
||||
|
||||
#include <com/sun/star/uno/Any.hxx>
|
||||
#include <sal/types.h>
|
||||
|
||||
namespace {
|
||||
|
||||
class Test: public CppUnit::TestFixture {
|
||||
private:
|
||||
CPPUNIT_TEST_SUITE(Test);
|
||||
CPPUNIT_TEST(testGet);
|
||||
CPPUNIT_TEST(testHas);
|
||||
CPPUNIT_TEST(testExtract);
|
||||
CPPUNIT_TEST(testInsert);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
void testGet() {
|
||||
css::uno::Any a(false);
|
||||
CPPUNIT_ASSERT_EQUAL(a, a.get<css::uno::Any>());
|
||||
CPPUNIT_ASSERT_EQUAL(false, a.get<bool>());
|
||||
}
|
||||
|
||||
void testHas() {
|
||||
css::uno::Any a(false);
|
||||
CPPUNIT_ASSERT_EQUAL(true, a.has<css::uno::Any>());
|
||||
CPPUNIT_ASSERT_EQUAL(true, a.has<bool>());
|
||||
}
|
||||
|
||||
void testExtract() {
|
||||
css::uno::Any a1(false);
|
||||
css::uno::Any a2;
|
||||
CPPUNIT_ASSERT(a1 >>= a2);
|
||||
CPPUNIT_ASSERT_EQUAL(a1, a2);
|
||||
}
|
||||
|
||||
void testInsert() {
|
||||
css::uno::Any a;
|
||||
a <<= css::uno::Any(false);
|
||||
CPPUNIT_ASSERT_EQUAL(css::uno::Any(false), a);
|
||||
}
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
@@ -286,10 +286,6 @@ void Test::testVoid() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -376,10 +372,6 @@ void Test::testBoolean() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -471,10 +463,6 @@ void Test::testByte() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -566,10 +554,6 @@ void Test::testShort() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -663,10 +647,6 @@ void Test::testUnsignedShort() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -754,10 +734,6 @@ void Test::testLong() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -845,10 +821,6 @@ void Test::testUnsignedLong() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -936,10 +908,6 @@ void Test::testHyper() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -1027,10 +995,6 @@ void Test::testUnsignedHyper() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -1118,10 +1082,6 @@ void Test::testFloat() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -1209,10 +1169,6 @@ void Test::testDouble() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -1305,10 +1261,6 @@ void Test::testChar() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -1396,10 +1348,6 @@ void Test::testString() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -1486,10 +1434,6 @@ void Test::testType() {
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
"css::uno::Type", (a >>= b) && b == cppu::UnoType<sal_Int32>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -1580,10 +1524,6 @@ void Test::testSequence() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -1677,10 +1617,6 @@ void Test::testEnum() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -1772,10 +1708,6 @@ void Test::testStruct() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -1888,10 +1820,6 @@ void Test::testException() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -1998,10 +1926,6 @@ void Test::testInterface() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
@@ -2106,10 +2030,6 @@ void Test::testNull() {
|
||||
"css::uno::Type",
|
||||
!(a >>= b) && b == cppu::UnoType<OUString>::get());
|
||||
}
|
||||
{
|
||||
css::uno::Any b(rtl::OUString("2"));
|
||||
CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
|
||||
}
|
||||
{
|
||||
css::uno::Sequence< rtl::OUString > b(2);
|
||||
CPPUNIT_ASSERT_MESSAGE(
|
||||
|
||||
@@ -304,8 +304,7 @@ css::uno::Any SAL_CALL VistaFilePicker::getValue(::sal_Int16 nControlId ,
|
||||
rRequest->setArgument(PROP_CONTROL_ACTION, nControlAction);
|
||||
|
||||
m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::BLOCKED);
|
||||
const css::uno::Any aValue = rRequest->getArgumentOrDefault(PROP_CONTROL_VALUE, css::uno::Any());
|
||||
return aValue;
|
||||
return rRequest->getValue(PROP_CONTROL_VALUE);
|
||||
}
|
||||
|
||||
void SAL_CALL VistaFilePicker::enableControl(::sal_Int16 nControlId,
|
||||
|
||||
@@ -1055,7 +1055,7 @@ void VistaFilePickerImpl::impl_sta_SetControlValue(const RequestRef& rRequest)
|
||||
{
|
||||
::sal_Int16 nId = rRequest->getArgumentOrDefault(PROP_CONTROL_ID , INVALID_CONTROL_ID );
|
||||
::sal_Int16 nAction = rRequest->getArgumentOrDefault(PROP_CONTROL_ACTION, INVALID_CONTROL_ACTION);
|
||||
css::uno::Any aValue = rRequest->getArgumentOrDefault(PROP_CONTROL_VALUE , css::uno::Any() );
|
||||
css::uno::Any aValue = rRequest->getValue(PROP_CONTROL_VALUE);
|
||||
|
||||
// don't check for right values here ...
|
||||
// most parameters are optional !
|
||||
|
||||
@@ -94,6 +94,10 @@ class Request
|
||||
return m_lArguments.getUnpackedValueOrDefault(sName, aDefault);
|
||||
}
|
||||
|
||||
css::uno::Any getValue(OUString const & key) const
|
||||
{
|
||||
return m_lArguments.getValue(key);
|
||||
}
|
||||
|
||||
void wait(::sal_Int32 nMilliSeconds = WAIT_INFINITE);
|
||||
|
||||
|
||||
@@ -326,6 +326,31 @@ template<typename T> inline Any toAny(T const & value);
|
||||
|
||||
template<> inline Any toAny(Any const & value);
|
||||
|
||||
#if defined LIBO_INTERNAL_ONLY
|
||||
|
||||
/** Extract a value from an Any, if necessary.
|
||||
|
||||
The difference to operator >>= is that operator >>= cannot be called with an
|
||||
Any as right-hand side (in LIBO_INTERNAL_ONLY), while fromAny just passes on
|
||||
the given Any (and always succeeds) in the specialization for T = Any.
|
||||
|
||||
@tparam T any type representing a UNO type
|
||||
|
||||
@param any any Any value
|
||||
|
||||
@param value a non-null pointer, receiving the extracted value if
|
||||
extraction succeeded (and left unmodified otherwise)
|
||||
|
||||
@return true iff extraction succeeded
|
||||
|
||||
@since LibreOffice 5.3
|
||||
*/
|
||||
template<typename T> inline bool fromAny(Any const & any, T * value);
|
||||
|
||||
template<> inline bool fromAny(Any const & any, Any * value);
|
||||
|
||||
#endif
|
||||
|
||||
class BaseReference;
|
||||
|
||||
/** Template binary <<= operator to set the value of an any.
|
||||
@@ -423,8 +448,10 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value );
|
||||
template<>
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const Type & value );
|
||||
// any
|
||||
#if !defined LIBO_INTERNAL_ONLY
|
||||
template<>
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value );
|
||||
#endif
|
||||
// interface
|
||||
template<>
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value );
|
||||
|
||||
@@ -203,6 +203,10 @@ inline bool Any::has() const
|
||||
cpp_release );
|
||||
}
|
||||
|
||||
#if defined LIBO_INTERNAL_ONLY
|
||||
template<> bool Any::has<Any>() const = delete;
|
||||
#endif
|
||||
|
||||
inline bool Any::operator == ( const Any & rAny ) const
|
||||
{
|
||||
return ::uno_type_equalData(
|
||||
@@ -233,6 +237,21 @@ template<typename T> Any toAny(T const & value) { return makeAny(value); }
|
||||
|
||||
template<> Any toAny(Any const & value) { return value; }
|
||||
|
||||
#if defined LIBO_INTERNAL_ONLY
|
||||
|
||||
template<typename T> bool fromAny(Any const & any, T * value) {
|
||||
assert(value != nullptr);
|
||||
return any >>= *value;
|
||||
}
|
||||
|
||||
template<> bool fromAny(Any const & any, Any * value) {
|
||||
assert(value != nullptr);
|
||||
*value = any;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template< class C >
|
||||
inline void SAL_CALL operator <<= ( Any & rAny, const C & value )
|
||||
{
|
||||
@@ -266,6 +285,10 @@ inline void SAL_CALL operator <<= ( Any & rAny, const rtl::OUStringConcat< C1, C
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined LIBO_INTERNAL_ONLY
|
||||
template<> void SAL_CALL operator <<=(Any &, Any const &) = delete;
|
||||
#endif
|
||||
|
||||
template< class C >
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, C & value )
|
||||
{
|
||||
@@ -566,6 +589,9 @@ inline bool SAL_CALL operator == ( const Any & rAny, const Type & value )
|
||||
}
|
||||
// any
|
||||
|
||||
#if defined LIBO_INTERNAL_ONLY
|
||||
template<> bool SAL_CALL operator >>=(Any const &, Any &) = delete;
|
||||
#else
|
||||
template<>
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value )
|
||||
{
|
||||
@@ -577,6 +603,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value )
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
// interface
|
||||
|
||||
template<>
|
||||
@@ -623,6 +650,10 @@ T Any::get() const
|
||||
return value;
|
||||
}
|
||||
|
||||
#if defined LIBO_INTERNAL_ONLY
|
||||
template<> Any Any::get() const = delete;
|
||||
#endif
|
||||
|
||||
/**
|
||||
Support for Any in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO
|
||||
macros, for example).
|
||||
|
||||
@@ -26,7 +26,7 @@ template<typename T> css::beans::PropertyValue makePropertyValue(const OUString&
|
||||
{
|
||||
css::beans::PropertyValue aValue;
|
||||
aValue.Name = rName;
|
||||
aValue.Value <<= rValue;
|
||||
aValue.Value = css::uno::toAny(rValue);
|
||||
return aValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace detail {
|
||||
return unwrapArgsError( OUString( "No such argument available!"),
|
||||
nArg, args... );
|
||||
}
|
||||
if( ! ( seq[nArg] >>= v ) )
|
||||
if( !fromAny( seq[nArg], &v ) )
|
||||
{
|
||||
OUStringBuffer buf;
|
||||
buf.append( "Cannot extract ANY { " );
|
||||
|
||||
@@ -316,7 +316,7 @@ namespace slideshow
|
||||
try {
|
||||
const css::uno::Any& a(
|
||||
xPropSet->getPropertyValue( propName ) );
|
||||
bool const bRet = (a >>= rValue);
|
||||
bool const bRet = css::uno::fromAny(a, &rValue);
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
if( !bRet )
|
||||
OSL_TRACE( "%s: while retrieving property %s, cannot extract Any of type %s\n",
|
||||
|
||||
@@ -421,8 +421,8 @@ protected:
|
||||
T getProperty( const uno::Any& obj, const OUString& name ) const
|
||||
{
|
||||
uno::Reference< beans::XPropertySet > properties( obj, uno::UNO_QUERY_THROW );
|
||||
T data = T();
|
||||
if (!(properties->getPropertyValue(name) >>= data))
|
||||
T data;
|
||||
if (!css::uno::fromAny(properties->getPropertyValue(name), &data))
|
||||
{
|
||||
CPPUNIT_FAIL("the property is of unexpected type or void");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user