[Libreoffice-commits] core.git: connectivity/source

kerem hallackerem at gmail.com
Tue Feb 9 10:02:55 UTC 2016


 connectivity/source/drivers/postgresql/pq_baseresultset.cxx |   42 +++---------
 connectivity/source/drivers/postgresql/pq_baseresultset.hxx |   19 ++---
 2 files changed, 23 insertions(+), 38 deletions(-)

New commits:
commit 098c1e495ee87f0674018fd18c77a3a1abef698d
Author: kerem <hallackerem at gmail.com>
Date:   Mon Feb 8 16:09:56 2016 +0200

    tdf#88462 convert manual XInterface implementations
    
    Change-Id: I00561b7a6de6265cfdea0e3a92f404fac86982f6
    Reviewed-on: https://gerrit.libreoffice.org/22213
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Lionel Elie Mamane <lionel at mamane.lu>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
index dc4e133..f8ce6ce 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
@@ -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 )
diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.hxx b/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
index aad0fbd..340126b 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
@@ -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;


More information about the Libreoffice-commits mailing list