[Libreoffice-commits] .: sot/inc sot/source

Joseph Powers jpowers at kemper.freedesktop.org
Wed Jan 26 07:39:40 PST 2011


 sot/inc/sot/factory.hxx     |    5 ++--
 sot/inc/sot/sotdata.hxx     |    6 +++--
 sot/source/base/factory.cxx |   51 ++++++--------------------------------------
 3 files changed, 14 insertions(+), 48 deletions(-)

New commits:
commit 55186f8fecd1b8e0a10adca0b9f720e1e3c3d3f6
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Wed Jan 26 07:39:31 2011 -0800

    Remove DECLARE_LIST( SotFactoryList, SotFactory* )

diff --git a/sot/inc/sot/factory.hxx b/sot/inc/sot/factory.hxx
index b216c9d..3ba6e21 100644
--- a/sot/inc/sot/factory.hxx
+++ b/sot/inc/sot/factory.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
@@ -32,13 +32,14 @@
 #include <tools/globname.hxx>
 #include <tools/rtti.hxx>
 #include "sot/sotdllapi.h"
+#include <vector>
 
 /*************************************************************************
 *************************************************************************/
 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 18a0018..b0a0b6b 100644
--- a/sot/inc/sot/sotdata.hxx
+++ b/sot/inc/sot/sotdata.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
@@ -34,14 +34,16 @@
 
 #include <tools/solar.h>
 #include "sot/sotdllapi.h"
+#include <vector>
 
 //==================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 c3462d7..d327bf0 100644
--- a/sot/source/base/factory.cxx
+++ b/sot/source/base/factory.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
@@ -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();
         }
     }
 


More information about the Libreoffice-commits mailing list