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 @@
#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 );
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
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