From faa253ee441f9be75e27980595a4b567e52cb9e0 Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Wed, 26 Jan 2011 07:39:31 -0800 Subject: Remove DECLARE_LIST( SotFactoryList, SotFactory* ) --- sot/inc/sot/factory.hxx | 3 ++- sot/inc/sot/sotdata.hxx | 4 +++- sot/source/base/factory.cxx | 49 ++++++--------------------------------------- 3 files changed, 11 insertions(+), 45 deletions(-) (limited to 'sot') diff --git a/sot/inc/sot/factory.hxx b/sot/inc/sot/factory.hxx index e2b32c6aa65c..d27251987428 100644 --- a/sot/inc/sot/factory.hxx +++ b/sot/inc/sot/factory.hxx @@ -32,13 +32,14 @@ #include #include #include "sot/sotdllapi.h" +#include /************************************************************************* *************************************************************************/ class SotObject; class SotFactory; -DECLARE_LIST( SotFactoryList, SotFactory * ) +typedef ::std::vector< SotFactory* > SotFactoryList; typedef void * (*CreateInstanceType)( SotObject ** ); //==================class SotFactory======================================= diff --git a/sot/inc/sot/sotdata.hxx b/sot/inc/sot/sotdata.hxx index 7bf2e0eec1e3..73c1b1010cb2 100644 --- a/sot/inc/sot/sotdata.hxx +++ b/sot/inc/sot/sotdata.hxx @@ -34,14 +34,16 @@ #include #include "sot/sotdllapi.h" +#include //==================class SotData_Impl==================================== class List; class SotFactory; -class SotFactoryList; class SotObjectList; +typedef ::std::vector< SotFactory* > SotFactoryList; + struct SotData_Impl { UINT32 nSvObjCount; diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx index f80c55b6e4bb..d327bf077096 100644 --- a/sot/source/base/factory.cxx +++ b/sot/source/base/factory.cxx @@ -83,29 +83,6 @@ void SotFactory::DeInit() ByteString aStr( "Objects alive: " ); aStr.Append( ByteString::CreateFromInt32( pSotData->nSvObjCount ) ); DBG_WARNING( aStr.GetBuffer() ); - -/* - SotObjectList *pObjList = pSotData->pObjectList; - - if( pObjList ) - { - SotObject * p = pObjList->First(); - while( p ) - { - String aStr( "Factory: " ); - aStr += p->GetSvFactory()->GetClassName(); - aStr += " Count: "; - aStr += p->GetRefCount(); - DBG_TRACE( "\tReferences:" ); - p->TestObjRef( FALSE ); -#ifdef TEST_INVARIANT - DBG_TRACE( "\tInvariant:" ); - p->TestInvariant( TRUE ); -#endif - p = pObjList->Next(); - } - } -*/ #endif return; } @@ -115,12 +92,9 @@ void SotFactory::DeInit() SotFactoryList* pFactoryList = pSotData->pFactoryList; if( pFactoryList ) { - SotFactory * pFact = pFactoryList->Last(); - while( NULL != (pFact = pFactoryList->Remove()) ) - { - delete pFact; - pFact = pFactoryList->Last(); - } + for ( size_t i = pFactoryList->size(); i > 0 ; ) + delete (*pFactoryList)[ --i ]; + pFactoryList->clear(); delete pFactoryList; pSotData->pFactoryList = NULL; } @@ -135,8 +109,6 @@ void SotFactory::DeInit() delete pSotData->pDataFlavorList; pSotData->pDataFlavorList = NULL; } - //delete pSOTDATA(); - //SOTDATA() = NULL; } @@ -164,13 +136,6 @@ SotFactory::SotFactory( const SvGlobalName & rName, DBG_ASSERT( aEmptyName != *this, "create factory without SvGlobalName" ); if( Find( *this ) ) { - /* - String aStr( GetClassName() ); - aStr += ", UniqueName: "; - aStr += GetHexName(); - aStr += ", create factories with the same unique name"; - DBG_ERROR( aStr ); - */ DBG_ERROR( "create factories with the same unique name" ); } } @@ -179,7 +144,7 @@ SotFactory::SotFactory( const SvGlobalName & rName, if( !pSotData->pFactoryList ) pSotData->pFactoryList = new SotFactoryList(); // muss nach hinten, wegen Reihenfolge beim zerstoeren - pSotData->pFactoryList->Insert( this, LIST_APPEND ); + pSotData->pFactoryList->push_back( this ); } @@ -217,12 +182,10 @@ const SotFactory* SotFactory::Find( const SvGlobalName & rFactName ) SotData_Impl * pSotData = SOTDATA(); if( rFactName != aEmpty && pSotData->pFactoryList ) { - SotFactory * pFact = pSotData->pFactoryList->First(); - while( pFact ) - { + for ( size_t i = 0, n = pSotData->pFactoryList->size(); i < n; ++i ) { + SotFactory* pFact = (*pSotData->pFactoryList)[ i ]; if( *pFact == rFactName ) return pFact; - pFact = pSotData->pFactoryList->Next(); } } -- cgit v1.2.3