tdf#88462 convert manual XInterface implementations

Change-Id: I00561b7a6de6265cfdea0e3a92f404fac86982f6
Reviewed-on: https://gerrit.libreoffice.org/22213
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
kerem
2016-02-08 16:09:56 +02:00
committed by Stephan Bergmann
parent 1570fc1729
commit 098c1e495e
2 changed files with 23 additions and 38 deletions

View File

@@ -41,6 +41,8 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <comphelper/sequence.hxx>
#include "pq_tools.hxx"
#include "pq_array.hxx"
#include "pq_statement.hxx"
@@ -138,8 +140,8 @@ BaseResultSet::BaseResultSet(
sal_Int32 rowCount,
sal_Int32 colCount,
const Reference< com::sun::star::script::XTypeConverter > & tc )
: OComponentHelper( refMutex->mutex )
, OPropertySetHelper( OComponentHelper::rBHelper )
: BaseResultSet_BASE( refMutex->mutex )
, OPropertySetHelper( BaseResultSet_BASE::rBHelper )
, m_owner( owner )
, m_tc( tc )
, m_refMutex( refMutex )
@@ -159,22 +161,10 @@ BaseResultSet::~BaseResultSet()
POSTGRE_TRACE( "dtor BaseResultSet" );
}
Any BaseResultSet::queryInterface( const Type & reqType ) throw (RuntimeException, std::exception)
Any BaseResultSet::queryInterface( const Type & rType ) throw (RuntimeException, std::exception)
{
Any ret;
ret = OComponentHelper::queryInterface( reqType );
if( ! ret.hasValue() )
ret = ::cppu::queryInterface( reqType,
static_cast< XResultSet * > ( this ),
static_cast< XResultSetMetaDataSupplier * > ( this ),
static_cast< XRow * > ( this ),
static_cast< XColumnLocate * > ( this ),
static_cast< XCloseable * > ( this ),
static_cast< XPropertySet * > ( this ),
static_cast< XMultiPropertySet * > ( this ),
static_cast< XFastPropertySet * > ( this ) );
return ret;
Any aRet = BaseResultSet_BASE::queryInterface(rType);
return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType);
}
// void BaseResultSet::close( ) throw (SQLException, RuntimeException)
@@ -195,26 +185,20 @@ Any BaseResultSet::queryInterface( const Type & reqType ) throw (RuntimeExceptio
Sequence<Type > BaseResultSet::getTypes() throw( RuntimeException, std::exception )
{
static cppu::OTypeCollection *pCollection;
static Sequence< Type > *pCollection;
if( ! pCollection )
{
MutexGuard guard( osl::Mutex::getGlobalMutex() );
if( !pCollection )
{
static cppu::OTypeCollection collection(
cppu::UnoType<XResultSet>::get(),
cppu::UnoType<XResultSetMetaDataSupplier>::get(),
cppu::UnoType<XRow>::get(),
cppu::UnoType<XColumnLocate>::get(),
cppu::UnoType<XCloseable>::get(),
cppu::UnoType<XPropertySet>::get(),
cppu::UnoType<XFastPropertySet>::get(),
cppu::UnoType<XMultiPropertySet>::get(),
OComponentHelper::getTypes());
static Sequence< Type > collection(
::comphelper::concatSequences(
OPropertySetHelper::getTypes(),
BaseResultSet_BASE::getTypes()));
pCollection = &collection;
}
}
return pCollection->getTypes();
return *pCollection;
}
Sequence< sal_Int8> BaseResultSet::getImplementationId() throw( RuntimeException, std::exception )

View File

@@ -59,13 +59,14 @@ static const sal_Int32 BASERESULTSET_RESULT_SET_TYPE = 6;
#define BASERESULTSET_SIZE 7
class BaseResultSet : public cppu::OComponentHelper,
public cppu::OPropertySetHelper,
public com::sun::star::sdbc::XCloseable,
public com::sun::star::sdbc::XResultSetMetaDataSupplier,
public com::sun::star::sdbc::XResultSet,
public com::sun::star::sdbc::XRow,
public com::sun::star::sdbc::XColumnLocate
typedef ::cppu::WeakComponentImplHelper< ::com::sun::star::sdbc::XCloseable,
::com::sun::star::sdbc::XResultSetMetaDataSupplier,
::com::sun::star::sdbc::XResultSet,
::com::sun::star::sdbc::XRow,
::com::sun::star::sdbc::XColumnLocate
> BaseResultSet_BASE;
class BaseResultSet : public BaseResultSet_BASE,
public cppu::OPropertySetHelper
{
protected:
com::sun::star::uno::Any m_props[BASERESULTSET_SIZE];
@@ -100,8 +101,8 @@ protected:
virtual ~BaseResultSet();
public: // XInterface
virtual void SAL_CALL acquire() throw() override { OComponentHelper::acquire(); }
virtual void SAL_CALL release() throw() override { OComponentHelper::release(); }
virtual void SAL_CALL acquire() throw() override { BaseResultSet_BASE::acquire(); }
virtual void SAL_CALL release() throw() override { BaseResultSet_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) override;