diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-05-16 11:12:48 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-06-29 07:25:22 +0000 |
commit | e57314f61f67b093510c5a8a8f34a62126ba8734 (patch) | |
tree | 7991c3a6f20c93b752628528196022474c6b4a7f /dbaccess | |
parent | 371200675c2fb2fef0ac8362ebd7bf4203835440 (diff) |
return and use std::vector from OInterfaceContainerHelper
since most of the time we don’t need a heavyweight uno::Sequence.
Adds a new method getElementsAsVector().
Change-Id: I9e72bef0c0c723ffd0dd7d4152db5baec6784a7a
Reviewed-on: https://gerrit.libreoffice.org/15747
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 13 | ||||
-rw-r--r-- | dbaccess/source/inc/apitools.hxx | 13 |
2 files changed, 6 insertions, 20 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index f1723a96f4fe..8220327af727 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -104,22 +104,15 @@ com_sun_star_comp_dba_ORowSet_get_implementation(css::uno::XComponentContext* co } #define NOTIFY_LISTERNERS_CHECK(_rListeners,T,method) \ - Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \ - \ - const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray(); \ - const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \ + std::vector< Reference< XInterface > > aListenerSeq = _rListeners.getElementsAsVector(); \ \ _rGuard.clear(); \ bool bCheck = true; \ - while( pxInt > pxIntBegin && bCheck ) \ + for( auto iter = aListenerSeq.rbegin(); iter != aListenerSeq.rend() && bCheck; ++iter ) \ { \ try \ { \ - while( pxInt > pxIntBegin && bCheck ) \ - { \ - --pxInt; \ - bCheck = static_cast< T* >( pxInt->get() )->method(aEvt); \ - } \ + bCheck = static_cast< T* >( (*iter).get() )->method(aEvt); \ } \ catch( RuntimeException& ) \ { \ diff --git a/dbaccess/source/inc/apitools.hxx b/dbaccess/source/inc/apitools.hxx index 6672420abac6..583fff3bda82 100644 --- a/dbaccess/source/inc/apitools.hxx +++ b/dbaccess/source/inc/apitools.hxx @@ -328,21 +328,14 @@ public: return new ::cppu::OPropertyArrayHelper(aDescriptor); #define NOTIFY_LISTERNERS(_rListeners,T,method) \ - Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \ - \ - const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray(); \ - const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \ + std::vector< Reference< XInterface > > aListenerSeq = _rListeners.getElementsAsVector(); \ \ _rGuard.clear(); \ - while( pxInt > pxIntBegin ) \ + for( auto iter = aListenerSeq.rbegin(); iter != aListenerSeq.rend(); ++iter ) \ { \ try \ { \ - while( pxInt > pxIntBegin ) \ - { \ - --pxInt; \ - static_cast< T* >( pxInt->get() )->method(aEvt); \ - } \ + static_cast< T* >( (*iter).get() )->method(aEvt); \ } \ catch( RuntimeException& ) \ { \ |