diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-11-11 21:22:01 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2017-11-12 08:55:20 +0100 |
commit | 3ca4d1169c1b6d35eecc980251d6d89ff120ee70 (patch) | |
tree | 28eecaa65bf54395479c747c57381a45dfab4813 /sd | |
parent | 582182ad2ad9c399fd41bff2446507eb954730f7 (diff) |
Replace list by vector for weakRef (sd)
Change-Id: I4c303b402e4b4d7e27cd42acf88dda90f0c8b119
Reviewed-on: https://gerrit.libreoffice.org/44643
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/unoidl/unowcntr.cxx | 20 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unowcntr.hxx | 6 |
2 files changed, 12 insertions, 14 deletions
diff --git a/sd/source/ui/unoidl/unowcntr.cxx b/sd/source/ui/unoidl/unowcntr.cxx index d71f7cb01c86..bb1687b07362 100644 --- a/sd/source/ui/unoidl/unowcntr.cxx +++ b/sd/source/ui/unoidl/unowcntr.cxx @@ -29,22 +29,22 @@ SvUnoWeakContainer::SvUnoWeakContainer() throw() SvUnoWeakContainer::~SvUnoWeakContainer() throw() { - for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); ++it ) - delete *it; - maList.clear(); + for (auto const& elem : maVector) + delete elem; + maVector.clear(); } /** inserts the given ref into this container */ void SvUnoWeakContainer::insert( const uno::WeakReference< uno::XInterface >& xRef ) throw() { - for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); ) + for ( auto it = maVector.begin(); it != maVector.end(); ) { uno::WeakReference< uno::XInterface >* pRef = *it; uno::Reference< uno::XInterface > xTestRef( *pRef ); if ( !xTestRef.is() ) { delete pRef; - it = maList.erase( it ); + it = maVector.erase( it ); } else { @@ -53,7 +53,7 @@ void SvUnoWeakContainer::insert( const uno::WeakReference< uno::XInterface >& xR ++it; } } - maList.push_back( new uno::WeakReference< uno::XInterface >( xRef ) ); + maVector.push_back( new uno::WeakReference< uno::XInterface >( xRef ) ); } /** searches the container for a ref that returns true on the given @@ -65,14 +65,14 @@ bool SvUnoWeakContainer::findRef( weakref_searchfunc pSearchFunc ) { - for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); ) + for ( auto it = maVector.begin(); it != maVector.end(); ) { uno::WeakReference< uno::XInterface >* pRef = *it; uno::Reference< uno::XInterface > xTestRef( *pRef ); if ( !xTestRef.is() ) { delete pRef; - it = maList.erase( it ); + it = maVector.erase( it ); } else { @@ -89,9 +89,9 @@ bool SvUnoWeakContainer::findRef( void SvUnoWeakContainer::dispose() { - for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); ++it ) + for (auto const& elem : maVector) { - uno::WeakReference< uno::XInterface >* pRef = *it; + uno::WeakReference< uno::XInterface >* pRef = elem; uno::Reference< uno::XInterface > xTestRef( *pRef ); if ( xTestRef.is() ) { diff --git a/sd/source/ui/unoidl/unowcntr.hxx b/sd/source/ui/unoidl/unowcntr.hxx index 15cca90bda85..787c81d3c3b3 100644 --- a/sd/source/ui/unoidl/unowcntr.hxx +++ b/sd/source/ui/unoidl/unowcntr.hxx @@ -21,16 +21,14 @@ #define INCLUDED_SD_SOURCE_UI_UNOIDL_UNOWCNTR_HXX #include <cppuhelper/weakref.hxx> -#include <list> +#include <vector> typedef bool (*weakref_searchfunc)( const css::uno::WeakReference< css::uno::XInterface >& xRef, void const * pSearchData ); -typedef ::std::list< css::uno::WeakReference< css::uno::XInterface >* > WeakRefList; - class SvUnoWeakContainer { private: - WeakRefList maList; + std::vector< css::uno::WeakReference< css::uno::XInterface >* > maVector; public: SvUnoWeakContainer() throw(); |