summaryrefslogtreecommitdiff
path: root/odk
diff options
context:
space:
mode:
authorMarcos Paulo de Souza <marcos.souza.org@gmail.com>2013-10-24 14:55:08 -0200
committerStephan Bergmann <sbergman@redhat.com>2013-10-25 08:07:04 +0000
commitda5449da0c056a3a0da239eff2e2b8b66cfd6224 (patch)
tree6f6698e676726bd8a07f281a9707e448a711d983 /odk
parent01a13519e2a12e1e9b61bab1437d340e389e44bf (diff)
fdo#54938: More uses of cppu::supportsService
Change-Id: Id6bed78d92eba52283a17ab3ca66e751c225e48d Reviewed-on: https://gerrit.libreoffice.org/6423 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'odk')
-rw-r--r--odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx16
-rw-r--r--odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx19
-rw-r--r--odk/examples/cpp/counter/counter.cxx17
-rw-r--r--odk/examples/cpp/custompanel/ctp_factory.cxx20
4 files changed, 13 insertions, 59 deletions
diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx
index 762453bbb9eb..78d8145f8cd5 100644
--- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx
+++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx
@@ -33,6 +33,7 @@
*
*************************************************************************/
+#include <cppuhelper/supportsservice.hxx>
#include "SDriver.hxx"
#include "SConnection.hxx"
@@ -46,7 +47,6 @@ namespace connectivity
{
namespace skeleton
{
- //------------------------------------------------------------------
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SkeletonDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
{
return *(new SkeletonDriver());
@@ -83,7 +83,7 @@ rtl::OUString SkeletonDriver::getImplementationName_Static( ) throw(RuntimeExce
// this name is referenced in the configuration and in the skeleton.xml
// Please take care when changing it.
}
-//------------------------------------------------------------------------------
+
Sequence< ::rtl::OUString > SkeletonDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
{
// which service is supported
@@ -93,31 +93,21 @@ Sequence< ::rtl::OUString > SkeletonDriver::getSupportedServiceNames_Static( )
return aSNS;
}
-//------------------------------------------------------------------
::rtl::OUString SAL_CALL SkeletonDriver::getImplementationName( ) throw(RuntimeException)
{
return getImplementationName_Static();
}
-//------------------------------------------------------------------
sal_Bool SAL_CALL SkeletonDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
+ return cppu::supportsService(this, _rServiceName);
}
-//------------------------------------------------------------------
Sequence< ::rtl::OUString > SAL_CALL SkeletonDriver::getSupportedServiceNames( ) throw(RuntimeException)
{
return getSupportedServiceNames_Static();
}
-// --------------------------------------------------------------------------------
Reference< XConnection > SAL_CALL SkeletonDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
{
// create a new connection with the given properties and append it to our vector
diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx
index 196f06182f17..63a029438b57 100644
--- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx
+++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
#include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/supportsService.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
#include "propertyids.hxx"
@@ -53,13 +54,12 @@ using namespace com::sun::star::container;
using namespace com::sun::star::io;
using namespace com::sun::star::util;
-//------------------------------------------------------------------------------
// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \
{
return ::rtl::OUString("com.sun.star.sdbcx.skeleton.ResultSet");
}
-// -------------------------------------------------------------------------
+
Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException)
{
Sequence< ::rtl::OUString > aSupported(2);
@@ -67,19 +67,12 @@ using namespace com::sun::star::util;
aSupported[1] = ::rtl::OUString("com.sun.star.sdbcx.ResultSet");
return aSupported;
}
-// -------------------------------------------------------------------------
+
sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException)
{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
+ return cppu::supportsService(this, _rServiceName);
}
-// -------------------------------------------------------------------------
OResultSet::OResultSet(OStatement_Base* pStmt)
: OResultSet_BASE(m_aMutex)
,OPropertySetHelper(OResultSet_BASE::rBHelper)
@@ -90,11 +83,11 @@ OResultSet::OResultSet(OStatement_Base* pStmt)
,m_bWasNull(sal_True)
{
}
-// -------------------------------------------------------------------------
+
OResultSet::~OResultSet()
{
}
-// -------------------------------------------------------------------------
+
void OResultSet::disposing(void)
{
OPropertySetHelper::disposing();
diff --git a/odk/examples/cpp/counter/counter.cxx b/odk/examples/cpp/counter/counter.cxx
index 9dd008e06762..c539d66494b3 100644
--- a/odk/examples/cpp/counter/counter.cxx
+++ b/odk/examples/cpp/counter/counter.cxx
@@ -48,6 +48,7 @@
#include <rtl/ustring.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
// generated c++ interfaces
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -66,8 +67,6 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
using namespace ::foo;
-
-//========================================================================
class MyCounterImpl
: public XCountable
, public XServiceInfo
@@ -113,42 +112,30 @@ public:
{ return (--m_nCount); }
};
-//*************************************************************************
OUString SAL_CALL MyCounterImpl::getImplementationName( )
throw(RuntimeException)
{
return OUString( IMPLNAME );
}
-//*************************************************************************
sal_Bool SAL_CALL MyCounterImpl::supportsService( const OUString& ServiceName )
throw(RuntimeException)
{
- Sequence< OUString > aSNL = getSupportedServiceNames();
- const OUString * pArray = aSNL.getArray();
- for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
- if( pArray[i] == ServiceName )
- return sal_True;
- return sal_False;
+ return cppu::supportsService(this, ServiceName);
}
-//*************************************************************************
Sequence<OUString> SAL_CALL MyCounterImpl::getSupportedServiceNames( )
throw(RuntimeException)
{
return getSupportedServiceNames_Static();
}
-//*************************************************************************
Sequence<OUString> SAL_CALL MyCounterImpl::getSupportedServiceNames_Static( )
{
OUString aName( SERVICENAME );
return Sequence< OUString >( &aName, 1 );
}
-
-
-
/**
* Function to create a new component instance; is needed by factory helper implementation.
* @param xMgr service manager to if the components needs other component instances
diff --git a/odk/examples/cpp/custompanel/ctp_factory.cxx b/odk/examples/cpp/custompanel/ctp_factory.cxx
index 581e13135479..e2829029f168 100644
--- a/odk/examples/cpp/custompanel/ctp_factory.cxx
+++ b/odk/examples/cpp/custompanel/ctp_factory.cxx
@@ -24,12 +24,10 @@
#include <com/sun/star/lang/NotInitializedException.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/supportsservice.hxx>
-//......................................................................................................................
namespace sd { namespace colortoolpanel
{
-//......................................................................................................................
-
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::uno::UNO_QUERY;
@@ -102,40 +100,26 @@ namespace sd { namespace colortoolpanel
return xUIElement;
}
- //------------------------------------------------------------------------------------------------------------------
OUString SAL_CALL ToolPanelFactory::getImplementationName( ) throw (RuntimeException)
{
return getImplementationName_static();
}
- //------------------------------------------------------------------------------------------------------------------
OUString SAL_CALL ToolPanelFactory::getImplementationName_static( ) throw (RuntimeException)
{
return OUString( "org.openoffice.comp.example.custompanel.ToolPanelFactory" );
}
- //------------------------------------------------------------------------------------------------------------------
::sal_Bool SAL_CALL ToolPanelFactory::supportsService( const OUString& i_rServiceName ) throw (RuntimeException)
{
- const Sequence< OUString > aServiceNames( getSupportedServiceNames() );
- for ( const OUString* serviceName = aServiceNames.getConstArray();
- serviceName != aServiceNames.getConstArray() + aServiceNames.getLength();
- ++serviceName
- )
- {
- if ( i_rServiceName == *serviceName )
- return sal_True;
- }
- return sal_False;
+ return cppu::supportsService(this, i_rServiceName);
}
- //------------------------------------------------------------------------------------------------------------------
Sequence< OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames() throw (RuntimeException)
{
return getSupportedServiceNames_static();
}
- //------------------------------------------------------------------------------------------------------------------
Sequence< OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames_static() throw (RuntimeException)
{
Sequence< OUString > aServiceNames(1);