Kaydet (Commit) 87a2c1d5 authored tarafından Daniel Robertson's avatar Daniel Robertson Kaydeden (comit) Caolán McNamara

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/18207Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst d8bf4491
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx> #include <cppuhelper/queryinterface.hxx>
#include <comphelper/sequence.hxx>
#include "pq_tools.hxx" #include "pq_tools.hxx"
#include "pq_xbase.hxx" #include "pq_xbase.hxx"
...@@ -65,8 +66,8 @@ ReflectionBase::ReflectionBase( ...@@ -65,8 +66,8 @@ ReflectionBase::ReflectionBase(
const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > &conn, const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > &conn,
ConnectionSettings *pSettings, ConnectionSettings *pSettings,
cppu::IPropertyArrayHelper & props /* must survive this object !*/ ) cppu::IPropertyArrayHelper & props /* must survive this object !*/ )
: OComponentHelper( refMutex->mutex ), : ReflectionBase_BASE( refMutex->mutex ),
OPropertySetHelper( OComponentHelper::rBHelper ), OPropertySetHelper( ReflectionBase_BASE::rBHelper ),
m_implName( implName ), m_implName( implName ),
m_supportedServices( supportedServices ), m_supportedServices( supportedServices ),
m_refMutex( refMutex ), m_refMutex( refMutex ),
...@@ -164,15 +165,11 @@ Sequence< com::sun::star::uno::Type > ReflectionBase::getTypes() ...@@ -164,15 +165,11 @@ Sequence< com::sun::star::uno::Type > ReflectionBase::getTypes()
throw( com::sun::star::uno::RuntimeException, std::exception ) throw( com::sun::star::uno::RuntimeException, std::exception )
{ {
osl::MutexGuard guard( m_refMutex->mutex ); osl::MutexGuard guard( m_refMutex->mutex );
static cppu::OTypeCollection collection( static Sequence< ::com::sun::star::uno::Type > collection(
cppu::UnoType<XPropertySet>::get(), ::comphelper::concatSequences(
cppu::UnoType<XFastPropertySet>::get(), ::cppu::OPropertySetHelper::getTypes(),
cppu::UnoType<XMultiPropertySet>::get(), ReflectionBase_BASE::getTypes() ) );
cppu::UnoType<com::sun::star::lang::XServiceInfo>::get(), return collection;
cppu::UnoType<com::sun::star::sdbcx::XDataDescriptorFactory>::get(),
cppu::UnoType<com::sun::star::container::XNamed>::get(),
OComponentHelper::getTypes());
return collection.getTypes();
} }
...@@ -180,18 +177,8 @@ com::sun::star::uno::Any ReflectionBase::queryInterface( ...@@ -180,18 +177,8 @@ com::sun::star::uno::Any ReflectionBase::queryInterface(
const com::sun::star::uno::Type & reqType ) const com::sun::star::uno::Type & reqType )
throw (com::sun::star::uno::RuntimeException, std::exception) throw (com::sun::star::uno::RuntimeException, std::exception)
{ {
Any ret; Any ret = ReflectionBase_BASE::queryInterface( reqType );
ret = OComponentHelper::queryInterface( reqType ); return ret.hasValue() ? ret : OPropertySetHelper::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;
} }
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XBASE_HXX #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XBASE_HXX
#include <cppuhelper/propshlp.hxx> #include <cppuhelper/propshlp.hxx>
#include <cppuhelper/component.hxx> #include <cppuhelper/component.hxx>
#include <cppuhelper/compbase.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/container/XNamed.hpp>
...@@ -47,12 +48,14 @@ ...@@ -47,12 +48,14 @@
namespace pq_sdbc_driver 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 : class ReflectionBase :
public cppu::OComponentHelper, public ReflectionBase_BASE,
public cppu::OPropertySetHelper, public cppu::OPropertySetHelper
public com::sun::star::lang::XServiceInfo,
public com::sun::star::sdbcx::XDataDescriptorFactory,
public com::sun::star::container::XNamed
{ {
protected: protected:
const OUString m_implName; const OUString m_implName;
...@@ -79,8 +82,8 @@ public: // for initialization purposes only, not exported via an interface ! ...@@ -79,8 +82,8 @@ public: // for initialization purposes only, not exported via an interface !
const OUString & name, const com::sun::star::uno::Any & value ); const OUString & name, const com::sun::star::uno::Any & value );
public: //XInterface public: //XInterface
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase_BASE::acquire(); }
virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase_BASE::release(); }
virtual com::sun::star::uno::Any SAL_CALL queryInterface( virtual com::sun::star::uno::Any SAL_CALL queryInterface(
const com::sun::star::uno::Type & reqType ) const com::sun::star::uno::Type & reqType )
throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
......
...@@ -67,8 +67,8 @@ public: ...@@ -67,8 +67,8 @@ public:
const OUString &tableName); const OUString &tableName);
public: // XInterface public: // XInterface
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); }
virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); }
virtual com::sun::star::uno::Any SAL_CALL queryInterface( virtual com::sun::star::uno::Any SAL_CALL queryInterface(
const com::sun::star::uno::Type & reqType ) const com::sun::star::uno::Type & reqType )
throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
...@@ -102,8 +102,8 @@ public: ...@@ -102,8 +102,8 @@ public:
ConnectionSettings *pSettings); ConnectionSettings *pSettings);
public: // XInterface public: // XInterface
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); }
virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); }
virtual com::sun::star::uno::Any SAL_CALL queryInterface( virtual com::sun::star::uno::Any SAL_CALL queryInterface(
const com::sun::star::uno::Type & reqType ) const com::sun::star::uno::Type & reqType )
throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
......
...@@ -67,8 +67,8 @@ public: ...@@ -67,8 +67,8 @@ public:
const OUString &tableName); const OUString &tableName);
public: // XInterface public: // XInterface
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); }
virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); }
virtual com::sun::star::uno::Any SAL_CALL queryInterface( virtual com::sun::star::uno::Any SAL_CALL queryInterface(
const com::sun::star::uno::Type & reqType ) const com::sun::star::uno::Type & reqType )
throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
...@@ -100,8 +100,8 @@ public: ...@@ -100,8 +100,8 @@ public:
ConnectionSettings *pSettings ); ConnectionSettings *pSettings );
public: // XInterface public: // XInterface
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); }
virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); }
virtual com::sun::star::uno::Any SAL_CALL queryInterface( virtual com::sun::star::uno::Any SAL_CALL queryInterface(
const com::sun::star::uno::Type & reqType ) const com::sun::star::uno::Type & reqType )
throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
......
...@@ -75,8 +75,8 @@ public: ...@@ -75,8 +75,8 @@ public:
ConnectionSettings *pSettings); ConnectionSettings *pSettings);
// XInterface // XInterface
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); }
virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); }
virtual com::sun::star::uno::Any SAL_CALL queryInterface( virtual com::sun::star::uno::Any SAL_CALL queryInterface(
const com::sun::star::uno::Type & reqType ) const com::sun::star::uno::Type & reqType )
throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
...@@ -152,8 +152,8 @@ public: ...@@ -152,8 +152,8 @@ public:
ConnectionSettings *pSettings); ConnectionSettings *pSettings);
public: // XInterface public: // XInterface
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); }
virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); }
virtual com::sun::star::uno::Any SAL_CALL queryInterface( virtual com::sun::star::uno::Any SAL_CALL queryInterface(
const com::sun::star::uno::Type & reqType ) const com::sun::star::uno::Type & reqType )
throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
......
...@@ -59,8 +59,8 @@ public: ...@@ -59,8 +59,8 @@ public:
ConnectionSettings *pSettings); ConnectionSettings *pSettings);
// XInterface // XInterface
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); }
virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); }
virtual com::sun::star::uno::Any SAL_CALL queryInterface( virtual com::sun::star::uno::Any SAL_CALL queryInterface(
const com::sun::star::uno::Type & reqType ) const com::sun::star::uno::Type & reqType )
throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
......
...@@ -58,8 +58,8 @@ public: ...@@ -58,8 +58,8 @@ public:
ConnectionSettings *pSettings); ConnectionSettings *pSettings);
// XInterface // XInterface
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { ReflectionBase::acquire(); }
virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } virtual void SAL_CALL release() throw() SAL_OVERRIDE { ReflectionBase::release(); }
virtual com::sun::star::uno::Any SAL_CALL queryInterface( virtual com::sun::star::uno::Any SAL_CALL queryInterface(
const com::sun::star::uno::Type & reqType ) const com::sun::star::uno::Type & reqType )
throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment