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

Daniel Robertson danlrobertson89 at gmail.com
Thu Sep 3 01:08:52 PDT 2015


 connectivity/source/drivers/postgresql/pq_xbase.cxx  |   33 +++++--------------
 connectivity/source/drivers/postgresql/pq_xbase.hxx  |   17 +++++----
 connectivity/source/drivers/postgresql/pq_xindex.hxx |    8 ++--
 connectivity/source/drivers/postgresql/pq_xkey.hxx   |    8 ++--
 connectivity/source/drivers/postgresql/pq_xtable.hxx |    8 ++--
 connectivity/source/drivers/postgresql/pq_xuser.hxx  |    4 +-
 connectivity/source/drivers/postgresql/pq_xview.hxx  |    4 +-
 7 files changed, 36 insertions(+), 46 deletions(-)

New commits:
commit 87a2c1d5a0b2eeed30461fe39328ccb66359cff0
Author: Daniel Robertson <danlrobertson89 at gmail.com>
Date:   Mon Aug 31 17:35:14 2015 -0400

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/connectivity/source/drivers/postgresql/pq_xbase.cxx b/connectivity/source/drivers/postgresql/pq_xbase.cxx
index 7473bc7..bfee078 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 fff7f55..0d4b885 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 eb92ff1..112d41a 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 b3f1879..abc37c3 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 cbef55e..cd9b4f1 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 9358f2b..82b6f41 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 e93d347..dfaadc7 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;


More information about the Libreoffice-commits mailing list