summaryrefslogtreecommitdiff
path: root/cppuhelper/test
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-14 19:27:00 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-14 19:32:30 +0200
commit2171077c0c3c43a61546ab2c0ae68ba63c5112f7 (patch)
tree09461b7faec131f25b223b4bcbb2bf5b2a701763 /cppuhelper/test
parent3ed834ae87eca0f6c486666699112a95edb74abb (diff)
Introduce cppu::supportsService helper, adapt some call-sites
...more to follow (easy hack?) Change-Id: Icb02626495701a3905c124c7368b98c3258e91b2
Diffstat (limited to 'cppuhelper/test')
-rw-r--r--cppuhelper/test/cfg_test.cxx10
-rw-r--r--cppuhelper/test/testcmp/TestComponent.cxx11
2 files changed, 4 insertions, 17 deletions
diff --git a/cppuhelper/test/cfg_test.cxx b/cppuhelper/test/cfg_test.cxx
index ac976be57740..1f0830be9915 100644
--- a/cppuhelper/test/cfg_test.cxx
+++ b/cppuhelper/test/cfg_test.cxx
@@ -40,6 +40,7 @@
#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/bootstrap.hxx>
#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
@@ -154,14 +155,7 @@ Sequence< OUString > ServiceImpl0::getSupportedServiceNames()
sal_Bool ServiceImpl0::supportsService( const OUString & rServiceName )
throw(::com::sun::star::uno::RuntimeException)
{
- const Sequence< OUString > & rSNL = getSupportedServiceNames();
- const OUString * pArray = rSNL.getConstArray();
- for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
- {
- if (pArray[nPos] == rServiceName)
- return sal_True;
- }
- return sal_False;
+ return cppu::supportsService(this, rServiceName);
}
//==================================================================================================
diff --git a/cppuhelper/test/testcmp/TestComponent.cxx b/cppuhelper/test/testcmp/TestComponent.cxx
index a5f74778d3cd..e23069ad047f 100644
--- a/cppuhelper/test/testcmp/TestComponent.cxx
+++ b/cppuhelper/test/testcmp/TestComponent.cxx
@@ -29,6 +29,7 @@
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/implementationentry.hxx"
+#include "cppuhelper/supportsservice.hxx"
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
#include "com/sun/star/lang/XServiceInfo.hpp"
@@ -146,15 +147,7 @@ uno::Any SAL_CALL TestComponent::queryInterface(uno::Type const & rType ) throw
sal_Bool SAL_CALL TestComponent::supportsService(rtl::OUString const & ServiceName)
throw (uno::RuntimeException)
{
- uno::Sequence<rtl::OUString> serviceNames = getSupportedServiceNames_Static();
-
- for (sal_Int32 n = 0; n < serviceNames.getLength(); ++n)
- {
- if (serviceNames[n] == ServiceName)
- return true;
- }
-
- return false;
+ return cppu::supportsService(this, ServiceName);
}
uno::Sequence<rtl::OUString> SAL_CALL TestComponent::getSupportedServiceNames()