summaryrefslogtreecommitdiff
path: root/cppu
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-18 18:14:14 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-11-21 19:44:56 +0000
commitbd614b91352b5a0a291f33a428c95d7bcbf34679 (patch)
tree1372effc15db45ec2fa8c9c248c9d66eacb99683 /cppu
parent05d175a8efceccd684c9e3d7f428073f1b142346 (diff)
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>
Diffstat (limited to 'cppu')
-rw-r--r--cppu/CppunitTest_cppu_any-external.mk26
-rw-r--r--cppu/Module_cppu.mk1
-rw-r--r--cppu/qa/any-external.cxx63
-rw-r--r--cppu/qa/test_any.cxx80
4 files changed, 90 insertions, 80 deletions
diff --git a/cppu/CppunitTest_cppu_any-external.mk b/cppu/CppunitTest_cppu_any-external.mk
new file mode 100644
index 000000000000..6119e048ba99
--- /dev/null
+++ b/cppu/CppunitTest_cppu_any-external.mk
@@ -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:
diff --git a/cppu/Module_cppu.mk b/cppu/Module_cppu.mk
index 51abe4dafb47..d5c47c88a2b6 100644
--- a/cppu/Module_cppu.mk
+++ b/cppu/Module_cppu.mk
@@ -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 \
diff --git a/cppu/qa/any-external.cxx b/cppu/qa/any-external.cxx
new file mode 100644
index 000000000000..bac61342786c
--- /dev/null
+++ b/cppu/qa/any-external.cxx
@@ -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: */
diff --git a/cppu/qa/test_any.cxx b/cppu/qa/test_any.cxx
index 5959974b0c6e..b6b69eaf9e6b 100644
--- a/cppu/qa/test_any.cxx
+++ b/cppu/qa/test_any.cxx
@@ -287,10 +287,6 @@ void Test::testVoid() {
!(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(
"css::uno::Sequence<rtl::OUString>", !(a >>= b) && b.getLength() == 2);
@@ -377,10 +373,6 @@ void Test::testBoolean() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -472,10 +464,6 @@ void Test::testByte() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -567,10 +555,6 @@ void Test::testShort() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -664,10 +648,6 @@ void Test::testUnsignedShort() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -755,10 +735,6 @@ void Test::testLong() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -846,10 +822,6 @@ void Test::testUnsignedLong() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -937,10 +909,6 @@ void Test::testHyper() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -1028,10 +996,6 @@ void Test::testUnsignedHyper() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -1119,10 +1083,6 @@ void Test::testFloat() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -1210,10 +1170,6 @@ void Test::testDouble() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -1306,10 +1262,6 @@ void Test::testChar() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -1397,10 +1349,6 @@ void Test::testString() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -1487,10 +1435,6 @@ void Test::testType() {
"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(
"css::uno::Sequence<rtl::OUString>",
@@ -1581,10 +1525,6 @@ void Test::testSequence() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -1678,10 +1618,6 @@ void Test::testEnum() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -1773,10 +1709,6 @@ void Test::testStruct() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -1889,10 +1821,6 @@ void Test::testException() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -1999,10 +1927,6 @@ void Test::testInterface() {
!(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(
"css::uno::Sequence<rtl::OUString>",
@@ -2107,10 +2031,6 @@ void Test::testNull() {
!(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(
"css::uno::Sequence<rtl::OUString>",