summaryrefslogtreecommitdiff
path: root/cppu/qa/test_unotype.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-22 16:39:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-04 06:38:03 +0000
commit5676ced82539d9e40bde6196d2aa3b2e4c7b3fdb (patch)
treedb860b2365f8cb0e2fab4772e80e4e38d4d89b37 /cppu/qa/test_unotype.cxx
parent1a1d1a86e9129ec3885610b641179b30f9bf5e79 (diff)
make UNO enums scoped for internal LO code
this modifies codemaker so that, for an UNO enum, we generate code that effectively looks like: #ifdef LIBO_INTERNAL_ONLY && HAVE_CX11_CONSTEXPR enum class XXX { ONE = 1 }; constexpr auto ONE = XXX_ONE; #else ...the old normal way.. #endif which means that for LO internal code, the enums are scoped. The "constexpr auto" trick acts like an alias so we don't have to use scoped naming everywhere. Change-Id: I3054ecb230e8666ce98b4a9cb87b384df5f64fb4 Reviewed-on: https://gerrit.libreoffice.org/34546 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppu/qa/test_unotype.cxx')
-rw-r--r--cppu/qa/test_unotype.cxx65
1 files changed, 36 insertions, 29 deletions
diff --git a/cppu/qa/test_unotype.cxx b/cppu/qa/test_unotype.cxx
index 47274580c329..6269ff2cfa86 100644
--- a/cppu/qa/test_unotype.cxx
+++ b/cppu/qa/test_unotype.cxx
@@ -53,8 +53,15 @@ operator <<(std::basic_ostream<charT, traits> & stream, Type const & type) {
return stream << type.getTypeName();
}
+std::ostream& operator<< (std::ostream& aStream, const css::uno::TypeClass& aTypeClass)
+{
+ aStream << (sal_Int32)aTypeClass;
+ return aStream;
+}
+
} } } }
+
namespace {
struct DerivedStruct1: css::lang::EventObject {};
@@ -111,67 +118,67 @@ void Test::testUnoType() {
css::uno::Type t;
t = cppu::UnoType<cppu::UnoVoidType>::get();
- CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_VOID, +t.getTypeClass());
+ 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(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(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(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());
+ 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(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(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(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());
+ 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(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(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(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(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(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(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(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(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(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(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(),
@@ -179,42 +186,42 @@ void Test::testUnoType() {
t = cppu::UnoType<
cppu::UnoSequenceType<
cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>>::get();
- CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass());
+ 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(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(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(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(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(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(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(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(css::uno::TypeClass_INTERFACE, t.getTypeClass());
CPPUNIT_ASSERT_EQUAL(
OUString("com.sun.star.uno.XInterface"), t.getTypeName());
CPPUNIT_ASSERT_EQUAL(
@@ -223,7 +230,7 @@ void Test::testUnoType() {
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(css::uno::TypeClass_INTERFACE, t.getTypeClass());
CPPUNIT_ASSERT_EQUAL(
OUString("com.sun.star.uno.XComponentContext"), t.getTypeName());
CPPUNIT_ASSERT_EQUAL(