From 03fb9403784a137800c5c1a45c4e85eeb2eab62f Mon Sep 17 00:00:00 2001 From: Rafael Dominguez Date: Sun, 27 Feb 2011 21:41:54 -0800 Subject: [PATCH] Remove deprecated container List and update required headers. --- tools/inc/tools/globname.hxx | 7 ++++--- tools/source/ref/globname.cxx | 25 +++++++++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'tools') diff --git a/tools/inc/tools/globname.hxx b/tools/inc/tools/globname.hxx index 97fbce56b7d0..cbca2169b518 100644 --- a/tools/inc/tools/globname.hxx +++ b/tools/inc/tools/globname.hxx @@ -28,10 +28,11 @@ #ifndef _GLOBNAME_HXX #define _GLOBNAME_HXX +#include + #include "tools/toolsdllapi.h" #include #include -#include /************************************************************************* *************************************************************************/ @@ -120,7 +121,7 @@ public: class SvGlobalNameList { - List aList; + std::vector aList; public: SvGlobalNameList(); ~SvGlobalNameList(); @@ -128,7 +129,7 @@ public: void Append( const SvGlobalName & ); SvGlobalName GetObject( ULONG ); BOOL IsEntry( const SvGlobalName & rName ); - ULONG Count() const { return aList.Count(); } + ULONG Count() const { return aList.size(); } private: // nicht erlaubt SvGlobalNameList( const SvGlobalNameList & ); diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index 82db356dc130..c220fbe1af92 100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -409,7 +409,6 @@ String SvGlobalName::GetHexName() const |* SvGlobalNameList::SvGlobalNameList() *************************************************************************/ SvGlobalNameList::SvGlobalNameList() - : aList( 1, 1 ) { } @@ -418,10 +417,14 @@ SvGlobalNameList::SvGlobalNameList() *************************************************************************/ SvGlobalNameList::~SvGlobalNameList() { - for( ULONG i = Count(); i > 0; i-- ) + ImpSvGlobalName *pImp = 0; + std::vector::iterator piter; + + for (piter = aList.begin(); piter != aList.end(); ++piter) { - ImpSvGlobalName * pImp = (ImpSvGlobalName *)aList.GetObject( i -1 ); - pImp->nRefCount--; + pImp = *piter; + + --pImp->nRefCount; if( !pImp->nRefCount ) delete pImp; } @@ -433,7 +436,7 @@ SvGlobalNameList::~SvGlobalNameList() void SvGlobalNameList::Append( const SvGlobalName & rName ) { rName.pImp->nRefCount++; - aList.Insert( rName.pImp, LIST_APPEND ); + aList.push_back(rName.pImp); } /************************************************************************* @@ -441,7 +444,7 @@ void SvGlobalNameList::Append( const SvGlobalName & rName ) *************************************************************************/ SvGlobalName SvGlobalNameList::GetObject( ULONG nPos ) { - return SvGlobalName( (ImpSvGlobalName *)aList.GetObject( nPos ) ); + return SvGlobalName(nPos < aList.size() ? aList[nPos] : NULL); } /************************************************************************* @@ -449,12 +452,14 @@ SvGlobalName SvGlobalNameList::GetObject( ULONG nPos ) *************************************************************************/ BOOL SvGlobalNameList::IsEntry( const SvGlobalName & rName ) { - for( ULONG i = Count(); i > 0; i-- ) + std::vector::iterator piter; + for (piter = aList.begin(); piter != aList.end(); ++piter) { - if( *rName.pImp == *(ImpSvGlobalName *)aList.GetObject( i -1 ) ) - return TRUE; + if (*rName.pImp == *(*piter)) + return true; } - return FALSE; + + return false; } com::sun::star::uno::Sequence < sal_Int8 > SvGlobalName::GetByteSequence() const -- cgit