Kaydet (Commit) 3ca4d116 authored tarafından Julien Nabet's avatar Julien Nabet

Replace list by vector for weakRef (sd)

Change-Id: I4c303b402e4b4d7e27cd42acf88dda90f0c8b119
Reviewed-on: https://gerrit.libreoffice.org/44643Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 582182ad
......@@ -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() )
{
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment