[Libreoffice-commits] .: sd/source
Joseph Powers
jpowers at kemper.freedesktop.org
Sat Dec 11 21:35:48 PST 2010
sd/source/ui/unoidl/unowcntr.cxx | 67 ++++++++++++++++-----------------------
sd/source/ui/unoidl/unowcntr.hxx | 13 ++++---
2 files changed, 36 insertions(+), 44 deletions(-)
New commits:
commit 1a44b393987af6eb20021535a5d9feb467a48929
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sat Dec 11 21:31:55 2010 -0800
remove DECLARE_LIST( WeakRefList, uno::WeakReference< uno::XInterface >* )
diff --git a/sd/source/ui/unoidl/unowcntr.cxx b/sd/source/ui/unoidl/unowcntr.cxx
index 22aec51..284dcef 100644
--- a/sd/source/ui/unoidl/unowcntr.cxx
+++ b/sd/source/ui/unoidl/unowcntr.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -36,61 +36,56 @@
using namespace ::rtl;
using namespace ::com::sun::star;
-DECLARE_LIST( WeakRefList, uno::WeakReference< uno::XInterface >* )
-
SvUnoWeakContainer::SvUnoWeakContainer() throw()
{
- mpList = new WeakRefList;
}
SvUnoWeakContainer::~SvUnoWeakContainer() throw()
{
- uno::WeakReference< uno::XInterface >* pRef = mpList->First();
- while( pRef )
- {
- delete mpList->Remove();
- pRef = mpList->GetCurObject();
- }
- delete mpList;
+ for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); ++it )
+ delete *it;
+ maList.clear();
}
/** inserts the given ref into this container */
void SvUnoWeakContainer::insert( uno::WeakReference< uno::XInterface > xRef ) throw()
{
- uno::WeakReference< uno::XInterface >* pRef = mpList->First();
- while( pRef )
+ for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xTestRef( *pRef );
- if(! xTestRef.is() )
+ uno::WeakReference< uno::XInterface >* pRef = *it;
+ uno::Reference< uno::XInterface > xTestRef( *pRef );
+ if ( !xTestRef.is() )
{
- delete mpList->Remove();
- pRef = mpList->GetCurObject();
+ delete pRef;
+ it = maList.erase( it );
}
else
{
- if( *pRef == xRef )
+ if ( *pRef == xRef )
return;
-
- pRef = mpList->Next();
+ ++it;
}
}
-
- mpList->Insert( new uno::WeakReference< uno::XInterface >( xRef ) );
+ maList.push_back( new uno::WeakReference< uno::XInterface >( xRef ) );
}
-/** searches the container for a ref that returns true on the given
+/** searches the container for a ref that returns true on the given
search function
*/
-sal_Bool SvUnoWeakContainer::findRef( uno::WeakReference< uno::XInterface >& rRef, void* pSearchData, weakref_searchfunc pSearchFunc )
+sal_Bool SvUnoWeakContainer::findRef(
+ uno::WeakReference< uno::XInterface >& rRef,
+ void* pSearchData,
+ weakref_searchfunc pSearchFunc
+)
{
- uno::WeakReference< uno::XInterface >* pRef = mpList->First();
- while( pRef )
+ for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); )
{
- uno::Reference< ::com::sun::star::uno::XInterface > xTestRef( *pRef );
- if(!xTestRef.is())
+ uno::WeakReference< uno::XInterface >* pRef = *it;
+ uno::Reference< uno::XInterface > xTestRef( *pRef );
+ if ( !xTestRef.is() )
{
- delete mpList->Remove();
- pRef = mpList->GetCurObject();
+ delete pRef;
+ it = maList.erase( it );
}
else
{
@@ -99,28 +94,24 @@ sal_Bool SvUnoWeakContainer::findRef( uno::WeakReference< uno::XInterface >& rRe
rRef = *pRef;
return sal_True;
}
-
- pRef = mpList->Next();
+ ++it;
}
}
-
return sal_False;
}
void SvUnoWeakContainer::dispose()
{
- uno::WeakReference< uno::XInterface >* pRef = mpList->First();
- while( pRef )
+ for ( WeakRefList::iterator it = maList.begin(); it != maList.end(); ++it )
{
+ uno::WeakReference< uno::XInterface >* pRef = *it;
uno::Reference< uno::XInterface > xTestRef( *pRef );
- if(xTestRef.is())
+ if ( xTestRef.is() )
{
uno::Reference< lang::XComponent > xComp( xTestRef, uno::UNO_QUERY );
if( xComp.is() )
xComp->dispose();
}
-
- pRef = mpList->Next();
}
}
diff --git a/sd/source/ui/unoidl/unowcntr.hxx b/sd/source/ui/unoidl/unowcntr.hxx
index f0b5a74..26d1ad4 100644
--- a/sd/source/ui/unoidl/unowcntr.hxx
+++ b/sd/source/ui/unoidl/unowcntr.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -30,27 +30,28 @@
#define _SV_UNOWCNTR_HXX_
#include <cppuhelper/weakref.hxx>
+#include <list>
typedef sal_Bool (*weakref_searchfunc)( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > xRef, void* pSearchData );
-class WeakRefList;
+typedef ::std::list< ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >* > WeakRefList;
class SvUnoWeakContainer
{
private:
- WeakRefList* mpList;
+ WeakRefList maList;
public:
SvUnoWeakContainer() throw();
~SvUnoWeakContainer() throw();
/** inserts the given ref into this container */
- void insert( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > xRef ) throw();
+ void insert( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > xRef ) throw();
- /** searches the container for a ref that returns true on the given
+ /** searches the container for a ref that returns true on the given
search function
*/
- sal_Bool findRef( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >& rRef, void* pSearchData, weakref_searchfunc pSearchFunc );
+ sal_Bool findRef( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >& rRef, void* pSearchData, weakref_searchfunc pSearchFunc );
void dispose();
};
More information about the Libreoffice-commits
mailing list