summaryrefslogtreecommitdiffstats
path: root/cppu/qa
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /cppu/qa
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cppu/qa')
-rw-r--r--cppu/qa/any-external.cxx63
-rw-r--r--cppu/qa/cppumaker/test_cppumaker.cxx559
-rw-r--r--cppu/qa/cppumaker/types.idl710
-rw-r--r--cppu/qa/test_any.cxx2578
-rw-r--r--cppu/qa/test_recursion.cxx53
-rw-r--r--cppu/qa/test_reference.cxx203
-rw-r--r--cppu/qa/test_unotype.cxx558
-rw-r--r--cppu/qa/typelib.cxx293
-rw-r--r--cppu/qa/types.idl57
9 files changed, 5074 insertions, 0 deletions
diff --git a/cppu/qa/any-external.cxx b/cppu/qa/any-external.cxx
new file mode 100644
index 000000000..bac613427
--- /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/cppumaker/test_cppumaker.cxx b/cppu/qa/cppumaker/test_cppumaker.cxx
new file mode 100644
index 000000000..a6d3e4942
--- /dev/null
+++ b/cppu/qa/cppumaker/test_cppumaker.cxx
@@ -0,0 +1,559 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/types.h>
+
+#include <FILE.hpp>
+#include <lconv.hpp>
+#include <tm.hpp>
+#include <std.hpp>
+#include <test/codemaker/cppumaker/XTest.hpp>
+#include <test/codemaker/cppumaker/S1.hpp>
+#include <test/codemaker/cppumaker/services/asm.hpp>
+#include <test/codemaker/cppumaker/services/auto.hpp>
+#include <test/codemaker/cppumaker/services/bool.hpp>
+#include <test/codemaker/cppumaker/services/break.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/case.hpp"
+#include <test/codemaker/cppumaker/services/catch.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/char.hpp"
+#include <test/codemaker/cppumaker/services/class.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/const.hpp"
+#include <test/codemaker/cppumaker/services/continue.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/default.hpp"
+#include <test/codemaker/cppumaker/services/delete.hpp>
+#include <test/codemaker/cppumaker/services/do.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/double.hpp"
+#include <test/codemaker/cppumaker/services/else.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/enum.hpp"
+#include <test/codemaker/cppumaker/services/explicit.hpp>
+#include <test/codemaker/cppumaker/services/export.hpp>
+#include <test/codemaker/cppumaker/services/extern.hpp>
+#include <test/codemaker/cppumaker/services/false.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/float.hpp"
+#include <test/codemaker/cppumaker/services/for.hpp>
+#include <test/codemaker/cppumaker/services/friend.hpp>
+#include <test/codemaker/cppumaker/services/goto.hpp>
+#include <test/codemaker/cppumaker/services/if.hpp>
+#include <test/codemaker/cppumaker/services/inline.hpp>
+#include <test/codemaker/cppumaker/services/int.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/long.hpp"
+#include <test/codemaker/cppumaker/services/mutable.hpp>
+#include <test/codemaker/cppumaker/services/namespace.hpp>
+#include <test/codemaker/cppumaker/services/new.hpp>
+#include <test/codemaker/cppumaker/services/operator.hpp>
+#include <test/codemaker/cppumaker/services/private.hpp>
+#include <test/codemaker/cppumaker/services/protected.hpp>
+#include <test/codemaker/cppumaker/services/public.hpp>
+#include <test/codemaker/cppumaker/services/register.hpp>
+#include <test/codemaker/cppumaker/services/return.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/short.hpp"
+#include <test/codemaker/cppumaker/services/signed.hpp>
+#include <test/codemaker/cppumaker/services/sizeof.hpp>
+#include <test/codemaker/cppumaker/services/static.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/struct.hpp"
+//TODO: #include "test/codemaker/cppumaker/services/switch.hpp"
+#include <test/codemaker/cppumaker/services/template.hpp>
+#include <test/codemaker/cppumaker/services/this.hpp>
+#include <test/codemaker/cppumaker/services/throw.hpp>
+#include <test/codemaker/cppumaker/services/true.hpp>
+#include <test/codemaker/cppumaker/services/try.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/typedef.hpp"
+#include <test/codemaker/cppumaker/services/typeid.hpp>
+#include <test/codemaker/cppumaker/services/typename.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/union.hpp"
+//TODO: #include "test/codemaker/cppumaker/services/unsigned.hpp"
+#include <test/codemaker/cppumaker/services/using.hpp>
+#include <test/codemaker/cppumaker/services/virtual.hpp>
+//TODO: #include "test/codemaker/cppumaker/services/void.hpp"
+#include <test/codemaker/cppumaker/services/volatile.hpp>
+#include <test/codemaker/cppumaker/services/while.hpp>
+#include <test/codemaker/cppumaker/services/and.hpp>
+#include <test/codemaker/cppumaker/services/bitand.hpp>
+#include <test/codemaker/cppumaker/services/bitor.hpp>
+#include <test/codemaker/cppumaker/services/compl.hpp>
+#include <test/codemaker/cppumaker/services/not.hpp>
+#include <test/codemaker/cppumaker/services/or.hpp>
+#include <test/codemaker/cppumaker/services/xor.hpp>
+#include <test/codemaker/cppumaker/services/BUFSIZ.hpp>
+#include <test/codemaker/cppumaker/services/CLOCKS_PER_SEC.hpp>
+#include <test/codemaker/cppumaker/services/EDOM.hpp>
+#include <test/codemaker/cppumaker/services/EOF.hpp>
+#include <test/codemaker/cppumaker/services/ERANGE.hpp>
+#include <test/codemaker/cppumaker/services/EXIT_FAILURE.hpp>
+#include <test/codemaker/cppumaker/services/EXIT_SUCCESS.hpp>
+#include <test/codemaker/cppumaker/services/FILENAME_MAX.hpp>
+#include <test/codemaker/cppumaker/services/FOPEN_MAX.hpp>
+#include <test/codemaker/cppumaker/services/HUGE_VAL.hpp>
+#include <test/codemaker/cppumaker/services/LC_ALL.hpp>
+#include <test/codemaker/cppumaker/services/LC_COLLATE.hpp>
+#include <test/codemaker/cppumaker/services/LC_CTYPE.hpp>
+#include <test/codemaker/cppumaker/services/LC_MONETARY.hpp>
+#include <test/codemaker/cppumaker/services/LC_NUMERIC.hpp>
+#include <test/codemaker/cppumaker/services/LC_TIME.hpp>
+#include <test/codemaker/cppumaker/services/L_tmpnam.hpp>
+#include <test/codemaker/cppumaker/services/MB_CUR_MAX.hpp>
+#include <test/codemaker/cppumaker/services/NULL.hpp>
+#include <test/codemaker/cppumaker/services/RAND_MAX.hpp>
+#include <test/codemaker/cppumaker/services/SEEK_CUR.hpp>
+#include <test/codemaker/cppumaker/services/SEEK_END.hpp>
+#include <test/codemaker/cppumaker/services/SEEK_SET.hpp>
+#include <test/codemaker/cppumaker/services/SIGABRT.hpp>
+#include <test/codemaker/cppumaker/services/SIGFPE.hpp>
+#include <test/codemaker/cppumaker/services/SIGILL.hpp>
+#include <test/codemaker/cppumaker/services/SIGINT.hpp>
+#include <test/codemaker/cppumaker/services/SIGSEGV.hpp>
+#include <test/codemaker/cppumaker/services/SIGTERM.hpp>
+#include <test/codemaker/cppumaker/services/SIG_DFL.hpp>
+#include <test/codemaker/cppumaker/services/SIG_ERR.hpp>
+#include <test/codemaker/cppumaker/services/SIG_IGN.hpp>
+#include <test/codemaker/cppumaker/services/TMP_MAX.hpp>
+#include <test/codemaker/cppumaker/services/WCHAR_MAX.hpp>
+#include <test/codemaker/cppumaker/services/WCHAR_MIN.hpp>
+#include <test/codemaker/cppumaker/services/WEOF.hpp>
+#include <test/codemaker/cppumaker/services/assert.hpp>
+#include <test/codemaker/cppumaker/services/errno.hpp>
+#include <test/codemaker/cppumaker/services/offsetof.hpp>
+#include <test/codemaker/cppumaker/services/setjmp.hpp>
+#include <test/codemaker/cppumaker/services/stderr.hpp>
+#include <test/codemaker/cppumaker/services/stdin.hpp>
+#include <test/codemaker/cppumaker/services/stdout.hpp>
+#include <test/codemaker/cppumaker/services/CHAR_BIT.hpp>
+#include <test/codemaker/cppumaker/services/CHAR_MAX.hpp>
+#include <test/codemaker/cppumaker/services/CHAR_MIN.hpp>
+#include <test/codemaker/cppumaker/services/DBL_DIG.hpp>
+#include <test/codemaker/cppumaker/services/DBL_EPSILON.hpp>
+#include <test/codemaker/cppumaker/services/DBL_MANT_DIG.hpp>
+#include <test/codemaker/cppumaker/services/DBL_MAX.hpp>
+#include <test/codemaker/cppumaker/services/DBL_MAX_10_EXP.hpp>
+#include <test/codemaker/cppumaker/services/DBL_MAX_EXP.hpp>
+#include <test/codemaker/cppumaker/services/DBL_MIN.hpp>
+#include <test/codemaker/cppumaker/services/DBL_MIN_10_EXP.hpp>
+#include <test/codemaker/cppumaker/services/DBL_MIN_EXP.hpp>
+#include <test/codemaker/cppumaker/services/FLT_DIG.hpp>
+#include <test/codemaker/cppumaker/services/FLT_EPSILON.hpp>
+#include <test/codemaker/cppumaker/services/FLT_MANT_DIG.hpp>
+#include <test/codemaker/cppumaker/services/FLT_MAX.hpp>
+#include <test/codemaker/cppumaker/services/FLT_MAX_10_EXP.hpp>
+#include <test/codemaker/cppumaker/services/FLT_MAX_EXP.hpp>
+#include <test/codemaker/cppumaker/services/FLT_MIN.hpp>
+#include <test/codemaker/cppumaker/services/FLT_MIN_10_EXP.hpp>
+#include <test/codemaker/cppumaker/services/FLT_MIN_EXP.hpp>
+#include <test/codemaker/cppumaker/services/FLT_RADIX.hpp>
+#include <test/codemaker/cppumaker/services/FLT_ROUNDS.hpp>
+#include <test/codemaker/cppumaker/services/INT_MAX.hpp>
+#include <test/codemaker/cppumaker/services/INT_MIN.hpp>
+#include <test/codemaker/cppumaker/services/LDBL_DIG.hpp>
+#include <test/codemaker/cppumaker/services/LDBL_EPSILON.hpp>
+#include <test/codemaker/cppumaker/services/LDBL_MANT_DIG.hpp>
+#include <test/codemaker/cppumaker/services/LDBL_MAX.hpp>
+#include <test/codemaker/cppumaker/services/LDBL_MAX_10_EXP.hpp>
+#include <test/codemaker/cppumaker/services/LDBL_MAX_EXP.hpp>
+#include <test/codemaker/cppumaker/services/LDBL_MIN.hpp>
+#include <test/codemaker/cppumaker/services/LDBL_MIN_10_EXP.hpp>
+#include <test/codemaker/cppumaker/services/LDBL_MIN_EXP.hpp>
+#include <test/codemaker/cppumaker/services/LONG_MAX.hpp>
+#include <test/codemaker/cppumaker/services/LONG_MIN.hpp>
+#include <test/codemaker/cppumaker/services/MB_LEN_MAX.hpp>
+#include <test/codemaker/cppumaker/services/SCHAR_MAX.hpp>
+#include <test/codemaker/cppumaker/services/SCHAR_MIN.hpp>
+#include <test/codemaker/cppumaker/services/SHRT_MAX.hpp>
+#include <test/codemaker/cppumaker/services/SHRT_MIN.hpp>
+#include <test/codemaker/cppumaker/services/UCHAR_MAX.hpp>
+#include <test/codemaker/cppumaker/services/UINT_MAX.hpp>
+#include <test/codemaker/cppumaker/services/ULONG_MAX.hpp>
+#include <test/codemaker/cppumaker/services/USHRT_MAX.hpp>
+#include <test/codemaker/cppumaker/services/FILE.hpp>
+#include <test/codemaker/cppumaker/services/lconv.hpp>
+#include <test/codemaker/cppumaker/services/tm.hpp>
+#include <test/codemaker/cppumaker/services/std.hpp>
+#include <test/codemaker/cppumaker/services/NDEBUG.hpp>
+#include <test/codemaker/cppumaker/services/create.hpp>
+#include <test/codemaker/cppumaker/singletons/asm.hpp>
+#include <test/codemaker/cppumaker/singletons/auto.hpp>
+#include <test/codemaker/cppumaker/singletons/bool.hpp>
+#include <test/codemaker/cppumaker/singletons/break.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/case.hpp"
+#include <test/codemaker/cppumaker/singletons/catch.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/char.hpp"
+#include <test/codemaker/cppumaker/singletons/class.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/const.hpp"
+#include <test/codemaker/cppumaker/singletons/continue.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/default.hpp"
+#include <test/codemaker/cppumaker/singletons/delete.hpp>
+#include <test/codemaker/cppumaker/singletons/do.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/double.hpp"
+#include <test/codemaker/cppumaker/singletons/else.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/enum.hpp"
+#include <test/codemaker/cppumaker/singletons/explicit.hpp>
+#include <test/codemaker/cppumaker/singletons/export.hpp>
+#include <test/codemaker/cppumaker/singletons/extern.hpp>
+#include <test/codemaker/cppumaker/singletons/false.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/float.hpp"
+#include <test/codemaker/cppumaker/singletons/for.hpp>
+#include <test/codemaker/cppumaker/singletons/friend.hpp>
+#include <test/codemaker/cppumaker/singletons/goto.hpp>
+#include <test/codemaker/cppumaker/singletons/if.hpp>
+#include <test/codemaker/cppumaker/singletons/inline.hpp>
+#include <test/codemaker/cppumaker/singletons/int.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/long.hpp"
+#include <test/codemaker/cppumaker/singletons/mutable.hpp>
+#include <test/codemaker/cppumaker/singletons/namespace.hpp>
+#include <test/codemaker/cppumaker/singletons/new.hpp>
+#include <test/codemaker/cppumaker/singletons/operator.hpp>
+#include <test/codemaker/cppumaker/singletons/private.hpp>
+#include <test/codemaker/cppumaker/singletons/protected.hpp>
+#include <test/codemaker/cppumaker/singletons/public.hpp>
+#include <test/codemaker/cppumaker/singletons/register.hpp>
+#include <test/codemaker/cppumaker/singletons/return.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/short.hpp"
+#include <test/codemaker/cppumaker/singletons/signed.hpp>
+#include <test/codemaker/cppumaker/singletons/sizeof.hpp>
+#include <test/codemaker/cppumaker/singletons/static.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/struct.hpp"
+//TODO: #include "test/codemaker/cppumaker/singletons/switch.hpp"
+#include <test/codemaker/cppumaker/singletons/template.hpp>
+#include <test/codemaker/cppumaker/singletons/this.hpp>
+#include <test/codemaker/cppumaker/singletons/throw.hpp>
+#include <test/codemaker/cppumaker/singletons/true.hpp>
+#include <test/codemaker/cppumaker/singletons/try.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/typedef.hpp"
+#include <test/codemaker/cppumaker/singletons/typeid.hpp>
+#include <test/codemaker/cppumaker/singletons/typename.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/union.hpp"
+//TODO: #include "test/codemaker/cppumaker/singletons/unsigned.hpp"
+#include <test/codemaker/cppumaker/singletons/using.hpp>
+#include <test/codemaker/cppumaker/singletons/virtual.hpp>
+//TODO: #include "test/codemaker/cppumaker/singletons/void.hpp"
+#include <test/codemaker/cppumaker/singletons/volatile.hpp>
+#include <test/codemaker/cppumaker/singletons/while.hpp>
+#include <test/codemaker/cppumaker/singletons/and.hpp>
+#include <test/codemaker/cppumaker/singletons/bitand.hpp>
+#include <test/codemaker/cppumaker/singletons/bitor.hpp>
+#include <test/codemaker/cppumaker/singletons/compl.hpp>
+#include <test/codemaker/cppumaker/singletons/not.hpp>
+#include <test/codemaker/cppumaker/singletons/or.hpp>
+#include <test/codemaker/cppumaker/singletons/xor.hpp>
+#include <test/codemaker/cppumaker/singletons/BUFSIZ.hpp>
+#include <test/codemaker/cppumaker/singletons/CLOCKS_PER_SEC.hpp>
+#include <test/codemaker/cppumaker/singletons/EDOM.hpp>
+#include <test/codemaker/cppumaker/singletons/EOF.hpp>
+#include <test/codemaker/cppumaker/singletons/ERANGE.hpp>
+#include <test/codemaker/cppumaker/singletons/EXIT_FAILURE.hpp>
+#include <test/codemaker/cppumaker/singletons/EXIT_SUCCESS.hpp>
+#include <test/codemaker/cppumaker/singletons/FILENAME_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/FOPEN_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/HUGE_VAL.hpp>
+#include <test/codemaker/cppumaker/singletons/LC_ALL.hpp>
+#include <test/codemaker/cppumaker/singletons/LC_COLLATE.hpp>
+#include <test/codemaker/cppumaker/singletons/LC_CTYPE.hpp>
+#include <test/codemaker/cppumaker/singletons/LC_MONETARY.hpp>
+#include <test/codemaker/cppumaker/singletons/LC_NUMERIC.hpp>
+#include <test/codemaker/cppumaker/singletons/LC_TIME.hpp>
+#include <test/codemaker/cppumaker/singletons/L_tmpnam.hpp>
+#include <test/codemaker/cppumaker/singletons/MB_CUR_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/NULL.hpp>
+#include <test/codemaker/cppumaker/singletons/RAND_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/SEEK_CUR.hpp>
+#include <test/codemaker/cppumaker/singletons/SEEK_END.hpp>
+#include <test/codemaker/cppumaker/singletons/SEEK_SET.hpp>
+#include <test/codemaker/cppumaker/singletons/SIGABRT.hpp>
+#include <test/codemaker/cppumaker/singletons/SIGFPE.hpp>
+#include <test/codemaker/cppumaker/singletons/SIGILL.hpp>
+#include <test/codemaker/cppumaker/singletons/SIGINT.hpp>
+#include <test/codemaker/cppumaker/singletons/SIGSEGV.hpp>
+#include <test/codemaker/cppumaker/singletons/SIGTERM.hpp>
+#include <test/codemaker/cppumaker/singletons/SIG_DFL.hpp>
+#include <test/codemaker/cppumaker/singletons/SIG_ERR.hpp>
+#include <test/codemaker/cppumaker/singletons/SIG_IGN.hpp>
+#include <test/codemaker/cppumaker/singletons/TMP_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/WCHAR_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/WCHAR_MIN.hpp>
+#include <test/codemaker/cppumaker/singletons/WEOF.hpp>
+#include <test/codemaker/cppumaker/singletons/assert.hpp>
+#include <test/codemaker/cppumaker/singletons/errno.hpp>
+#include <test/codemaker/cppumaker/singletons/offsetof.hpp>
+#include <test/codemaker/cppumaker/singletons/setjmp.hpp>
+#include <test/codemaker/cppumaker/singletons/stderr.hpp>
+#include <test/codemaker/cppumaker/singletons/stdin.hpp>
+#include <test/codemaker/cppumaker/singletons/stdout.hpp>
+#include <test/codemaker/cppumaker/singletons/CHAR_BIT.hpp>
+#include <test/codemaker/cppumaker/singletons/CHAR_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/CHAR_MIN.hpp>
+#include <test/codemaker/cppumaker/singletons/DBL_DIG.hpp>
+#include <test/codemaker/cppumaker/singletons/DBL_EPSILON.hpp>
+#include <test/codemaker/cppumaker/singletons/DBL_MANT_DIG.hpp>
+#include <test/codemaker/cppumaker/singletons/DBL_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/DBL_MAX_10_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/DBL_MAX_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/DBL_MIN.hpp>
+#include <test/codemaker/cppumaker/singletons/DBL_MIN_10_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/DBL_MIN_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/FLT_DIG.hpp>
+#include <test/codemaker/cppumaker/singletons/FLT_EPSILON.hpp>
+#include <test/codemaker/cppumaker/singletons/FLT_MANT_DIG.hpp>
+#include <test/codemaker/cppumaker/singletons/FLT_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/FLT_MAX_10_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/FLT_MAX_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/FLT_MIN.hpp>
+#include <test/codemaker/cppumaker/singletons/FLT_MIN_10_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/FLT_MIN_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/FLT_RADIX.hpp>
+#include <test/codemaker/cppumaker/singletons/FLT_ROUNDS.hpp>
+#include <test/codemaker/cppumaker/singletons/INT_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/INT_MIN.hpp>
+#include <test/codemaker/cppumaker/singletons/LDBL_DIG.hpp>
+#include <test/codemaker/cppumaker/singletons/LDBL_EPSILON.hpp>
+#include <test/codemaker/cppumaker/singletons/LDBL_MANT_DIG.hpp>
+#include <test/codemaker/cppumaker/singletons/LDBL_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/LDBL_MAX_10_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/LDBL_MAX_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/LDBL_MIN.hpp>
+#include <test/codemaker/cppumaker/singletons/LDBL_MIN_10_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/LDBL_MIN_EXP.hpp>
+#include <test/codemaker/cppumaker/singletons/LONG_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/LONG_MIN.hpp>
+#include <test/codemaker/cppumaker/singletons/MB_LEN_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/SCHAR_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/SCHAR_MIN.hpp>
+#include <test/codemaker/cppumaker/singletons/SHRT_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/SHRT_MIN.hpp>
+#include <test/codemaker/cppumaker/singletons/UCHAR_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/UINT_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/ULONG_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/USHRT_MAX.hpp>
+#include <test/codemaker/cppumaker/singletons/FILE.hpp>
+#include <test/codemaker/cppumaker/singletons/lconv.hpp>
+#include <test/codemaker/cppumaker/singletons/tm.hpp>
+#include <test/codemaker/cppumaker/singletons/std.hpp>
+#include <test/codemaker/cppumaker/singletons/NDEBUG.hpp>
+#include <test/codemaker/cppumaker/singletons/get.hpp>
+#include <test/codemaker/cppumaker/HelperEnum.hpp>
+#include <test/codemaker/cppumaker/HelperStruct.hpp>
+#include <test/codemaker/cppumaker/BigStruct.hpp>
+#include <test/codemaker/cppumaker/Struct.hpp>
+#include <test/codemaker/cppumaker/StructUsage.hpp>
+#include <test/codemaker/cppumaker/AlignmentDerivedStruct.hpp>
+#include <test/codemaker/cppumaker/TestException1.hpp>
+#include <test/codemaker/cppumaker/TestException2.hpp>
+#include <test/codemaker/cppumaker/Constants.hpp>
+
+#include <memory>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/uno/TypeClass.hpp>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <o3tl/cppunittraitshelper.hxx>
+#include <rtl/ustring.hxx>
+
+#include <cstddef>
+
+namespace test::codemaker::cppumaker {
+
+static bool operator ==(
+ test::codemaker::cppumaker::TestException1 const & e1,
+ test::codemaker::cppumaker::TestException1 const & e2)
+{
+ return e1.Message == e2.Message && e1.Context == e2.Context
+ && e1.m1 == e2.m1 && e1.m2 == e2.m2 && e1.m3 == e2.m3
+ && e1.m4.member1 == e2.m4.member1 && e1.m4.member2 == e2.m4.member2;
+}
+
+}
+
+namespace {
+
+class Test: public CppUnit::TestFixture {
+public:
+ void testBigStruct();
+
+ void testPolyStruct();
+
+ void testExceptions();
+
+ void testConstants();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testBigStruct);
+ CPPUNIT_TEST(testPolyStruct);
+ CPPUNIT_TEST(testExceptions);
+ CPPUNIT_TEST(testConstants);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+struct Guard {
+ explicit Guard(void * buffer):
+ p(new(buffer) test::codemaker::cppumaker::BigStruct) {}
+
+ ~Guard() { p->test::codemaker::cppumaker::BigStruct::~BigStruct(); }
+
+ test::codemaker::cppumaker::BigStruct * const p;
+};
+
+void Test::testBigStruct() {
+ // Default-initialize a BigStruct instance on top of a memory buffer filled
+ // with random data, and make sure that all members are default-initialized:
+ std::unique_ptr< char []> buffer(
+ new char[sizeof (test::codemaker::cppumaker::BigStruct)]);
+ for (std::size_t i = 0; i < sizeof (test::codemaker::cppumaker::BigStruct);
+ ++i)
+ {
+ buffer[i] = '\x56';
+ }
+ Guard guard(buffer.get());
+ CPPUNIT_ASSERT_EQUAL(sal_False, guard.p->m1);
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int8 >(0), guard.p->m2);
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int16 >(0), guard.p->m3);
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt16 >(0), guard.p->m4);
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m5);
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(0), guard.p->m6);
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int64 >(0), guard.p->m7);
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt64 >(0), guard.p->m8);
+ CPPUNIT_ASSERT_EQUAL(0.0f, guard.p->m9);
+ CPPUNIT_ASSERT_EQUAL(0.0, guard.p->m10);
+ CPPUNIT_ASSERT_EQUAL( u'\0', guard.p->m11);
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m12.getLength());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(css::uno::TypeClass_VOID), static_cast<sal_Int32>(guard.p->m13.getTypeClass()));
+ CPPUNIT_ASSERT_EQUAL(false, guard.p->m14.hasValue());
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m15.getLength());
+ CPPUNIT_ASSERT_EQUAL(int(test::codemaker::cppumaker::HelperEnum_ZERO), static_cast<int>(guard.p->m16));
+ CPPUNIT_ASSERT_EQUAL(sal_False, guard.p->m17.m1);
+ CPPUNIT_ASSERT_EQUAL(false, guard.p->m17.m2.is());
+ CPPUNIT_ASSERT_EQUAL(false, guard.p->m18.is());
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int8 >(0), guard.p->m19);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(test::codemaker::cppumaker::HelperEnum_ZERO), static_cast<sal_Int32>(guard.p->m20));
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m21.getLength());
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m22.getLength());
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m23.getLength());
+
+//This is a very platform specific test.
+#if defined __GNUC__ // see CPPU_GCC3_ALIGN
+#if defined(LINUX) && (defined (X86_64) || defined(X86) || defined(PPC))
+ static_assert(
+ sizeof (test::codemaker::cppumaker::AlignmentDerivedStruct) ==
+#if defined X86_64 || defined PPC
+ 24
+#else
+ 16
+#endif
+ );
+#endif
+#endif
+
+ css::uno::Type t(
+ cppu::UnoType< test::codemaker::cppumaker::BigStruct >::get());
+ typelib_TypeDescription * td = nullptr;
+ t.getDescription(&td);
+ typelib_typedescription_complete(&td);
+ fprintf(stdout, "#### 1\n");
+ CPPUNIT_ASSERT(td != nullptr);
+ CPPUNIT_ASSERT_EQUAL(+typelib_TypeClass_STRUCT, +td->eTypeClass);
+ typelib_StructTypeDescription * std =
+ reinterpret_cast< typelib_StructTypeDescription * >(td);
+ CPPUNIT_ASSERT_EQUAL(+typelib_TypeClass_UNSIGNED_SHORT, +std->aBase.ppTypeRefs[3]->eTypeClass); // unsigned short m4;
+ CPPUNIT_ASSERT_EQUAL(+typelib_TypeClass_CHAR, +std->aBase.ppTypeRefs[10]->eTypeClass); // char m11;
+}
+
+void Test::testPolyStruct() {
+ CPPUNIT_ASSERT_EQUAL(
+ OUString(
+ "test.codemaker.cppumaker.Struct<char,short>"),
+ (css::uno::Any(
+ test::codemaker::cppumaker::Struct< sal_Unicode, sal_Int16 >()).
+ getValueType().getTypeName()));
+
+ css::uno::Sequence< css::uno::Sequence< css::uno::Any > >
+ aEmptySequence;
+
+ CPPUNIT_ASSERT_EQUAL(
+ static_cast< sal_uInt32 >(5),
+ (test::codemaker::cppumaker::make_Struct< sal_uInt32, sal_Bool >(5,
+ aEmptySequence).member1));
+}
+
+void Test::testExceptions() {
+ css::uno::Sequence< css::uno::Sequence< css::uno::Any > >
+ aEmptySequence;
+
+ test::codemaker::cppumaker::TestException1 e11(
+ "abc", nullptr, 1,
+ css::uno::Any(123.0),
+ test::codemaker::cppumaker::HelperEnum_ONE,
+ test::codemaker::cppumaker::Struct<sal_Int32, sal_Int32>(5, aEmptySequence), 2);
+ test::codemaker::cppumaker::TestException1 e12(e11);
+ CPPUNIT_ASSERT_EQUAL(e11, e12);
+ test::codemaker::cppumaker::TestException1 e13;
+ e13 = e11;
+ CPPUNIT_ASSERT_EQUAL(e11, e13);
+ test::codemaker::cppumaker::TestException2 e21(
+ "abc", nullptr, 1,
+ css::uno::Any(123.0),
+ test::codemaker::cppumaker::HelperEnum_ONE,
+ test::codemaker::cppumaker::Struct<sal_Int32, sal_Int32>(5, aEmptySequence), 2);
+ test::codemaker::cppumaker::TestException2 e22(e21);
+ CPPUNIT_ASSERT_EQUAL(e21, e22);
+ test::codemaker::cppumaker::TestException2 e23;
+ e23 = e21;
+ CPPUNIT_ASSERT_EQUAL(e21, e23);
+}
+
+void Test::testConstants() {
+ CPPUNIT_ASSERT_EQUAL(
+ SAL_MIN_INT8, test::codemaker::cppumaker::Constants::byteMin);
+ CPPUNIT_ASSERT_EQUAL(
+ SAL_MAX_INT8, test::codemaker::cppumaker::Constants::byteMax);
+ CPPUNIT_ASSERT_EQUAL(
+ SAL_MIN_INT16, test::codemaker::cppumaker::Constants::shortMin);
+ CPPUNIT_ASSERT_EQUAL(
+ SAL_MAX_INT16, test::codemaker::cppumaker::Constants::shortMax);
+ CPPUNIT_ASSERT_EQUAL(
+ static_cast< sal_uInt16 >(0),
+ test::codemaker::cppumaker::Constants::unsignedShortMin);
+ CPPUNIT_ASSERT_EQUAL(
+ SAL_MAX_UINT16,
+ test::codemaker::cppumaker::Constants::unsignedShortMax);
+ CPPUNIT_ASSERT_EQUAL(
+ SAL_MIN_INT32, test::codemaker::cppumaker::Constants::longMin);
+ CPPUNIT_ASSERT_EQUAL(
+ SAL_MAX_INT32, test::codemaker::cppumaker::Constants::longMax);
+ CPPUNIT_ASSERT_EQUAL(
+ static_cast< sal_uInt32 >(0),
+ test::codemaker::cppumaker::Constants::unsignedLongMin);
+ CPPUNIT_ASSERT_EQUAL(
+ SAL_MAX_UINT32, test::codemaker::cppumaker::Constants::unsignedLongMax);
+ CPPUNIT_ASSERT_EQUAL(
+ SAL_MIN_INT64, test::codemaker::cppumaker::Constants::hyperMin);
+ CPPUNIT_ASSERT_EQUAL(
+ SAL_MAX_INT64, test::codemaker::cppumaker::Constants::hyperMax);
+ CPPUNIT_ASSERT_EQUAL(
+ static_cast< sal_uInt64 >(0),
+ test::codemaker::cppumaker::Constants::unsignedHyperMin);
+ CPPUNIT_ASSERT_EQUAL(
+ SAL_MAX_UINT64,
+ test::codemaker::cppumaker::Constants::unsignedHyperMax);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppu/qa/cppumaker/types.idl b/cppu/qa/cppumaker/types.idl
new file mode 100644
index 000000000..98ed1f867
--- /dev/null
+++ b/cppu/qa/cppumaker/types.idl
@@ -0,0 +1,710 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/*TODO: Do not depend on types for which C++ header files are only generated
+ later in the build process in offuh: */
+#include <com/sun/star/lang/ClassNotFoundException.idl>
+#include <com/sun/star/lang/IllegalAccessException.idl>
+#include <com/sun/star/lang/Locale.idl>
+#include <com/sun/star/uno/DeploymentException.idl>
+#include <com/sun/star/uno/Exception.idl>
+#include <com/sun/star/uno/RuntimeException.idl>
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/uno/XNamingService.idl>
+
+singleton FILE: com::sun::star::uno::XInterface;
+singleton lconv: com::sun::star::uno::XInterface;
+singleton tm: com::sun::star::uno::XInterface;
+
+singleton std: com::sun::star::uno::XInterface;
+
+module test { module codemaker { module cppumaker {
+
+interface XTest {
+ boolean test();
+
+ [attribute, bound] long A1;
+ [attribute, bound, readonly] long A2;
+ [attribute] long A3 {
+ get raises
+ (com::sun::star::uno::Exception,
+ com::sun::star::lang::ClassNotFoundException);
+ set raises (com::sun::star::uno::RuntimeException);
+ };
+ [attribute, readonly] long A4 {
+ get raises (com::sun::star::uno::DeploymentException);
+ };
+};
+
+typedef boolean Boolean;
+typedef byte Byte;
+typedef short Short;
+typedef unsigned short UnsignedShort;
+typedef long Long;
+typedef unsigned long UnsignedLong;
+typedef hyper Hyper;
+typedef unsigned hyper UnsignedHyper;
+typedef float Float;
+typedef double Double;
+typedef char Char;
+typedef string String;
+typedef type Type;
+typedef any Any;
+typedef com::sun::star::lang::Locale Locale;
+typedef com::sun::star::uno::XInterface XInterface;
+typedef com::sun::star::uno::XNamingService XNamingService;
+
+typedef sequence< Boolean > SequenceBoolean;
+typedef sequence< Byte > SequenceByte;
+typedef sequence< Short > SequenceShort;
+typedef sequence< UnsignedShort > SequenceUnsignedShort;
+typedef sequence< Long > SequenceLong;
+typedef sequence< UnsignedLong > SequenceUnsignedLong;
+typedef sequence< Hyper > SequenceHyper;
+typedef sequence< UnsignedHyper > SequenceUnsignedHyper;
+typedef sequence< Float > SequenceFloat;
+typedef sequence< Double > SequenceDouble;
+typedef sequence< Char > SequenceChar;
+typedef sequence< String > SequenceString;
+typedef sequence< Type > SequenceType;
+typedef sequence< Any > SequenceAny;
+typedef sequence< Locale > SequenceLocale;
+typedef sequence< XInterface > SequenceXInterface;
+typedef sequence< XNamingService > SequenceXNamingService;
+
+service S1: XTest {
+ create1();
+
+ create2([in] any... create2)
+ raises (com::sun::star::uno::RuntimeException,
+ com::sun::star::lang::ClassNotFoundException,
+ com::sun::star::uno::Exception,
+ com::sun::star::lang::IllegalAccessException,
+ com::sun::star::uno::DeploymentException);
+
+ create3([in] sequence<any> S1)
+ raises (com::sun::star::uno::RuntimeException,
+ com::sun::star::lang::ClassNotFoundException,
+ com::sun::star::lang::IllegalAccessException,
+ com::sun::star::uno::DeploymentException);
+
+ create4([in] long javamaker, [in] long S1, [in] long create4);
+
+ create5(
+ [in] boolean p1,
+ [in] byte p2,
+ [in] short p3,
+ [in] unsigned short p4,
+ [in] long p5,
+ [in] unsigned long p6,
+ [in] hyper p7,
+ [in] unsigned hyper p8,
+ [in] float p9,
+ [in] double p10,
+ [in] char p11,
+ [in] string p12,
+ [in] type p13,
+ [in] any p14,
+ [in] com::sun::star::lang::Locale p15,
+ [in] com::sun::star::uno::XInterface p16,
+ [in] com::sun::star::uno::XNamingService p17,
+ [in] Boolean t1,
+ [in] Byte t2,
+ [in] Short t3,
+ [in] UnsignedShort t4,
+ [in] Long t5,
+ [in] UnsignedLong t6,
+ [in] Hyper t7,
+ [in] UnsignedHyper t8,
+ [in] Float t9,
+ [in] Double t10,
+ [in] Char t11,
+ [in] String t12,
+ [in] Type t13,
+ [in] Any t14,
+ [in] Locale t15,
+ [in] XInterface t16,
+ [in] XNamingService t17,
+ [in] sequence< sequence< boolean > > a1,
+ [in] sequence< sequence< byte > > a2,
+ [in] sequence< sequence< short > > a3,
+ [in] sequence< sequence< unsigned short > > a4,
+ [in] sequence< sequence< long > > a5,
+ [in] sequence< sequence< unsigned long > > a6,
+ [in] sequence< sequence< hyper > > a7,
+ [in] sequence< sequence< unsigned hyper > > a8,
+ [in] sequence< sequence< float > > a9,
+ [in] sequence< sequence< double > > a10,
+ [in] sequence< sequence< char > > a11,
+ [in] sequence< sequence< string > > a12,
+ [in] sequence< sequence< type > > a13,
+ [in] sequence< sequence< any > > a14,
+ [in] sequence< sequence< com::sun::star::lang::Locale > > a15,
+ [in] sequence< sequence< com::sun::star::uno::XInterface > > a16,
+ [in] sequence< sequence<
+ com::sun::star::uno::XNamingService > > a17,
+ [in] sequence< SequenceBoolean > at1,
+ [in] sequence< SequenceByte > at2,
+ [in] sequence< SequenceShort > at3,
+ [in] sequence< SequenceUnsignedShort > at4,
+ [in] sequence< SequenceLong > at5,
+ [in] sequence< SequenceUnsignedLong > at6,
+ [in] sequence< SequenceHyper > at7,
+ [in] sequence< SequenceUnsignedHyper > at8,
+ [in] sequence< SequenceFloat > at9,
+ [in] sequence< SequenceDouble > at10,
+ [in] sequence< SequenceChar > at11,
+ [in] sequence< SequenceString > at12,
+ [in] sequence< SequenceType > at13,
+ [in] sequence< SequenceAny > at14,
+ [in] sequence< SequenceLocale > at15,
+ [in] sequence< SequenceXInterface > at16,
+ [in] sequence< SequenceXNamingService > at17);
+};
+
+service S2: XTest;
+
+service S3 { interface XTest; };
+
+singleton S4 { service S3; };
+
+module services {
+
+service asm: com::sun::star::uno::XInterface { asm([in] long asm); };
+service auto: com::sun::star::uno::XInterface { auto([in] long auto); };
+service bool: com::sun::star::uno::XInterface { bool([in] long bool); };
+service break: com::sun::star::uno::XInterface { break([in] long break); };
+//TODO: service case: com::sun::star::uno::XInterface { case([in] long case); };
+service catch: com::sun::star::uno::XInterface { catch([in] long catch); };
+//TODO: service char: com::sun::star::uno::XInterface { char([in] long char); };
+service class: com::sun::star::uno::XInterface { class([in] long class); };
+//TODO: service const: com::sun::star::uno::XInterface {
+// const([in] long const); };
+service continue: com::sun::star::uno::XInterface {
+ continue([in] long continue); };
+//TODO: service default: com::sun::star::uno::XInterface {
+// default([in] long default); };
+service delete: com::sun::star::uno::XInterface { delete([in] long delete); };
+service do: com::sun::star::uno::XInterface { do([in] long do); };
+//TODO: service double: com::sun::star::uno::XInterface {
+// double([in] long double); };
+service else: com::sun::star::uno::XInterface { else([in] long else); };
+//TODO: service enum: com::sun::star::uno::XInterface { enum([in] long enum); };
+service explicit: com::sun::star::uno::XInterface {
+ explicit([in] long explicit); };
+service export: com::sun::star::uno::XInterface { export([in] long export); };
+service extern: com::sun::star::uno::XInterface { extern([in] long extern); };
+service false: com::sun::star::uno::XInterface { false([in] long false); };
+//TODO: service float: com::sun::star::uno::XInterface {
+// float([in] long float); };
+service for: com::sun::star::uno::XInterface { for([in] long for); };
+service friend: com::sun::star::uno::XInterface { friend([in] long friend); };
+service goto: com::sun::star::uno::XInterface { goto([in] long goto); };
+service if: com::sun::star::uno::XInterface { if([in] long if); };
+service inline: com::sun::star::uno::XInterface { inline([in] long inline); };
+service int: com::sun::star::uno::XInterface { int([in] long int); };
+//TODO: service long: com::sun::star::uno::XInterface { long([in] long long); };
+service mutable: com::sun::star::uno::XInterface {
+ mutable([in] long mutable); };
+service namespace: com::sun::star::uno::XInterface {
+ namespace([in] long namespace); };
+service new: com::sun::star::uno::XInterface { new([in] long new); };
+service operator: com::sun::star::uno::XInterface {
+ operator([in] long operator); };
+service private: com::sun::star::uno::XInterface {
+ private([in] long private); };
+service protected: com::sun::star::uno::XInterface {
+ protected([in] long protected); };
+service public: com::sun::star::uno::XInterface { public([in] long public); };
+service register: com::sun::star::uno::XInterface {
+ register([in] long register); };
+service return: com::sun::star::uno::XInterface { return([in] long return); };
+//TODO: service short: com::sun::star::uno::XInterface {
+// short([in] long short); };
+service signed: com::sun::star::uno::XInterface { signed([in] long signed); };
+service sizeof: com::sun::star::uno::XInterface { sizeof([in] long sizeof); };
+service static: com::sun::star::uno::XInterface { static([in] long static); };
+//TODO: service struct: com::sun::star::uno::XInterface {
+// struct([in] long struct); };
+//TODO: service switch: com::sun::star::uno::XInterface {
+// switch([in] long switch); };
+service template: com::sun::star::uno::XInterface {
+ template([in] long template); };
+service this: com::sun::star::uno::XInterface { this([in] long this); };
+service throw: com::sun::star::uno::XInterface { throw([in] long throw); };
+service true: com::sun::star::uno::XInterface { true([in] long true); };
+service try: com::sun::star::uno::XInterface { try([in] long try); };
+//TODO: service typedef: com::sun::star::uno::XInterface {
+// typedef([in] long typedef); };
+service typeid: com::sun::star::uno::XInterface { typeid([in] long typeid); };
+service typename: com::sun::star::uno::XInterface {
+ typename([in] long typename); };
+//TODO: service union: com::sun::star::uno::XInterface {
+// union([in] long union); };
+//TODO: service unsigned: com::sun::star::uno::XInterface {
+// unsigned([in] long unsigned); };
+service using: com::sun::star::uno::XInterface { using([in] long using); };
+service virtual: com::sun::star::uno::XInterface {
+ virtual([in] long virtual); };
+//TODO: service void: com::sun::star::uno::XInterface { void([in] long void); };
+service volatile: com::sun::star::uno::XInterface {
+ volatile([in] long volatile); };
+service while: com::sun::star::uno::XInterface { while([in] long while); };
+
+service and: com::sun::star::uno::XInterface { and([in] long and); };
+service bitand: com::sun::star::uno::XInterface { bitand([in] long bitand); };
+service bitor: com::sun::star::uno::XInterface { bitor([in] long bitor); };
+service compl: com::sun::star::uno::XInterface { compl([in] long compl); };
+service not: com::sun::star::uno::XInterface { not([in] long not); };
+service or: com::sun::star::uno::XInterface { or([in] long or); };
+service xor: com::sun::star::uno::XInterface { xor([in] long xor); };
+
+service BUFSIZ: com::sun::star::uno::XInterface { BUFSIZ([in] long BUFSIZ); };
+service CLOCKS_PER_SEC: com::sun::star::uno::XInterface {
+ CLOCKS_PER_SEC([in] long CLOCKS_PER_SEC); };
+service EDOM: com::sun::star::uno::XInterface { EDOM([in] long EDOM); };
+service EOF: com::sun::star::uno::XInterface { EOF([in] long EOF); };
+service ERANGE: com::sun::star::uno::XInterface { ERANGE([in] long ERANGE); };
+service EXIT_FAILURE: com::sun::star::uno::XInterface {
+ EXIT_FAILURE([in] long EXIT_FAILURE); };
+service EXIT_SUCCESS: com::sun::star::uno::XInterface {
+ EXIT_SUCCESS([in] long EXIT_SUCCESS); };
+service FILENAME_MAX: com::sun::star::uno::XInterface {
+ FILENAME_MAX([in] long FILENAME_MAX); };
+service FOPEN_MAX: com::sun::star::uno::XInterface {
+ FOPEN_MAX([in] long FOPEN_MAX); };
+service HUGE_VAL: com::sun::star::uno::XInterface {
+ HUGE_VAL([in] long HUGE_VAL); };
+service LC_ALL: com::sun::star::uno::XInterface { LC_ALL([in] long LC_ALL); };
+service LC_COLLATE: com::sun::star::uno::XInterface {
+ LC_COLLATE([in] long LC_COLLATE); };
+service LC_CTYPE: com::sun::star::uno::XInterface {
+ LC_CTYPE([in] long LC_CTYPE); };
+service LC_MONETARY: com::sun::star::uno::XInterface {
+ LC_MONETARY([in] long LC_MONETARY); };
+service LC_NUMERIC: com::sun::star::uno::XInterface {
+ LC_NUMERIC([in] long LC_NUMERIC); };
+service LC_TIME: com::sun::star::uno::XInterface {
+ LC_TIME([in] long LC_TIME); };
+service L_tmpnam: com::sun::star::uno::XInterface {
+ L_tmpnam([in] long L_tmpnam); };
+service MB_CUR_MAX: com::sun::star::uno::XInterface {
+ MB_CUR_MAX([in] long MB_CUR_MAX); };
+service NULL: com::sun::star::uno::XInterface { NULL([in] long NULL); };
+service RAND_MAX: com::sun::star::uno::XInterface {
+ RAND_MAX([in] long RAND_MAX); };
+service SEEK_CUR: com::sun::star::uno::XInterface {
+ SEEK_CUR([in] long SEEK_CUR); };
+service SEEK_END: com::sun::star::uno::XInterface {
+ SEEK_END([in] long SEEK_END); };
+service SEEK_SET: com::sun::star::uno::XInterface {
+ SEEK_SET([in] long SEEK_SET); };
+service SIGABRT: com::sun::star::uno::XInterface {
+ SIGABRT([in] long SIGABRT); };
+service SIGFPE: com::sun::star::uno::XInterface { SIGFPE([in] long SIGFPE); };
+service SIGILL: com::sun::star::uno::XInterface { SIGILL([in] long SIGILL); };
+service SIGINT: com::sun::star::uno::XInterface { SIGINT([in] long SIGINT); };
+service SIGSEGV: com::sun::star::uno::XInterface {
+ SIGSEGV([in] long SIGSEGV); };
+service SIGTERM: com::sun::star::uno::XInterface {
+ SIGTERM([in] long SIGTERM); };
+service SIG_DFL: com::sun::star::uno::XInterface {
+ SIG_DFL([in] long SIG_DFL); };
+service SIG_ERR: com::sun::star::uno::XInterface {
+ SIG_ERR([in] long SIG_ERR); };
+service SIG_IGN: com::sun::star::uno::XInterface {
+ SIG_IGN([in] long SIG_IGN); };
+service TMP_MAX: com::sun::star::uno::XInterface {
+ TMP_MAX([in] long TMP_MAX); };
+service WCHAR_MAX: com::sun::star::uno::XInterface {
+ WCHAR_MAX([in] long WCHAR_MAX); };
+service WCHAR_MIN: com::sun::star::uno::XInterface {
+ WCHAR_MIN([in] long WCHAR_MIN); };
+service WEOF: com::sun::star::uno::XInterface { WEOF([in] long WEOF); };
+service assert: com::sun::star::uno::XInterface { assert([in] long assert); };
+service errno: com::sun::star::uno::XInterface { errno([in] long errno); };
+service offsetof: com::sun::star::uno::XInterface {
+ offsetof([in] long offsetof); };
+service setjmp: com::sun::star::uno::XInterface { setjmp([in] long setjmp); };
+service stderr: com::sun::star::uno::XInterface { stderr([in] long stderr); };
+service stdin: com::sun::star::uno::XInterface { stdin([in] long stdin); };
+service stdout: com::sun::star::uno::XInterface { stdout([in] long stdout); };
+
+service CHAR_BIT: com::sun::star::uno::XInterface {
+ CHAR_BIT([in] long CHAR_BIT); };
+service CHAR_MAX: com::sun::star::uno::XInterface {
+ CHAR_MAX([in] long CHAR_MAX); };
+service CHAR_MIN: com::sun::star::uno::XInterface {
+ CHAR_MIN([in] long CHAR_MIN); };
+service DBL_DIG: com::sun::star::uno::XInterface {
+ DBL_DIG([in] long DBL_DIG); };
+service DBL_EPSILON: com::sun::star::uno::XInterface {
+ DBL_EPSILON([in] long DBL_EPSILON); };
+service DBL_MANT_DIG: com::sun::star::uno::XInterface {
+ DBL_MANT_DIG([in] long DBL_MANT_DIG); };
+service DBL_MAX: com::sun::star::uno::XInterface {
+ DBL_MAX([in] long DBL_MAX); };
+service DBL_MAX_10_EXP: com::sun::star::uno::XInterface {
+ DBL_MAX_10_EXP([in] long DBL_MAX_10_EXP); };
+service DBL_MAX_EXP: com::sun::star::uno::XInterface {
+ DBL_MAX_EXP([in] long DBL_MAX_EXP); };
+service DBL_MIN: com::sun::star::uno::XInterface {
+ DBL_MIN([in] long DBL_MIN); };
+service DBL_MIN_10_EXP: com::sun::star::uno::XInterface {
+ DBL_MIN_10_EXP([in] long DBL_MIN_10_EXP); };
+service DBL_MIN_EXP: com::sun::star::uno::XInterface {
+ DBL_MIN_EXP([in] long DBL_MIN_EXP); };
+service FLT_DIG: com::sun::star::uno::XInterface {
+ FLT_DIG([in] long FLT_DIG); };
+service FLT_EPSILON: com::sun::star::uno::XInterface {
+ FLT_EPSILON([in] long FLT_EPSILON); };
+service FLT_MANT_DIG: com::sun::star::uno::XInterface {
+ FLT_MANT_DIG([in] long FLT_MANT_DIG); };
+service FLT_MAX: com::sun::star::uno::XInterface {
+ FLT_MAX([in] long FLT_MAX); };
+service FLT_MAX_10_EXP: com::sun::star::uno::XInterface {
+ FLT_MAX_10_EXP([in] long FLT_MAX_10_EXP); };
+service FLT_MAX_EXP: com::sun::star::uno::XInterface {
+ FLT_MAX_EXP([in] long FLT_MAX_EXP); };
+service FLT_MIN: com::sun::star::uno::XInterface {
+ FLT_MIN([in] long FLT_MIN); };
+service FLT_MIN_10_EXP: com::sun::star::uno::XInterface {
+ FLT_MIN_10_EXP([in] long FLT_MIN_10_EXP); };
+service FLT_MIN_EXP: com::sun::star::uno::XInterface {
+ FLT_MIN_EXP([in] long FLT_MIN_EXP); };
+service FLT_RADIX: com::sun::star::uno::XInterface {
+ FLT_RADIX([in] long FLT_RADIX); };
+service FLT_ROUNDS: com::sun::star::uno::XInterface {
+ FLT_ROUNDS([in] long FLT_ROUNDS); };
+service INT_MAX: com::sun::star::uno::XInterface {
+ INT_MAX([in] long INT_MAX); };
+service INT_MIN: com::sun::star::uno::XInterface {
+ INT_MIN([in] long INT_MIN); };
+service LDBL_DIG: com::sun::star::uno::XInterface {
+ LDBL_DIG([in] long LDBL_DIG); };
+service LDBL_EPSILON: com::sun::star::uno::XInterface {
+ LDBL_EPSILON([in] long LDBL_EPSILON); };
+service LDBL_MANT_DIG: com::sun::star::uno::XInterface {
+ LDBL_MANT_DIG([in] long LDBL_MANT_DIG); };
+service LDBL_MAX: com::sun::star::uno::XInterface {
+ LDBL_MAX([in] long LDBL_MAX); };
+service LDBL_MAX_10_EXP: com::sun::star::uno::XInterface {
+ LDBL_MAX_10_EXP([in] long LDBL_MAX_10_EXP); };
+service LDBL_MAX_EXP: com::sun::star::uno::XInterface {
+ LDBL_MAX_EXP([in] long LDBL_MAX_EXP); };
+service LDBL_MIN: com::sun::star::uno::XInterface {
+ LDBL_MIN([in] long LDBL_MIN); };
+service LDBL_MIN_10_EXP: com::sun::star::uno::XInterface {
+ LDBL_MIN_10_EXP([in] long LDBL_MIN_10_EXP); };
+service LDBL_MIN_EXP: com::sun::star::uno::XInterface {
+ LDBL_MIN_EXP([in] long LDBL_MIN_EXP); };
+service LONG_MAX: com::sun::star::uno::XInterface {
+ LONG_MAX([in] long LONG_MAX); };
+service LONG_MIN: com::sun::star::uno::XInterface {
+ LONG_MIN([in] long LONG_MIN); };
+service MB_LEN_MAX: com::sun::star::uno::XInterface {
+ MB_LEN_MAX([in] long MB_LEN_MAX); };
+service SCHAR_MAX: com::sun::star::uno::XInterface {
+ SCHAR_MAX([in] long SCHAR_MAX); };
+service SCHAR_MIN: com::sun::star::uno::XInterface {
+ SCHAR_MIN([in] long SCHAR_MIN); };
+service SHRT_MAX: com::sun::star::uno::XInterface {
+ SHRT_MAX([in] long SHRT_MAX); };
+service SHRT_MIN: com::sun::star::uno::XInterface {
+ SHRT_MIN([in] long SHRT_MIN); };
+service UCHAR_MAX: com::sun::star::uno::XInterface {
+ UCHAR_MAX([in] long UCHAR_MAX); };
+service UINT_MAX: com::sun::star::uno::XInterface {
+ UINT_MAX([in] long UINT_MAX); };
+service ULONG_MAX: com::sun::star::uno::XInterface {
+ ULONG_MAX([in] long ULONG_MAX); };
+service USHRT_MAX: com::sun::star::uno::XInterface {
+ USHRT_MAX([in] long USHRT_MAX); };
+
+service FILE: com::sun::star::uno::XInterface { FILE([in] long FILE); };
+service lconv: com::sun::star::uno::XInterface { lconv([in] long lconv); };
+service tm: com::sun::star::uno::XInterface { tm([in] long tm); };
+
+service std: com::sun::star::uno::XInterface { std([in] long std); };
+
+service NDEBUG: com::sun::star::uno::XInterface { NDEBUG([in] long NDEBUG); };
+
+service create: com::sun::star::uno::XInterface;
+
+};
+
+module singletons {
+
+singleton asm: com::sun::star::uno::XInterface;
+singleton auto: com::sun::star::uno::XInterface;
+singleton bool: com::sun::star::uno::XInterface;
+singleton break: com::sun::star::uno::XInterface;
+//TODO: singleton case: com::sun::star::uno::XInterface;
+singleton catch: com::sun::star::uno::XInterface;
+//TODO: singleton char: com::sun::star::uno::XInterface;
+singleton class: com::sun::star::uno::XInterface;
+//TODO: singleton const: com::sun::star::uno::XInterface;
+singleton continue: com::sun::star::uno::XInterface;
+//TODO: singleton default: com::sun::star::uno::XInterface;
+singleton delete: com::sun::star::uno::XInterface;
+singleton do: com::sun::star::uno::XInterface;
+//TODO: singleton double: com::sun::star::uno::XInterface;
+singleton else: com::sun::star::uno::XInterface;
+//TODO: singleton enum: com::sun::star::uno::XInterface;
+singleton explicit: com::sun::star::uno::XInterface;
+singleton export: com::sun::star::uno::XInterface;
+singleton extern: com::sun::star::uno::XInterface;
+singleton false: com::sun::star::uno::XInterface;
+//TODO: singleton float: com::sun::star::uno::XInterface;
+singleton for: com::sun::star::uno::XInterface;
+singleton friend: com::sun::star::uno::XInterface;
+singleton goto: com::sun::star::uno::XInterface;
+singleton if: com::sun::star::uno::XInterface;
+singleton inline: com::sun::star::uno::XInterface;
+singleton int: com::sun::star::uno::XInterface;
+//TODO: singleton long: com::sun::star::uno::XInterface;
+singleton mutable: com::sun::star::uno::XInterface;
+singleton namespace: com::sun::star::uno::XInterface;
+singleton new: com::sun::star::uno::XInterface;
+singleton operator: com::sun::star::uno::XInterface;
+singleton private: com::sun::star::uno::XInterface;
+singleton protected: com::sun::star::uno::XInterface;
+singleton public: com::sun::star::uno::XInterface;
+singleton register: com::sun::star::uno::XInterface;
+singleton return: com::sun::star::uno::XInterface;
+//TODO: singleton short: com::sun::star::uno::XInterface;
+singleton signed: com::sun::star::uno::XInterface;
+singleton sizeof: com::sun::star::uno::XInterface;
+singleton static: com::sun::star::uno::XInterface;
+//TODO: singleton struct: com::sun::star::uno::XInterface;
+//TODO: singleton switch: com::sun::star::uno::XInterface;
+singleton template: com::sun::star::uno::XInterface;
+singleton this: com::sun::star::uno::XInterface;
+singleton throw: com::sun::star::uno::XInterface;
+singleton true: com::sun::star::uno::XInterface;
+singleton try: com::sun::star::uno::XInterface;
+//TODO: singleton typedef: com::sun::star::uno::XInterface;
+singleton typeid: com::sun::star::uno::XInterface;
+singleton typename: com::sun::star::uno::XInterface;
+//TODO: singleton union: com::sun::star::uno::XInterface;
+//TODO: singleton unsigned: com::sun::star::uno::XInterface;
+singleton using: com::sun::star::uno::XInterface;
+singleton virtual: com::sun::star::uno::XInterface;
+//TODO: singleton void: com::sun::star::uno::XInterface;
+singleton volatile: com::sun::star::uno::XInterface;
+singleton while: com::sun::star::uno::XInterface;
+
+singleton and: com::sun::star::uno::XInterface;
+singleton bitand: com::sun::star::uno::XInterface;
+singleton bitor: com::sun::star::uno::XInterface;
+singleton compl: com::sun::star::uno::XInterface;
+singleton not: com::sun::star::uno::XInterface;
+singleton or: com::sun::star::uno::XInterface;
+singleton xor: com::sun::star::uno::XInterface;
+
+singleton BUFSIZ: com::sun::star::uno::XInterface;
+singleton CLOCKS_PER_SEC: com::sun::star::uno::XInterface;
+singleton EDOM: com::sun::star::uno::XInterface;
+singleton EOF: com::sun::star::uno::XInterface;
+singleton ERANGE: com::sun::star::uno::XInterface;
+singleton EXIT_FAILURE: com::sun::star::uno::XInterface;
+singleton EXIT_SUCCESS: com::sun::star::uno::XInterface;
+singleton FILENAME_MAX: com::sun::star::uno::XInterface;
+singleton FOPEN_MAX: com::sun::star::uno::XInterface;
+singleton HUGE_VAL: com::sun::star::uno::XInterface;
+singleton LC_ALL: com::sun::star::uno::XInterface;
+singleton LC_COLLATE: com::sun::star::uno::XInterface;
+singleton LC_CTYPE: com::sun::star::uno::XInterface;
+singleton LC_MONETARY: com::sun::star::uno::XInterface;
+singleton LC_NUMERIC: com::sun::star::uno::XInterface;
+singleton LC_TIME: com::sun::star::uno::XInterface;
+singleton L_tmpnam: com::sun::star::uno::XInterface;
+singleton MB_CUR_MAX: com::sun::star::uno::XInterface;
+singleton NULL: com::sun::star::uno::XInterface;
+singleton RAND_MAX: com::sun::star::uno::XInterface;
+singleton SEEK_CUR: com::sun::star::uno::XInterface;
+singleton SEEK_END: com::sun::star::uno::XInterface;
+singleton SEEK_SET: com::sun::star::uno::XInterface;
+singleton SIGABRT: com::sun::star::uno::XInterface;
+singleton SIGFPE: com::sun::star::uno::XInterface;
+singleton SIGILL: com::sun::star::uno::XInterface;
+singleton SIGINT: com::sun::star::uno::XInterface;
+singleton SIGSEGV: com::sun::star::uno::XInterface;
+singleton SIGTERM: com::sun::star::uno::XInterface;
+singleton SIG_DFL: com::sun::star::uno::XInterface;
+singleton SIG_ERR: com::sun::star::uno::XInterface;
+singleton SIG_IGN: com::sun::star::uno::XInterface;
+singleton TMP_MAX: com::sun::star::uno::XInterface;
+singleton WCHAR_MAX: com::sun::star::uno::XInterface;
+singleton WCHAR_MIN: com::sun::star::uno::XInterface;
+singleton WEOF: com::sun::star::uno::XInterface;
+singleton assert: com::sun::star::uno::XInterface;
+singleton errno: com::sun::star::uno::XInterface;
+singleton offsetof: com::sun::star::uno::XInterface;
+singleton setjmp: com::sun::star::uno::XInterface;
+singleton stderr: com::sun::star::uno::XInterface;
+singleton stdin: com::sun::star::uno::XInterface;
+singleton stdout: com::sun::star::uno::XInterface;
+
+singleton CHAR_BIT: com::sun::star::uno::XInterface;
+singleton CHAR_MAX: com::sun::star::uno::XInterface;
+singleton CHAR_MIN: com::sun::star::uno::XInterface;
+singleton DBL_DIG: com::sun::star::uno::XInterface;
+singleton DBL_EPSILON: com::sun::star::uno::XInterface;
+singleton DBL_MANT_DIG: com::sun::star::uno::XInterface;
+singleton DBL_MAX: com::sun::star::uno::XInterface;
+singleton DBL_MAX_10_EXP: com::sun::star::uno::XInterface;
+singleton DBL_MAX_EXP: com::sun::star::uno::XInterface;
+singleton DBL_MIN: com::sun::star::uno::XInterface;
+singleton DBL_MIN_10_EXP: com::sun::star::uno::XInterface;
+singleton DBL_MIN_EXP: com::sun::star::uno::XInterface;
+singleton FLT_DIG: com::sun::star::uno::XInterface;
+singleton FLT_EPSILON: com::sun::star::uno::XInterface;
+singleton FLT_MANT_DIG: com::sun::star::uno::XInterface;
+singleton FLT_MAX: com::sun::star::uno::XInterface;
+singleton FLT_MAX_10_EXP: com::sun::star::uno::XInterface;
+singleton FLT_MAX_EXP: com::sun::star::uno::XInterface;
+singleton FLT_MIN: com::sun::star::uno::XInterface;
+singleton FLT_MIN_10_EXP: com::sun::star::uno::XInterface;
+singleton FLT_MIN_EXP: com::sun::star::uno::XInterface;
+singleton FLT_RADIX: com::sun::star::uno::XInterface;
+singleton FLT_ROUNDS: com::sun::star::uno::XInterface;
+singleton INT_MAX: com::sun::star::uno::XInterface;
+singleton INT_MIN: com::sun::star::uno::XInterface;
+singleton LDBL_DIG: com::sun::star::uno::XInterface;
+singleton LDBL_EPSILON: com::sun::star::uno::XInterface;
+singleton LDBL_MANT_DIG: com::sun::star::uno::XInterface;
+singleton LDBL_MAX: com::sun::star::uno::XInterface;
+singleton LDBL_MAX_10_EXP: com::sun::star::uno::XInterface;
+singleton LDBL_MAX_EXP: com::sun::star::uno::XInterface;
+singleton LDBL_MIN: com::sun::star::uno::XInterface;
+singleton LDBL_MIN_10_EXP: com::sun::star::uno::XInterface;
+singleton LDBL_MIN_EXP: com::sun::star::uno::XInterface;
+singleton LONG_MAX: com::sun::star::uno::XInterface;
+singleton LONG_MIN: com::sun::star::uno::XInterface;
+singleton MB_LEN_MAX: com::sun::star::uno::XInterface;
+singleton SCHAR_MAX: com::sun::star::uno::XInterface;
+singleton SCHAR_MIN: com::sun::star::uno::XInterface;
+singleton SHRT_MAX: com::sun::star::uno::XInterface;
+singleton SHRT_MIN: com::sun::star::uno::XInterface;
+singleton UCHAR_MAX: com::sun::star::uno::XInterface;
+singleton UINT_MAX: com::sun::star::uno::XInterface;
+singleton ULONG_MAX: com::sun::star::uno::XInterface;
+singleton USHRT_MAX: com::sun::star::uno::XInterface;
+
+singleton FILE: com::sun::star::uno::XInterface;
+singleton lconv: com::sun::star::uno::XInterface;
+singleton tm: com::sun::star::uno::XInterface;
+
+singleton std: com::sun::star::uno::XInterface;
+
+singleton NDEBUG: com::sun::star::uno::XInterface;
+
+singleton get: com::sun::star::uno::XInterface;
+
+};
+
+enum HelperEnum { ZERO, ONE };
+
+struct HelperStruct { boolean m1; com::sun::star::uno::XInterface m2; };
+
+typedef byte TDByte;
+typedef HelperEnum TDEnum1;
+typedef TDEnum1 TDEnum;
+
+struct BigStruct {
+ boolean m1;
+ byte m2;
+ short m3;
+ unsigned short m4;
+ long m5;
+ unsigned long m6;
+ hyper m7;
+ unsigned hyper m8;
+ float m9;
+ double m10;
+ char m11;
+ string m12;
+ type m13;
+ any m14;
+ sequence<boolean> m15;
+ HelperEnum m16;
+ HelperStruct m17;
+ com::sun::star::uno::XInterface m18;
+ TDByte m19;
+ TDEnum m20;
+ sequence<unsigned short> m21;
+ sequence<char> m22;
+ sequence< sequence<char> > m23;
+};
+
+struct Struct<T, U> {
+ T member1;
+ sequence<SequenceAny> member2;
+};
+
+struct StructUsage {
+ Struct< long, short > member1;
+ sequence<
+ sequence<
+ Struct<
+ sequence< Struct< any, boolean > >,
+ com::sun::star::uno::XInterface > > >
+ member2;
+};
+
+struct AlignmentBaseStruct {
+ double member1;
+ short member2;
+};
+
+struct AlignmentDerivedStruct: AlignmentBaseStruct {
+ short member3;
+};
+
+exception TestException1: com::sun::star::uno::RuntimeException {
+ long m1;
+ any m2;
+ HelperEnum m3;
+ Struct<long, long> m4;
+ unsigned short m5;
+};
+
+exception TestException2: TestException1 {};
+
+constants Constants {
+ const byte byteMin = -128;
+ const byte byteMax = 127;
+ const short shortMin = -32768;
+ const short shortMax = 32767;
+ const unsigned short unsignedShortMin = 0;
+ const unsigned short unsignedShortMax = 65535;
+ const long longMin = -2147483648;
+ const long longMax = 2147483647;
+ const unsigned long unsignedLongMin = 0;
+ const unsigned long unsignedLongMax = 4294967295;
+ const hyper hyperMin = -9223372036854775808;
+ const hyper hyperMax = 9223372036854775807;
+ const unsigned hyper unsignedHyperMin = 0;
+ const unsigned hyper unsignedHyperMax = 18446744073709551615;
+};
+
+}; }; };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppu/qa/test_any.cxx b/cppu/qa/test_any.cxx
new file mode 100644
index 000000000..757040314
--- /dev/null
+++ b/cppu/qa/test_any.cxx
@@ -0,0 +1,2578 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/types.h>
+
+#include <stdlib.h>
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <Enum1.hpp>
+#include <Enum2.hpp>
+#include <Exception1.hpp>
+#include <Exception2.hpp>
+#include <Exception2a.hpp>
+#include <Exception2b.hpp>
+#include <Interface1.hpp>
+#include <Interface2.hpp>
+#include <Interface2a.hpp>
+#include <Interface2b.hpp>
+#include <Interface3.hpp>
+#include <Poly.hpp>
+#include <Struct1.hpp>
+#include <Struct2.hpp>
+#include <Struct2a.hpp>
+#include <Struct2b.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <o3tl/cppunittraitshelper.hxx>
+#include <osl/interlck.h>
+#include <rtl/ustring.hxx>
+
+namespace {
+
+class Base {
+public:
+ Base(): m_count(0) {}
+
+ Base(const Base&) = delete;
+ const Base& operator=(const Base&) = delete;
+
+ void acquire() {
+ if (osl_atomic_increment(&m_count) == SAL_MAX_INT32) {
+ abort();
+ }
+ }
+
+ void release() {
+ if (osl_atomic_decrement(&m_count) == 0) {
+ delete this;
+ }
+ }
+
+protected:
+ virtual ~Base() {}
+
+private:
+ oslInterlockedCount m_count;
+};
+
+class Impl1: public Interface1, private Base {
+public:
+ virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override
+ {
+ if (type == cppu::UnoType<css::uno::XInterface>::get()) {
+ css::uno::Reference< css::uno::XInterface > ref(
+ static_cast< css::uno::XInterface * >(this));
+ return css::uno::Any(&ref, type);
+ }
+ if (type == cppu::UnoType<Interface1>::get()) {
+ css::uno::Reference< Interface1 > ref(this);
+ return css::uno::Any(&ref, type);
+ }
+ return css::uno::Any();
+ }
+
+ virtual void SAL_CALL acquire() noexcept override {
+ Base::acquire();
+ }
+
+ virtual void SAL_CALL release() noexcept override {
+ Base::release();
+ }
+};
+
+class Impl2: public Interface2a, public Interface3, private Base {
+public:
+ virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override
+ {
+ if (type == cppu::UnoType<css::uno::XInterface>::get()) {
+ css::uno::Reference< css::uno::XInterface > ref(
+ static_cast< css::uno::XInterface * >(
+ static_cast< Interface2a * >(this)));
+ return css::uno::Any(&ref, type);
+ }
+ if (type == cppu::UnoType<Interface2>::get()) {
+ css::uno::Reference< Interface2 > ref(this);
+ return css::uno::Any(&ref, type);
+ }
+ if (type == cppu::UnoType<Interface2a>::get()) {
+ css::uno::Reference< Interface2a > ref(this);
+ return css::uno::Any(&ref, type);
+ }
+ if (type == cppu::UnoType<Interface3>::get()) {
+ css::uno::Reference< Interface3 > ref(this);
+ return css::uno::Any(&ref, type);
+ }
+ return css::uno::Any();
+ }
+
+ virtual void SAL_CALL acquire() noexcept override {
+ Base::acquire();
+ }
+
+ virtual void SAL_CALL release() noexcept override {
+ Base::release();
+ }
+};
+
+class Impl2b: public Interface2b, private Base {
+public:
+ virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override
+ {
+ if (type == cppu::UnoType<css::uno::XInterface>::get()) {
+ css::uno::Reference< css::uno::XInterface > ref(
+ static_cast< css::uno::XInterface * >(
+ static_cast< Interface2a * >(this)));
+ return css::uno::Any(&ref, type);
+ }
+ if (type == cppu::UnoType<Interface2>::get()) {
+ css::uno::Reference< Interface2 > ref(this);
+ return css::uno::Any(&ref, type);
+ }
+ if (type == cppu::UnoType<Interface2a>::get()) {
+ css::uno::Reference< Interface2a > ref(this);
+ return css::uno::Any(&ref, type);
+ }
+ if (type == cppu::UnoType<Interface2b>::get()) {
+ css::uno::Reference< Interface2b > ref(this);
+ return css::uno::Any(&ref, type);
+ }
+ return css::uno::Any();
+ }
+
+ virtual void SAL_CALL acquire() noexcept override {
+ Base::acquire();
+ }
+
+ virtual void SAL_CALL release() noexcept override {
+ Base::release();
+ }
+};
+
+class Test: public CppUnit::TestFixture {
+public:
+ void testVoid();
+ void testBoolean();
+ void testByte();
+ void testShort();
+ void testUnsignedShort();
+ void testLong();
+ void testUnsignedLong();
+ void testHyper();
+ void testUnsignedHyper();
+ void testFloat();
+ void testDouble();
+ void testChar();
+ void testString();
+ void testType();
+ void testSequence();
+ void testEnum();
+ void testStruct();
+ void testPoly();
+ void testException();
+ void testInterface();
+ void testNull();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testVoid);
+ CPPUNIT_TEST(testBoolean);
+ CPPUNIT_TEST(testByte);
+ CPPUNIT_TEST(testShort);
+ CPPUNIT_TEST(testUnsignedShort);
+ CPPUNIT_TEST(testLong);
+ CPPUNIT_TEST(testUnsignedLong);
+ CPPUNIT_TEST(testHyper);
+ CPPUNIT_TEST(testUnsignedHyper);
+ CPPUNIT_TEST(testFloat);
+ CPPUNIT_TEST(testDouble);
+ CPPUNIT_TEST(testChar);
+ CPPUNIT_TEST(testString);
+ CPPUNIT_TEST(testType);
+ CPPUNIT_TEST(testSequence);
+ CPPUNIT_TEST(testEnum);
+ CPPUNIT_TEST(testStruct);
+ CPPUNIT_TEST(testPoly);
+ CPPUNIT_TEST(testException);
+ CPPUNIT_TEST(testInterface);
+ CPPUNIT_TEST(testNull);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void Test::testVoid() {
+ css::uno::Any a;
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<void>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", 2.0f, b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>", sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testBoolean() {
+ css::uno::Any a(false);
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<bool>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", (a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", !b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", (a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", 2.0f, b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testByte() {
+ css::uno::Any a(static_cast< sal_Int8 >(1));
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int8>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(1), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(1), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(1), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testShort() {
+ css::uno::Any a(static_cast< sal_Int16 >(1));
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int16>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(1), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(1), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testUnsignedShort() {
+ sal_uInt16 n = 1;
+ css::uno::Any a(&n, cppu::UnoType<cppu::UnoUnsignedShortType>::get());
+ CPPUNIT_ASSERT(
+ bool(a.getValueType() == cppu::UnoType<cppu::UnoUnsignedShortType>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(1), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(1), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testLong() {
+ css::uno::Any a(static_cast< sal_Int32 >(1));
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int32>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testUnsignedLong() {
+ css::uno::Any a(static_cast< sal_uInt32 >(1));
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_uInt32>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testHyper() {
+ css::uno::Any a(static_cast< sal_Int64 >(1));
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int64>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testUnsignedHyper() {
+ css::uno::Any a(static_cast< sal_uInt64 >(1));
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_uInt64>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testFloat() {
+ css::uno::Any a(1.f);
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<float>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testDouble() {
+ css::uno::Any a(1.);
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<double>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testChar() {
+ sal_Unicode c = '1';
+ css::uno::Any a(&c, cppu::UnoType<cppu::UnoCharType>::get());
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<cppu::UnoCharType>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'1', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testString() {
+ css::uno::Any a(OUString("1"));
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<OUString>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", (a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("1"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testType() {
+ css::uno::Any a(cppu::UnoType<sal_Int32>::get());
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<css::uno::Type>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type", cppu::UnoType<sal_Int32>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testSequence() {
+ sal_Int32 n = 1;
+ css::uno::Any a(css::uno::Sequence< sal_Int32 >(&n, 1));
+ CPPUNIT_ASSERT(
+ bool(a.getValueType()
+ == cppu::UnoType<css::uno::Sequence<sal_Int32>>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ css::uno::Sequence< sal_Int32 > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<sal_Int32>",
+ (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<sal_Int32>",
+ sal_Int32(1), b.getLength());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<sal_Int32>",
+ sal_Int32(1), b[0]);
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+ {
+ // The two default-constructed sequences both refer to the same static cppu::g_emptySeq
+ css::uno::Sequence<sal_Int32> aEmptyIntSequence;
+ css::uno::Sequence<OUString> aEmptyStringSequence;
+ a <<= aEmptyStringSequence;
+ CPPUNIT_ASSERT(!(a >>= aEmptyIntSequence));
+ }
+}
+
+void Test::testEnum() {
+ css::uno::Any a(Enum2_M1);
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Enum2>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Enum2 b = Enum2_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum2", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum2", Enum2_M1, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testStruct() {
+ css::uno::Any a(Struct2a(1, 3));
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Struct2a>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Struct2 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct2", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct2", sal_Int32(1), b.member);
+ }
+ {
+ Struct2a b(2, 2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "Struct2a", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Struct2a", sal_Int32(1), b.member);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Struct2a", sal_Int32(3), b.member2);
+ }
+ {
+ Struct2b b(2, 2, 2);
+ CPPUNIT_ASSERT_MESSAGE("Struct2b", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct2b", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testPoly() {
+ css::uno::Any a;
+ a <<= Poly< css::uno::Sequence< ::sal_Unicode > >();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "type name", OUString("Poly<[]char>"), a.getValueType().getTypeName() );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "constructor",
+ css::uno::Any(Poly< css::uno::Sequence< ::sal_Unicode > >()), a);
+}
+
+void Test::testException() {
+ css::uno::Any a(
+ Exception2a(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 1,
+ 3));
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Exception2a>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ Exception2 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception2", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception2", sal_Int32(1), b.member);
+ }
+ {
+ Exception2a b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
+ 2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "Exception2a", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Exception2a", sal_Int32(1), b.member);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "Exception2a", sal_Int32(3), b.member2);
+ }
+ {
+ Exception2b b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
+ 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception2b", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception2b", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+}
+
+void Test::testInterface() {
+ css::uno::Reference< Interface2a > i2(new Impl2);
+ css::uno::Any a(i2);
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Interface2a>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > i(new Impl1);
+ css::uno::Reference< Interface1 > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
+ }
+ {
+ css::uno::Reference< Interface2 > b(new Impl2);
+ CPPUNIT_ASSERT_MESSAGE("Interface2", (a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("Interface2", b.operator ==(i2));
+ }
+ {
+ css::uno::Reference< Interface2a > b(new Impl2);
+ CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface2a", i2, b);
+ }
+ {
+ css::uno::Reference< Interface2b > i(new Impl2b);
+ css::uno::Reference< Interface2b > b(i);
+ CPPUNIT_ASSERT_MESSAGE("Interface2b", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface2b", i, b);
+ }
+ {
+ css::uno::Reference< Interface3 > b(new Impl2);
+ CPPUNIT_ASSERT_MESSAGE("Interface3", (a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("Interface3", b.operator ==(i2));
+ }
+}
+
+void Test::testNull() {
+ css::uno::Any a { css::uno::Reference< Interface2a >() };
+ CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Interface2a>::get()));
+ {
+ bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("bool", b);
+ }
+ {
+ // [-loplugin:fakebool] false positive:
+ sal_Bool b = true;
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
+ }
+ {
+ sal_Int8 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
+ }
+ {
+ sal_Int16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
+ }
+ {
+ sal_uInt16 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
+ }
+ {
+ sal_Int32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
+ }
+ {
+ sal_uInt32 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
+ }
+ {
+ sal_Int64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
+ }
+ {
+ sal_uInt64 b = 2;
+ CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
+ }
+ {
+ float b = 2;
+ CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
+ }
+ {
+ double b = 2;
+ CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
+ }
+ {
+ sal_Unicode b = '2';
+ CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
+ }
+ {
+ OUString b("2");
+ CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
+ }
+ {
+ css::uno::Type b(cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Type",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Type",
+ cppu::UnoType<OUString>::get(), b);
+ }
+ {
+ css::uno::Sequence< OUString > b(2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "css::uno::Sequence<OUString>",
+ sal_Int32(2), b.getLength());
+ }
+ {
+ Enum1 b = Enum1_M2;
+ CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
+ }
+ {
+ Struct1 b(2);
+ CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
+ }
+ {
+ Exception1 b(
+ OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
+ CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
+ }
+ {
+ css::uno::Reference< Interface1 > b(new Impl1);
+ CPPUNIT_ASSERT_MESSAGE(
+ "Interface1", (a >>= b));
+ CPPUNIT_ASSERT_MESSAGE(
+ "Interface1", !b.is());
+ }
+ {
+ css::uno::Reference< Interface2 > b(new Impl2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "Interface2", (a >>= b));
+ CPPUNIT_ASSERT_MESSAGE(
+ "Interface2", !b.is());
+ }
+ {
+ css::uno::Reference< Interface2a > b(new Impl2);
+ CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b));
+ CPPUNIT_ASSERT_MESSAGE("Interface2a", !b.is());
+ }
+ {
+ css::uno::Reference< Interface2b > b(new Impl2b);
+ CPPUNIT_ASSERT_MESSAGE(
+ "Interface2b", (a >>= b));
+ CPPUNIT_ASSERT_MESSAGE(
+ "Interface2b", !b.is());
+ }
+ {
+ css::uno::Reference< Interface3 > b(new Impl2);
+ CPPUNIT_ASSERT_MESSAGE(
+ "Interface3", (a >>= b));
+ CPPUNIT_ASSERT_MESSAGE(
+ "Interface3", !b.is());
+ }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppu/qa/test_recursion.cxx b/cppu/qa/test_recursion.cxx
new file mode 100644
index 000000000..40aee4c30
--- /dev/null
+++ b/cppu/qa/test_recursion.cxx
@@ -0,0 +1,53 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/types.h>
+
+#include <cppunit/TestSuite.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/TestCase.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <Rec.hpp>
+
+namespace
+{
+
+class Test: public CppUnit::TestFixture {
+
+public:
+ void testRecursion();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testRecursion);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void Test::testRecursion() {
+ CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), Rec().x.getLength());
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppu/qa/test_reference.cxx b/cppu/qa/test_reference.cxx
new file mode 100644
index 000000000..698a8d5fe
--- /dev/null
+++ b/cppu/qa/test_reference.cxx
@@ -0,0 +1,203 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/types.h>
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <Interface1.hpp>
+
+namespace
+{
+
+using ::com::sun::star::uno::Type;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::UNO_SET_THROW;
+
+class Foo: public Interface1
+{
+public:
+ Foo()
+ :m_refCount(0)
+ {
+ }
+
+ Foo(const Foo&) = delete;
+ const Foo& operator=(const Foo&) = delete;
+
+ virtual Any SAL_CALL queryInterface(const Type & _type) override
+ {
+ if (_type == cppu::UnoType<XInterface>::get())
+ {
+ return css::uno::Any(css::uno::Reference<css::uno::XInterface>(
+ this));
+ }
+ if (_type == cppu::UnoType<Interface1>::get())
+ {
+ return css::uno::Any(css::uno::Reference<Interface1>(this));
+ }
+
+ return Any();
+ }
+
+ virtual void SAL_CALL acquire() noexcept override
+ {
+ osl_atomic_increment( &m_refCount );
+ }
+
+ virtual void SAL_CALL release() noexcept override
+ {
+ if ( 0 == osl_atomic_decrement( &m_refCount ) )
+ delete this;
+ }
+
+protected:
+ virtual ~Foo()
+ {
+ }
+
+private:
+ oslInterlockedCount m_refCount;
+};
+
+// Check that the up-casting Reference conversion constructor catches the
+// intended cases:
+
+struct Base1: public css::uno::XInterface {
+ virtual ~Base1() = delete;
+ static ::css::uno::Type const & static_type(void * = nullptr) // loplugin:refcounting
+ { return ::cppu::UnoType<Base1>::get(); }
+};
+struct Base2: public Base1 {
+ virtual ~Base2() override = delete;
+};
+struct Base3: public Base1 { virtual ~Base3() override = delete; };
+struct Derived: public Base2, public Base3 {
+ virtual ~Derived() override = delete;
+};
+
+// The special case using the conversion operator instead:
+css::uno::Reference< css::uno::XInterface > testUpcast1(
+ css::uno::Reference< Derived > const & ref)
+{
+ Base1::static_type(); // prevent loplugin:unreffun firing
+ return ref;
+}
+
+// The normal up-cast case:
+css::uno::Reference< Base1 > testUpcast2(
+ css::uno::Reference< Base2 > const & ref)
+{ return ref; }
+
+// Commenting this in should cause a compiler error due to an ambiguous up-cast:
+/*
+css::uno::Reference< Base1 > testFailingUpcast3(
+ css::uno::Reference< Derived > const & ref)
+{ return ref; }
+*/
+
+// Commenting this in should cause a compiler error due to a down-cast:
+/*
+css::uno::Reference< Base2 > testFailingUpcast4(
+ css::uno::Reference< Base1 > const & ref)
+{ return ref; }
+*/
+
+// Commenting this in should cause a compiler error due to a down-cast:
+/*
+css::uno::Reference< Base1 > testFailingUpcast5(
+ css::uno::Reference< css::uno::XInterface > const & ref)
+{ return ref; }
+*/
+
+class Test: public ::CppUnit::TestFixture
+{
+
+public:
+ void testUnoSetThrow();
+ void testUpcastCompilation();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testUnoSetThrow);
+ CPPUNIT_TEST(testUpcastCompilation);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void Test::testUnoSetThrow()
+{
+ Reference< Interface1 > xNull;
+ Reference< Interface1 > xFoo( new Foo );
+
+ // ctor taking Reference< interface_type >
+ bool bCaughtException = false;
+ try { Reference< Interface1 > x( xNull, UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; }
+ CPPUNIT_ASSERT_EQUAL( true, bCaughtException );
+
+ bCaughtException = false;
+ try { Reference< Interface1 > x( xFoo, UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; }
+ CPPUNIT_ASSERT_EQUAL( false, bCaughtException );
+
+ // ctor taking interface_type*
+ bCaughtException = false;
+ try { Reference< Interface1 > x( xNull.get(), UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; }
+ CPPUNIT_ASSERT_EQUAL( true, bCaughtException );
+
+ bCaughtException = false;
+ try { Reference< Interface1 > x( xFoo.get(), UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; }
+ CPPUNIT_ASSERT_EQUAL( false, bCaughtException );
+
+ Reference< Interface1 > x;
+ // "set" taking Reference< interface_type >
+ bCaughtException = false;
+ try { x.set( xNull, UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; }
+ CPPUNIT_ASSERT_EQUAL( true, bCaughtException );
+
+ bCaughtException = false;
+ try { x.set( xFoo, UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; }
+ CPPUNIT_ASSERT_EQUAL( false, bCaughtException );
+
+ // "set" taking interface_type*
+ bCaughtException = false;
+ try { x.set( xNull.get(), UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; }
+ CPPUNIT_ASSERT_EQUAL( true, bCaughtException );
+
+ bCaughtException = false;
+ try { x.set( xFoo.get(), UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; }
+ CPPUNIT_ASSERT_EQUAL( false, bCaughtException );
+}
+
+// Include a dummy test calling those functions, to avoid warnings about those
+// functions being unused:
+void Test::testUpcastCompilation()
+{
+ testUpcast1(css::uno::Reference< Derived >());
+ testUpcast2(css::uno::Reference< Base2 >());
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+} // namespace
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppu/qa/test_unotype.cxx b/cppu/qa/test_unotype.cxx
new file mode 100644
index 000000000..829676a14
--- /dev/null
+++ b/cppu/qa/test_unotype.cxx
@@ -0,0 +1,558 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/types.h>
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <typeinfo>
+
+#include <com/sun/star/beans/Optional.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/uno/TypeClass.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <cppu/unotype.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com::sun::star::uno {
+ class Any;
+}
+
+namespace com::sun::star::uno { template <class interface_type> class Reference; }
+
+namespace {
+
+struct DerivedStruct1: css::lang::EventObject {};
+
+struct DerivedStruct2: css::beans::PropertyChangeEvent {};
+
+struct DerivedException1: css::uno::Exception {};
+
+struct DerivedException2: css::uno::RuntimeException {};
+
+struct DerivedInterface1: css::uno::XInterface {
+private:
+ ~DerivedInterface1() {}
+ // avoid warnings about virtual members and non-virtual dtor
+
+public:
+ static void dummy(DerivedInterface1 * p)
+ { p->DerivedInterface1::~DerivedInterface1(); }
+ // ...and avoid warnings about unused ~DerivedInterface1 (see below)
+};
+
+struct DerivedInterface2: css::uno::XComponentContext {
+private:
+ ~DerivedInterface2() {}
+ // avoid warnings about virtual members and non-virtual dtor
+
+public:
+ static void dummy(DerivedInterface2 * p)
+ { p->DerivedInterface2::~DerivedInterface2(); }
+ // ...and avoid warnings about unused ~DerivedInterface2 (see below)
+};
+
+class Test: public CppUnit::TestFixture {
+public:
+ void testUnoType();
+
+ void testGetTypeFavourUnsigned();
+
+ void testGetTypeFavourChar();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testUnoType);
+ CPPUNIT_TEST(testGetTypeFavourUnsigned);
+ CPPUNIT_TEST(testGetTypeFavourChar);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void Test::testUnoType() {
+ // Avoid warnings about unused ~DerivedInterface1/2 (see above):
+ if ((false)) {
+ DerivedInterface1::dummy(nullptr);
+ DerivedInterface2::dummy(nullptr);
+ }
+
+ css::uno::Type t;
+ t = cppu::UnoType<cppu::UnoVoidType>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_VOID, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("void"), t.getTypeName());
+ CPPUNIT_ASSERT(bool(cppu::UnoType<void>::get() == t));
+ t = cppu::UnoType<bool>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_BOOLEAN, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("boolean"), t.getTypeName());
+ CPPUNIT_ASSERT(bool(cppu::UnoType<sal_Bool>::get() == t));
+ t = cppu::UnoType<sal_Int8>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_BYTE, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("byte"), t.getTypeName());
+ t = cppu::UnoType<sal_Int16>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SHORT, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("short"), t.getTypeName());
+ t = cppu::UnoType<cppu::UnoUnsignedShortType>::get();
+ CPPUNIT_ASSERT_EQUAL(
+ css::uno::TypeClass_UNSIGNED_SHORT, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("unsigned short"), t.getTypeName());
+ t = cppu::UnoType<sal_Int32>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_LONG, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("long"), t.getTypeName());
+ t = cppu::UnoType<sal_uInt32>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_UNSIGNED_LONG, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("unsigned long"), t.getTypeName());
+ t = cppu::UnoType<sal_Int64>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_HYPER, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("hyper"), t.getTypeName());
+ t = cppu::UnoType<sal_uInt64>::get();
+ CPPUNIT_ASSERT_EQUAL(
+ css::uno::TypeClass_UNSIGNED_HYPER, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("unsigned hyper"), t.getTypeName());
+ t = cppu::UnoType<float>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_FLOAT, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("float"), t.getTypeName());
+ t = cppu::UnoType<double>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_DOUBLE, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("double"), t.getTypeName());
+ t = cppu::UnoType<cppu::UnoCharType>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_CHAR, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("char"), t.getTypeName());
+ t = cppu::UnoType<OUString>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRING, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("string"), t.getTypeName());
+ t = cppu::UnoType<css::uno::Type>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_TYPE, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("type"), t.getTypeName());
+ t = cppu::UnoType<css::uno::Any>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_ANY, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("any"), t.getTypeName());
+ t = cppu::UnoType<cppu::UnoSequenceType<sal_Int8>>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("[]byte"), t.getTypeName());
+ CPPUNIT_ASSERT(bool(cppu::UnoType<css::uno::Sequence<sal_Int8>>::get() == t));
+ t = cppu::UnoType<cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("[]unsigned short"), t.getTypeName());
+ t = cppu::UnoType<cppu::UnoSequenceType<cppu::UnoCharType>>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("[]char"), t.getTypeName());
+ t = cppu::UnoType<
+ cppu::UnoSequenceType<cppu::UnoSequenceType<sal_Int8>>>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("[][]byte"), t.getTypeName());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::UnoType<css::uno::Sequence<css::uno::Sequence<sal_Int8>>>::get(),
+ t);
+ t = cppu::UnoType<
+ cppu::UnoSequenceType<
+ cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("[][]unsigned short"), t.getTypeName());
+ t = cppu::UnoType<
+ cppu::UnoSequenceType<cppu::UnoSequenceType<cppu::UnoCharType>>>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(OUString("[][]char"), t.getTypeName());
+ t = cppu::UnoType<css::uno::TypeClass>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_ENUM, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("com.sun.star.uno.TypeClass"), t.getTypeName());
+ t = cppu::UnoType<css::lang::EventObject>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRUCT, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("com.sun.star.lang.EventObject"), t.getTypeName());
+ CPPUNIT_ASSERT_EQUAL(cppu::UnoType<DerivedStruct1>::get(), t);
+ t = cppu::UnoType<css::beans::PropertyChangeEvent>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRUCT, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("com.sun.star.beans.PropertyChangeEvent"), t.getTypeName());
+ CPPUNIT_ASSERT_EQUAL(cppu::UnoType<DerivedStruct2>::get(), t);
+ t = cppu::UnoType<css::beans::Optional<sal_Int8>>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRUCT, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("com.sun.star.beans.Optional<byte>"), t.getTypeName());
+ t = cppu::UnoType<css::uno::Exception>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_EXCEPTION, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("com.sun.star.uno.Exception"), t.getTypeName());
+ CPPUNIT_ASSERT_EQUAL(cppu::UnoType<DerivedException1>::get(), t);
+ t = cppu::UnoType<css::uno::RuntimeException>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_EXCEPTION, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("com.sun.star.uno.RuntimeException"), t.getTypeName());
+ CPPUNIT_ASSERT_EQUAL(cppu::UnoType<DerivedException2>::get(), t);
+ t = cppu::UnoType<css::uno::XInterface>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_INTERFACE, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("com.sun.star.uno.XInterface"), t.getTypeName());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::UnoType<css::uno::Reference<css::uno::XInterface>>::get(), t);
+ CPPUNIT_ASSERT_EQUAL(cppu::UnoType<DerivedInterface1>::get(), t);
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::UnoType<css::uno::Reference<DerivedInterface1>>::get(), t);
+ t = cppu::UnoType<css::uno::XComponentContext>::get();
+ CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_INTERFACE, t.getTypeClass());
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("com.sun.star.uno.XComponentContext"), t.getTypeName());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::UnoType<css::uno::Reference<css::uno::XComponentContext>>::get(),
+ t);
+ CPPUNIT_ASSERT_EQUAL(cppu::UnoType<DerivedInterface2>::get(), t);
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::UnoType<css::uno::Reference<DerivedInterface2>>::get(), t);
+}
+
+void Test::testGetTypeFavourUnsigned() {
+ CPPUNIT_ASSERT(typeid(sal_Unicode) != typeid(sal_uInt16));
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<cppu::UnoVoidType *>(nullptr)),
+ cppu::UnoType<cppu::UnoVoidType>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<bool *>(nullptr)),
+ cppu::UnoType<bool>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<sal_Bool *>(nullptr)),
+ cppu::UnoType<bool>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<sal_Int8 *>(nullptr)),
+ cppu::UnoType<sal_Int8>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<sal_Int16 *>(nullptr)),
+ cppu::UnoType<sal_Int16>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<cppu::UnoUnsignedShortType *>(nullptr)),
+ cppu::UnoType<cppu::UnoUnsignedShortType>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<sal_uInt16 *>(nullptr)),
+ cppu::UnoType<cppu::UnoUnsignedShortType>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<sal_Int32 *>(nullptr)),
+ cppu::UnoType<sal_Int32>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<sal_uInt32 *>(nullptr)),
+ cppu::UnoType<sal_uInt32>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<sal_Int64 *>(nullptr)),
+ cppu::UnoType<sal_Int64>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<sal_uInt64 *>(nullptr)),
+ cppu::UnoType<sal_uInt64>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<float *>(nullptr)),
+ cppu::UnoType<float>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<double *>(nullptr)),
+ cppu::UnoType<double>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<cppu::UnoCharType *>(nullptr)),
+ cppu::UnoType<cppu::UnoCharType>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<sal_Unicode *>(nullptr)),
+ cppu::UnoType<cppu::UnoCharType>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<OUString *>(nullptr)),
+ cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<css::uno::Type *>(nullptr)),
+ cppu::UnoType<css::uno::Type>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<css::uno::Any *>(nullptr)),
+ cppu::UnoType<css::uno::Any>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<
+ cppu::UnoSequenceType<cppu::UnoUnsignedShortType> *>(nullptr)),
+ cppu::UnoType<
+ cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::uno::Sequence<sal_uInt16> *>(nullptr)),
+ cppu::UnoType<
+ cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<
+ cppu::UnoSequenceType<
+ cppu::UnoSequenceType<
+ cppu::UnoUnsignedShortType>> *>(nullptr)),
+ cppu::UnoType<
+ cppu::UnoSequenceType<
+ cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<
+ css::uno::Sequence<css::uno::Sequence<sal_uInt16>> *>(nullptr)),
+ cppu::UnoType<
+ cppu::UnoSequenceType<
+ cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::uno::Sequence<sal_Unicode> *>(nullptr)),
+ cppu::UnoType<cppu::UnoSequenceType<cppu::UnoCharType>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<
+ css::uno::Sequence<
+ css::uno::Sequence<sal_Unicode>> *>(nullptr)),
+ cppu::UnoType<
+ cppu::UnoSequenceType<
+ cppu::UnoSequenceType<cppu::UnoCharType>>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::uno::TypeClass *>(nullptr)),
+ cppu::UnoType<css::uno::TypeClass>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::lang::EventObject *>(nullptr)),
+ cppu::UnoType<css::lang::EventObject>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<DerivedStruct1 *>(nullptr)),
+ cppu::UnoType<css::lang::EventObject>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::beans::PropertyChangeEvent *>(nullptr)),
+ cppu::UnoType<css::beans::PropertyChangeEvent>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<DerivedStruct2 *>(nullptr)),
+ cppu::UnoType<css::beans::PropertyChangeEvent>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::beans::Optional<sal_Int8> *>(nullptr)),
+ cppu::UnoType<css::beans::Optional<sal_Int8>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::uno::Exception *>(nullptr)),
+ cppu::UnoType<css::uno::Exception>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<DerivedException1 *>(nullptr)),
+ cppu::UnoType<css::uno::Exception>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::uno::RuntimeException *>(nullptr)),
+ cppu::UnoType<css::uno::RuntimeException>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<DerivedException2 *>(nullptr)),
+ cppu::UnoType<css::uno::RuntimeException>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::uno::XInterface *>(nullptr)),
+ cppu::UnoType<css::uno::XInterface>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::uno::Reference<css::uno::XInterface> *>(nullptr)),
+ cppu::UnoType<css::uno::XInterface>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<DerivedInterface1 *>(nullptr)),
+ cppu::UnoType<css::uno::XInterface>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::uno::Reference<DerivedInterface1> *>(nullptr)),
+ cppu::UnoType<css::uno::XInterface>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::uno::XComponentContext *>(nullptr)),
+ cppu::UnoType<css::uno::XComponentContext>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<
+ css::uno::Reference<css::uno::XComponentContext> *>(nullptr)),
+ cppu::UnoType<css::uno::XComponentContext>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(static_cast<DerivedInterface2 *>(nullptr)),
+ cppu::UnoType<css::uno::XComponentContext>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourUnsigned(
+ static_cast<css::uno::Reference<DerivedInterface2> *>(nullptr)),
+ cppu::UnoType<css::uno::XComponentContext>::get());
+}
+
+void Test::testGetTypeFavourChar() {
+ CPPUNIT_ASSERT(typeid(sal_Unicode) != typeid(sal_uInt16));
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<cppu::UnoVoidType *>(nullptr)),
+ cppu::UnoType<cppu::UnoVoidType>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<bool *>(nullptr)),
+ cppu::UnoType<bool>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<sal_Bool *>(nullptr)),
+ cppu::UnoType<bool>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<sal_Int8 *>(nullptr)),
+ cppu::UnoType<sal_Int8>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<sal_Int16 *>(nullptr)),
+ cppu::UnoType<sal_Int16>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<cppu::UnoUnsignedShortType *>(nullptr)),
+ cppu::UnoType<cppu::UnoUnsignedShortType>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<sal_uInt16 *>(nullptr)),
+ cppu::UnoType<cppu::UnoUnsignedShortType>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<sal_Int32 *>(nullptr)),
+ cppu::UnoType<sal_Int32>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<sal_uInt32 *>(nullptr)),
+ cppu::UnoType<sal_uInt32>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<sal_Int64 *>(nullptr)),
+ cppu::UnoType<sal_Int64>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<sal_uInt64 *>(nullptr)),
+ cppu::UnoType<sal_uInt64>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<float *>(nullptr)),
+ cppu::UnoType<float>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<double *>(nullptr)),
+ cppu::UnoType<double>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<cppu::UnoCharType *>(nullptr)),
+ cppu::UnoType<cppu::UnoCharType>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<sal_Unicode *>(nullptr)),
+ cppu::UnoType<cppu::UnoCharType>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<OUString *>(nullptr)),
+ cppu::UnoType<OUString>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<css::uno::Type *>(nullptr)),
+ cppu::UnoType<css::uno::Type>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<css::uno::Any *>(nullptr)),
+ cppu::UnoType<css::uno::Any>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<
+ cppu::UnoSequenceType<cppu::UnoUnsignedShortType> *>(nullptr)),
+ cppu::UnoType<
+ cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<css::uno::Sequence<sal_uInt16> *>(nullptr)),
+ cppu::UnoType<
+ cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<
+ cppu::UnoSequenceType<
+ cppu::UnoSequenceType<
+ cppu::UnoUnsignedShortType>> *>(nullptr)),
+ cppu::UnoType<
+ cppu::UnoSequenceType<
+ cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<
+ css::uno::Sequence<css::uno::Sequence<sal_uInt16>> *>(nullptr)),
+ cppu::UnoType<
+ cppu::UnoSequenceType<
+ cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<css::uno::Sequence<sal_Unicode> *>(nullptr)),
+ cppu::UnoType<cppu::UnoSequenceType<cppu::UnoCharType>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<
+ css::uno::Sequence<
+ css::uno::Sequence<sal_Unicode>> *>(nullptr)),
+ cppu::UnoType<
+ cppu::UnoSequenceType<
+ cppu::UnoSequenceType<cppu::UnoCharType>>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<css::uno::TypeClass *>(nullptr)),
+ cppu::UnoType<css::uno::TypeClass>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<css::lang::EventObject *>(nullptr)),
+ cppu::UnoType<css::lang::EventObject>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<DerivedStruct1 *>(nullptr)),
+ cppu::UnoType<css::lang::EventObject>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<css::beans::PropertyChangeEvent *>(nullptr)),
+ cppu::UnoType<css::beans::PropertyChangeEvent>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<DerivedStruct2 *>(nullptr)),
+ cppu::UnoType<css::beans::PropertyChangeEvent>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<css::beans::Optional<sal_Int8> *>(nullptr)),
+ cppu::UnoType<css::beans::Optional<sal_Int8>>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<css::uno::Exception *>(nullptr)),
+ cppu::UnoType<css::uno::Exception>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<DerivedException1 *>(nullptr)),
+ cppu::UnoType<css::uno::Exception>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<css::uno::RuntimeException *>(nullptr)),
+ cppu::UnoType<css::uno::RuntimeException>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<DerivedException2 *>(nullptr)),
+ cppu::UnoType<css::uno::RuntimeException>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<css::uno::XInterface *>(nullptr)),
+ cppu::UnoType<css::uno::XInterface>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<css::uno::Reference<css::uno::XInterface> *>(nullptr)),
+ cppu::UnoType<css::uno::XInterface>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<DerivedInterface1 *>(nullptr)),
+ cppu::UnoType<css::uno::XInterface>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<css::uno::Reference<DerivedInterface1> *>(nullptr)),
+ cppu::UnoType<css::uno::XInterface>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<css::uno::XComponentContext *>(nullptr)),
+ cppu::UnoType<css::uno::XComponentContext>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<
+ css::uno::Reference<css::uno::XComponentContext> *>(nullptr)),
+ cppu::UnoType<css::uno::XComponentContext>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(static_cast<DerivedInterface2 *>(nullptr)),
+ cppu::UnoType<css::uno::XComponentContext>::get());
+ CPPUNIT_ASSERT_EQUAL(
+ cppu::getTypeFavourChar(
+ static_cast<css::uno::Reference<DerivedInterface2> *>(nullptr)),
+ cppu::UnoType<css::uno::XComponentContext>::get());
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppu/qa/typelib.cxx b/cppu/qa/typelib.cxx
new file mode 100644
index 000000000..227e5731c
--- /dev/null
+++ b/cppu/qa/typelib.cxx
@@ -0,0 +1,293 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/io/XTextInputStream.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/script/FinishReason.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <cppu/unotype.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <typelib/typedescription.h>
+#include <typelib/typedescription.hxx>
+
+// Test that typelib_typedescription_register as called from typelib_typedescription_complete
+// returns a correct typelib_TypeDescription and keeps pointers from the original
+// typelib_TypeDescription intact (see tdf#115399 "Data race in typelib_typedescription_register").
+// This code uses sufficiently "obscure" types in typelib_static_*_type_init to make it unlikely
+// that they are already instantiated and registered with the type description manager, which might
+// cause inconsistencies.
+
+namespace
+{
+class Test : public CppUnit::TestFixture
+{
+public:
+ void testEnum()
+ {
+ typelib_TypeDescriptionReference* ref = nullptr;
+ typelib_static_enum_type_init(&ref, "com.sun.star.script.MemberType", 0);
+ CPPUNIT_ASSERT(ref != nullptr);
+ typelib_TypeDescription* td = ref->pType;
+ CPPUNIT_ASSERT(td != nullptr);
+ typelib_typedescription_acquire(td);
+ CPPUNIT_ASSERT(!td->bComplete);
+ auto t = reinterpret_cast<typelib_EnumTypeDescription*>(td);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), t->nDefaultEnumValue);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), t->nEnumValues);
+ CPPUNIT_ASSERT(t->ppEnumNames == nullptr);
+ CPPUNIT_ASSERT(t->pEnumValues == nullptr);
+ CPPUNIT_ASSERT(typelib_typedescription_complete(&td));
+ CPPUNIT_ASSERT(td != nullptr);
+ CPPUNIT_ASSERT(td->bComplete);
+ t = reinterpret_cast<typelib_EnumTypeDescription*>(td);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), t->nDefaultEnumValue);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), t->nEnumValues);
+ CPPUNIT_ASSERT(t->ppEnumNames != nullptr);
+ CPPUNIT_ASSERT_EQUAL(OUString("METHOD"), OUString::unacquired(&t->ppEnumNames[0]));
+ CPPUNIT_ASSERT_EQUAL(OUString("PROPERTY"), OUString::unacquired(&t->ppEnumNames[1]));
+ CPPUNIT_ASSERT_EQUAL(OUString("UNKNOWN"), OUString::unacquired(&t->ppEnumNames[2]));
+ CPPUNIT_ASSERT(t->pEnumValues != nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), t->pEnumValues[0]);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), t->pEnumValues[1]);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), t->pEnumValues[2]);
+ typelib_typedescription_release(td);
+ typelib_typedescriptionreference_release(ref);
+ }
+
+ void testStruct()
+ {
+ auto const t0 = cppu::UnoType<css::lang::EventObject>::get();
+ auto const t1 = cppu::UnoType<css::script::FinishReason>::get();
+ auto const t2 = cppu::UnoType<OUString>::get();
+ auto const t3 = cppu::UnoType<css::uno::Any>::get();
+ typelib_TypeDescriptionReference* ref = nullptr;
+ typelib_TypeDescriptionReference* members[3]
+ = { t1.getTypeLibType(), t2.getTypeLibType(), t3.getTypeLibType() };
+ typelib_static_struct_type_init(&ref, "com.sun.star.script.FinishEngineEvent",
+ t0.getTypeLibType(), 3, members, nullptr);
+ CPPUNIT_ASSERT(ref != nullptr);
+ typelib_TypeDescription* td = ref->pType;
+ CPPUNIT_ASSERT(td != nullptr);
+ typelib_typedescription_acquire(td);
+ CPPUNIT_ASSERT(!td->bComplete);
+ auto t = reinterpret_cast<typelib_StructTypeDescription*>(td);
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&t->aBase.pBaseTypeDescription->aBase).equals(t0));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), t->aBase.nMembers);
+ auto const offsets = t->aBase.pMemberOffsets;
+ CPPUNIT_ASSERT(offsets != nullptr);
+ auto const typerefs = t->aBase.ppTypeRefs;
+ CPPUNIT_ASSERT(typerefs != nullptr);
+ CPPUNIT_ASSERT_EQUAL(t1, css::uno::Type(typerefs[0]));
+ CPPUNIT_ASSERT_EQUAL(t2, css::uno::Type(typerefs[1]));
+ CPPUNIT_ASSERT_EQUAL(t3, css::uno::Type(typerefs[2]));
+ CPPUNIT_ASSERT(t->aBase.ppMemberNames == nullptr);
+ CPPUNIT_ASSERT(t->pParameterizedTypes == nullptr);
+ CPPUNIT_ASSERT(typelib_typedescription_complete(&td));
+ CPPUNIT_ASSERT(td != nullptr);
+ CPPUNIT_ASSERT(td->bComplete);
+ t = reinterpret_cast<typelib_StructTypeDescription*>(td);
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&t->aBase.pBaseTypeDescription->aBase).equals(t0));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), t->aBase.nMembers);
+ CPPUNIT_ASSERT(t->aBase.pMemberOffsets != nullptr);
+ CPPUNIT_ASSERT(t->aBase.ppTypeRefs != nullptr);
+ CPPUNIT_ASSERT_EQUAL(t1, css::uno::Type(t->aBase.ppTypeRefs[0]));
+ CPPUNIT_ASSERT_EQUAL(t2, css::uno::Type(t->aBase.ppTypeRefs[1]));
+ CPPUNIT_ASSERT_EQUAL(t3, css::uno::Type(t->aBase.ppTypeRefs[2]));
+ CPPUNIT_ASSERT(t->aBase.ppMemberNames != nullptr);
+ CPPUNIT_ASSERT_EQUAL(OUString("Finish"), OUString::unacquired(&t->aBase.ppMemberNames[0]));
+ CPPUNIT_ASSERT_EQUAL(OUString("ErrorMessage"),
+ OUString::unacquired(&t->aBase.ppMemberNames[1]));
+ CPPUNIT_ASSERT_EQUAL(OUString("Return"), OUString::unacquired(&t->aBase.ppMemberNames[2]));
+ CPPUNIT_ASSERT(t->pParameterizedTypes == nullptr);
+ // `offsets` and `typerefs` must still be valid:
+ CPPUNIT_ASSERT_EQUAL(t->aBase.pMemberOffsets[0], offsets[0]);
+ CPPUNIT_ASSERT_EQUAL(t->aBase.pMemberOffsets[1], offsets[1]);
+ CPPUNIT_ASSERT_EQUAL(t->aBase.pMemberOffsets[2], offsets[2]);
+ CPPUNIT_ASSERT_EQUAL(css::uno::Type(t->aBase.ppTypeRefs[0]), css::uno::Type(typerefs[0]));
+ CPPUNIT_ASSERT_EQUAL(css::uno::Type(t->aBase.ppTypeRefs[1]), css::uno::Type(typerefs[1]));
+ CPPUNIT_ASSERT_EQUAL(css::uno::Type(t->aBase.ppTypeRefs[2]), css::uno::Type(typerefs[2]));
+ typelib_typedescription_release(td);
+ typelib_typedescriptionreference_release(ref);
+ }
+
+ void testPolyStruct()
+ {
+ auto const t1 = cppu::UnoType<bool>::get();
+ auto const t2 = cppu::UnoType<sal_Int32>::get();
+ typelib_TypeDescriptionReference* ref = nullptr;
+ typelib_TypeDescriptionReference* members[2] = { t1.getTypeLibType(), t2.getTypeLibType() };
+ sal_Bool const param[2] = { false, true };
+ typelib_static_struct_type_init(&ref, "com.sun.star.beans.Optional<long>", nullptr, 2,
+ members, param);
+ CPPUNIT_ASSERT(ref != nullptr);
+ typelib_TypeDescription* td = ref->pType;
+ CPPUNIT_ASSERT(td != nullptr);
+ typelib_typedescription_acquire(td);
+ CPPUNIT_ASSERT(!td->bComplete);
+ auto t = reinterpret_cast<typelib_StructTypeDescription*>(td);
+ CPPUNIT_ASSERT(t->aBase.pBaseTypeDescription == nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), t->aBase.nMembers);
+ auto const offsets = t->aBase.pMemberOffsets;
+ CPPUNIT_ASSERT(offsets != nullptr);
+ auto const typerefs = t->aBase.ppTypeRefs;
+ CPPUNIT_ASSERT(typerefs != nullptr);
+ CPPUNIT_ASSERT_EQUAL(t1, css::uno::Type(typerefs[0]));
+ CPPUNIT_ASSERT_EQUAL(t2, css::uno::Type(typerefs[1]));
+ CPPUNIT_ASSERT(t->aBase.ppMemberNames == nullptr);
+ CPPUNIT_ASSERT(t->pParameterizedTypes != nullptr);
+ CPPUNIT_ASSERT_EQUAL(param[0], t->pParameterizedTypes[0]);
+ CPPUNIT_ASSERT_EQUAL(param[1], t->pParameterizedTypes[1]);
+ CPPUNIT_ASSERT(typelib_typedescription_complete(&td));
+ CPPUNIT_ASSERT(td != nullptr);
+ CPPUNIT_ASSERT(td->bComplete);
+ t = reinterpret_cast<typelib_StructTypeDescription*>(td);
+ CPPUNIT_ASSERT(t->aBase.pBaseTypeDescription == nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), t->aBase.nMembers);
+ CPPUNIT_ASSERT(t->aBase.pMemberOffsets != nullptr);
+ CPPUNIT_ASSERT(t->aBase.ppTypeRefs != nullptr);
+ CPPUNIT_ASSERT_EQUAL(t1, css::uno::Type(t->aBase.ppTypeRefs[0]));
+ CPPUNIT_ASSERT_EQUAL(t2, css::uno::Type(t->aBase.ppTypeRefs[1]));
+ CPPUNIT_ASSERT(t->aBase.ppMemberNames != nullptr);
+ CPPUNIT_ASSERT_EQUAL(OUString("IsPresent"),
+ OUString::unacquired(&t->aBase.ppMemberNames[0]));
+ CPPUNIT_ASSERT_EQUAL(OUString("Value"), OUString::unacquired(&t->aBase.ppMemberNames[1]));
+ CPPUNIT_ASSERT(t->pParameterizedTypes != nullptr);
+ CPPUNIT_ASSERT_EQUAL(param[0], t->pParameterizedTypes[0]);
+ CPPUNIT_ASSERT_EQUAL(param[1], t->pParameterizedTypes[1]);
+ // `offsets` and `typerefs` must still be valid:
+ CPPUNIT_ASSERT_EQUAL(t->aBase.pMemberOffsets[0], offsets[0]);
+ CPPUNIT_ASSERT_EQUAL(t->aBase.pMemberOffsets[1], offsets[1]);
+ CPPUNIT_ASSERT_EQUAL(css::uno::Type(t->aBase.ppTypeRefs[0]), css::uno::Type(typerefs[0]));
+ CPPUNIT_ASSERT_EQUAL(css::uno::Type(t->aBase.ppTypeRefs[1]), css::uno::Type(typerefs[1]));
+ typelib_typedescription_release(td);
+ typelib_typedescriptionreference_release(ref);
+ }
+
+ void testInterface()
+ {
+ auto const t0 = cppu::UnoType<css::uno::XInterface>::get();
+ typelib_TypeDescriptionReference* ref = nullptr;
+ typelib_TypeDescriptionReference* bases[1] = { t0.getTypeLibType() };
+ typelib_static_mi_interface_type_init(&ref, "com.sun.star.script.XTypeConverter", 1, bases);
+ CPPUNIT_ASSERT(ref != nullptr);
+ typelib_TypeDescription* td = ref->pType;
+ CPPUNIT_ASSERT(td != nullptr);
+ typelib_typedescription_acquire(td);
+ CPPUNIT_ASSERT(!td->bComplete);
+ auto t = reinterpret_cast<typelib_InterfaceTypeDescription*>(td);
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&t->pBaseTypeDescription->aBase).equals(t0));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), t->nMembers);
+ CPPUNIT_ASSERT(t->ppMembers == nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), t->nAllMembers);
+ CPPUNIT_ASSERT(t->ppAllMembers == nullptr);
+ CPPUNIT_ASSERT(t->pMapMemberIndexToFunctionIndex == nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), t->nMapFunctionIndexToMemberIndex);
+ CPPUNIT_ASSERT(t->pMapFunctionIndexToMemberIndex == nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), t->nBaseTypes);
+ auto const basetypes = t->ppBaseTypes;
+ CPPUNIT_ASSERT(basetypes != nullptr);
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&basetypes[0]->aBase).equals(t0));
+ CPPUNIT_ASSERT(typelib_typedescription_complete(&td));
+ CPPUNIT_ASSERT(td != nullptr);
+ CPPUNIT_ASSERT(td->bComplete);
+ t = reinterpret_cast<typelib_InterfaceTypeDescription*>(td);
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&t->pBaseTypeDescription->aBase).equals(t0));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), t->nMembers);
+ CPPUNIT_ASSERT(t->ppMembers != nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), t->nAllMembers);
+ CPPUNIT_ASSERT(t->ppAllMembers != nullptr);
+ CPPUNIT_ASSERT(t->pMapMemberIndexToFunctionIndex != nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), t->nMapFunctionIndexToMemberIndex);
+ CPPUNIT_ASSERT(t->pMapFunctionIndexToMemberIndex != nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), t->nBaseTypes);
+ CPPUNIT_ASSERT(t->ppBaseTypes != nullptr);
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&t->ppBaseTypes[0]->aBase).equals(t0));
+ // `basetypes` must still be valid:
+ CPPUNIT_ASSERT(
+ css::uno::TypeDescription(&basetypes[0]->aBase).equals(&t->ppBaseTypes[0]->aBase));
+ typelib_typedescription_release(td);
+ typelib_typedescriptionreference_release(ref);
+ }
+
+ void testMultiInterface()
+ {
+ auto const t1 = cppu::UnoType<css::io::XTextInputStream>::get();
+ auto const t2 = cppu::UnoType<css::io::XActiveDataSink>::get();
+ typelib_TypeDescriptionReference* ref = nullptr;
+ typelib_TypeDescriptionReference* bases[2] = { t1.getTypeLibType(), t2.getTypeLibType() };
+ typelib_static_mi_interface_type_init(&ref, "com.sun.star.io.XTextInputStream2", 2, bases);
+ CPPUNIT_ASSERT(ref != nullptr);
+ typelib_TypeDescription* td = ref->pType;
+ CPPUNIT_ASSERT(td != nullptr);
+ typelib_typedescription_acquire(td);
+ CPPUNIT_ASSERT(!td->bComplete);
+ auto t = reinterpret_cast<typelib_InterfaceTypeDescription*>(td);
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&t->pBaseTypeDescription->aBase).equals(t1));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), t->nMembers);
+ CPPUNIT_ASSERT(t->ppMembers == nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), t->nAllMembers);
+ CPPUNIT_ASSERT(t->ppAllMembers == nullptr);
+ CPPUNIT_ASSERT(t->pMapMemberIndexToFunctionIndex == nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), t->nMapFunctionIndexToMemberIndex);
+ CPPUNIT_ASSERT(t->pMapFunctionIndexToMemberIndex == nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), t->nBaseTypes);
+ auto const basetypes = t->ppBaseTypes;
+ CPPUNIT_ASSERT(basetypes != nullptr);
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&basetypes[0]->aBase).equals(t1));
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&basetypes[1]->aBase).equals(t2));
+ CPPUNIT_ASSERT(typelib_typedescription_complete(&td));
+ CPPUNIT_ASSERT(td != nullptr);
+ CPPUNIT_ASSERT(td->bComplete);
+ t = reinterpret_cast<typelib_InterfaceTypeDescription*>(td);
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&t->pBaseTypeDescription->aBase).equals(t1));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), t->nMembers);
+ CPPUNIT_ASSERT(t->ppMembers == nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(14), t->nAllMembers);
+ CPPUNIT_ASSERT(t->ppAllMembers != nullptr);
+ CPPUNIT_ASSERT(t->pMapMemberIndexToFunctionIndex != nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(14), t->nMapFunctionIndexToMemberIndex);
+ CPPUNIT_ASSERT(t->pMapFunctionIndexToMemberIndex != nullptr);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), t->nBaseTypes);
+ CPPUNIT_ASSERT(t->ppBaseTypes != nullptr);
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&t->ppBaseTypes[0]->aBase).equals(t1));
+ CPPUNIT_ASSERT(css::uno::TypeDescription(&t->ppBaseTypes[1]->aBase).equals(t2));
+ // `basetypes` must still be valid:
+ CPPUNIT_ASSERT(
+ css::uno::TypeDescription(&basetypes[0]->aBase).equals(&t->ppBaseTypes[0]->aBase));
+ CPPUNIT_ASSERT(
+ css::uno::TypeDescription(&basetypes[1]->aBase).equals(&t->ppBaseTypes[1]->aBase));
+ typelib_typedescription_release(td);
+ typelib_typedescriptionreference_release(ref);
+ }
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testEnum);
+ CPPUNIT_TEST(testStruct);
+ CPPUNIT_TEST(testPolyStruct);
+ CPPUNIT_TEST(testInterface);
+ CPPUNIT_TEST(testMultiInterface);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+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/types.idl b/cppu/qa/types.idl
new file mode 100644
index 000000000..a17b035e0
--- /dev/null
+++ b/cppu/qa/types.idl
@@ -0,0 +1,57 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <com/sun/star/uno/Exception.idl>
+#include <com/sun/star/uno/XInterface.idl>
+
+enum Enum1 { M0, M1, M2 };
+
+enum Enum2 { M0, M1, M2 };
+
+struct Struct1 { long member; };
+
+struct Struct2 { long member; };
+
+struct Struct2a: Struct2 { long member2; };
+
+struct Struct2b: Struct2a { long member3; };
+
+struct Poly< T > { long member; };
+
+struct Rec { sequence< Rec > x; };
+
+exception Exception1: com::sun::star::uno::Exception { long member; };
+
+exception Exception2: com::sun::star::uno::Exception { long member; };
+
+exception Exception2a: Exception2 { long member2; };
+
+exception Exception2b: Exception2a {};
+
+interface Interface1 {};
+
+interface Interface2 {};
+
+interface Interface2a: Interface2 {};
+
+interface Interface2b: Interface2a {};
+
+interface Interface3 {};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */