diff options
author | Daniel Robertson <danlrobertson89@gmail.com> | 2015-08-31 17:35:14 -0400 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-09-03 08:08:31 +0000 |
commit | 87a2c1d5a0b2eeed30461fe39328ccb66359cff0 (patch) | |
tree | 0a1740b00a57156279708d8fbedca8fbf28abaa3 /connectivity | |
parent | d8bf4491b15dab47223200b4c04ac4b3f17aebd2 (diff) |
tdf#88462 connectivity convert manual XInterface
Convert postgresql driver ReflectionBase manual XInterface
implementation to use ::cppu::WeakComponentImplHelper.
Change-Id: I738bd7df33de9c0fe0e3242eb5a4fab6a8dcb3f0
Reviewed-on: https://gerrit.libreoffice.org/18207
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'connectivity')
7 files changed, 36 insertions, 46 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_xbase.cxx b/connectivity/source/drivers/postgresql/pq_xbase.cxx index 7473bc76181b..bfee0783307b 100644 --- a/connectivity/source/drivers/postgresql/pq_xbase.cxx +++ b/connectivity/source/drivers/postgresql/pq_xbase.cxx @@ -38,6 +38,7 @@ #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> +#include <comphelper/sequence.hxx> #include "pq_tools.hxx" #include "pq_xbase.hxx" @@ -65,8 +66,8 @@ ReflectionBase::ReflectionBase( const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > &conn, ConnectionSettings *pSettings, cppu::IPropertyArrayHelper & props /* must survive this object !*/ ) - : OComponentHelper( refMutex->mutex ), - OPropertySetHelper( OComponentHelper::rBHelper ), + : ReflectionBase_BASE( refMutex->mutex ), + OPropertySetHelper( ReflectionBase_BASE::rBHelper ), m_implName( implName ), m_supportedServices( supportedServices ), m_refMutex( refMutex ), @@ -164,15 +165,11 @@ Sequence< com::sun::star::uno::Type > ReflectionBase::getTypes() throw( com::sun::star::uno::RuntimeException, std::exception ) { osl::MutexGuard guard( m_refMutex->mutex ); - static cppu::OTypeCollection collection( - cppu::UnoType<XPropertySet>::get(), - cppu::UnoType<XFastPropertySet>::get(), - cppu::UnoType<XMultiPropertySet>::get(), - cppu::UnoType<com::sun::star::lang::XServiceInfo>::get(), - cppu::UnoType<com::sun::star::sdbcx::XDataDescriptorFactory>::get(), - cppu::UnoType<com::sun::star::container::XNamed>::get(), - OComponentHelper::getTypes()); - return collection.getTypes(); + static Sequence< ::com::sun::star::uno::Type > collection( + ::comphelper::concatSequences( + ::cppu::OPropertySetHelper::getTypes(), + ReflectionBase_BASE::getTypes() ) ); + return collection; } @@ -180,18 +177,8 @@ com::sun::star::uno::Any ReflectionBase::queryInterface( const com::sun::star::uno::Type & reqType ) throw (com::sun::star::uno::RuntimeException, std::exception) { - Any ret; - ret = OComponentHelper::queryInterface( reqType ); - if( ! ret.hasValue() ) - ret = ::cppu::queryInterface( - reqType, - static_cast< com::sun::star::beans::XPropertySet * > ( this ), - static_cast< com::sun::star::beans::XMultiPropertySet * > ( this ), - static_cast< com::sun::star::lang::XServiceInfo * > ( this ), - static_cast< com::sun::star::beans::XFastPropertySet * > ( this ) , - static_cast< com::sun::star::sdbcx::XDataDescriptorFactory * > ( this ), - static_cast< com::sun::star::container::XNamed * > ( this ) ); - return ret; + Any ret = ReflectionBase_BASE::queryInterface( reqType ); + return ret.hasValue() ? ret : OPropertySetHelper::queryInterface( reqType ); } diff --git a/connectivity/source/drivers/postgresql/pq_xbase.hxx b/connectivity/source/drivers/postgresql/pq_xbase.hxx index fff7f55025a3..0d4b885daa92 100644 --- a/connectivity/source/drivers/postgresql/pq_xbase.hxx +++ b/connectivity/source/drivers/postgresql/pq_xbase.hxx @@ -38,6 +38,7 @@ #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XBASE_HXX #include <cppuhelper/propshlp.hxx> #include <cppuhelper/component.hxx> +#include <cppuhelper/compbase.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XNamed.hpp> @@ -47,12 +48,14 @@ namespace pq_sdbc_driver { +typedef ::cppu::WeakComponentImplHelper< ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::sdbcx::XDataDescriptorFactory, + ::com::sun::star::container::XNamed + > ReflectionBase_BASE; + class ReflectionBase : - public cppu::OComponentHelper, - public cppu::OPropertySetHelper, - public com::sun::star::lang::XServiceInfo, - public com::sun::star::sdbcx::XDataDescriptorFactory, - public com::sun::star::container::XNamed + public ReflectionBase_BASE, + public cppu::OPropertySetHelper { protected: const OUString m_implName; @@ -79,8 +82,8 @@ public: // for initialization purposes only, not exported via an interface ! const OUString & name, const com::sun::star::uno::Any & value ); public: //XInterface - virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } - virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase_BASE::acquire(); } + virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase_BASE::release(); } virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/connectivity/source/drivers/postgresql/pq_xindex.hxx b/connectivity/source/drivers/postgresql/pq_xindex.hxx index eb92ff1e8f7c..112d41a87c7b 100644 --- a/connectivity/source/drivers/postgresql/pq_xindex.hxx +++ b/connectivity/source/drivers/postgresql/pq_xindex.hxx @@ -67,8 +67,8 @@ public: const OUString &tableName); public: // XInterface - virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } - virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); } + virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); } virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; @@ -102,8 +102,8 @@ public: ConnectionSettings *pSettings); public: // XInterface - virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } - virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); } + virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); } virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/connectivity/source/drivers/postgresql/pq_xkey.hxx b/connectivity/source/drivers/postgresql/pq_xkey.hxx index b3f18790472f..abc37c3424d5 100644 --- a/connectivity/source/drivers/postgresql/pq_xkey.hxx +++ b/connectivity/source/drivers/postgresql/pq_xkey.hxx @@ -67,8 +67,8 @@ public: const OUString &tableName); public: // XInterface - virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } - virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); } + virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); } virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; @@ -100,8 +100,8 @@ public: ConnectionSettings *pSettings ); public: // XInterface - virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } - virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); } + virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); } virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/connectivity/source/drivers/postgresql/pq_xtable.hxx b/connectivity/source/drivers/postgresql/pq_xtable.hxx index cbef55eeca2c..cd9b4f1c03e8 100644 --- a/connectivity/source/drivers/postgresql/pq_xtable.hxx +++ b/connectivity/source/drivers/postgresql/pq_xtable.hxx @@ -75,8 +75,8 @@ public: ConnectionSettings *pSettings); // XInterface - virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } - virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); } + virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); } virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; @@ -152,8 +152,8 @@ public: ConnectionSettings *pSettings); public: // XInterface - virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } - virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); } + virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); } virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/connectivity/source/drivers/postgresql/pq_xuser.hxx b/connectivity/source/drivers/postgresql/pq_xuser.hxx index 9358f2bcc867..82b6f41db55f 100644 --- a/connectivity/source/drivers/postgresql/pq_xuser.hxx +++ b/connectivity/source/drivers/postgresql/pq_xuser.hxx @@ -59,8 +59,8 @@ public: ConnectionSettings *pSettings); // XInterface - virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } - virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); } + virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); } virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/connectivity/source/drivers/postgresql/pq_xview.hxx b/connectivity/source/drivers/postgresql/pq_xview.hxx index e93d34766488..dfaadc73ae5c 100644 --- a/connectivity/source/drivers/postgresql/pq_xview.hxx +++ b/connectivity/source/drivers/postgresql/pq_xview.hxx @@ -58,8 +58,8 @@ public: ConnectionSettings *pSettings); // XInterface - virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } - virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); } + virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); } virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; |