From 28239c40430ec4e613d9d936614c5c3853c332c4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 2 Mar 2019 08:28:03 +0200 Subject: simplify UNO getTypes methods Change-Id: Ia8b07edec54527fb4904536fabb03a18e8452550 Reviewed-on: https://gerrit.libreoffice.org/68659 Tested-by: Jenkins Reviewed-by: Noel Grandin --- stoc/source/invocation/invocation.cxx | 58 +++++++++++------------------------ 1 file changed, 18 insertions(+), 40 deletions(-) (limited to 'stoc/source') diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx index a4eec6a2fb76..81358c62cd59 100644 --- a/stoc/source/invocation/invocation.cxx +++ b/stoc/source/invocation/invocation.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -50,6 +51,7 @@ #include #include +#include #include #include @@ -971,62 +973,38 @@ void Invocation_Impl::fillInfoForMethod Sequence< Type > SAL_CALL Invocation_Impl::getTypes() { static Sequence s_types = [this]() { - Sequence types(4 + 10); - Type* pTypes = types.getArray(); - sal_Int32 n = 0; - - pTypes[n++] = cppu::UnoType::get(); - pTypes[n++] = cppu::UnoType::get(); - pTypes[n++] = cppu::UnoType::get(); - pTypes[n++] = cppu::UnoType::get(); + std::vector tmp { + cppu::UnoType::get(), + cppu::UnoType::get(), + cppu::UnoType::get(), + cppu::UnoType::get() }; // Invocation does not support XExactName if direct object supports // XInvocation, but not XExactName. if ((_xDirect.is() && _xENDirect.is()) || (!_xDirect.is() && _xENIntrospection.is())) - { - pTypes[n++] = cppu::UnoType::get(); - } + tmp.push_back(cppu::UnoType::get()); if (_xNameContainer.is()) - { - pTypes[n++] = cppu::UnoType::get(); - } + tmp.push_back(cppu::UnoType::get()); if (_xNameReplace.is()) - { - pTypes[n++] = cppu::UnoType::get(); - } + tmp.push_back(cppu::UnoType::get()); if (_xNameAccess.is()) - { - pTypes[n++] = cppu::UnoType::get(); - } + tmp.push_back(cppu::UnoType::get()); if (_xIndexContainer.is()) - { - pTypes[n++] = cppu::UnoType::get(); - } + tmp.push_back(cppu::UnoType::get()); if (_xIndexReplace.is()) - { - pTypes[n++] = cppu::UnoType::get(); - } + tmp.push_back(cppu::UnoType::get()); if (_xIndexAccess.is()) - { - pTypes[n++] = cppu::UnoType::get(); - } + tmp.push_back(cppu::UnoType::get()); if (_xEnumerationAccess.is()) - { - pTypes[n++] = cppu::UnoType::get(); - } + tmp.push_back(cppu::UnoType::get()); if (_xElementAccess.is()) - { - pTypes[n++] = cppu::UnoType::get(); - } + tmp.push_back(cppu::UnoType::get()); // Invocation does not support XInvocation2, if direct object supports // XInvocation, but not XInvocation2. if ((_xDirect.is() && _xDirect2.is()) || (!_xDirect.is() && _xIntrospectionAccess.is())) - { - pTypes[n++] = cppu::UnoType::get(); - } + tmp.push_back(cppu::UnoType::get()); - types.realloc(n); - return types; + return comphelper::containerToSequence(tmp); }(); return s_types; } -- cgit