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

Joseph Powers jpowers at kemper.freedesktop.org
Sun Feb 27 22:47:24 PST 2011


 sot/source/base/exchange.cxx  |    1 +
 tools/inc/tools/globname.hxx  |    7 ++++---
 tools/source/ref/globname.cxx |   25 +++++++++++++++----------
 3 files changed, 20 insertions(+), 13 deletions(-)

New commits:
commit b36cc82d4ab11af687d87b890d010b6c05671ff4
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sun Feb 27 21:41:54 2011 -0800

    [PATCH] Remove deprecated container List and update required headers.

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 2af7255..6654588 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -33,6 +33,7 @@
 #define _SOT_FORMATS_INCLUDE_SYSTEMFORMATS
 #include <tools/debug.hxx>
 #include <tools/solar.h>
+#include <tools/list.hxx>
 #include <tools/globname.hxx>
 #include <tools/string.hxx>
 #include <sot/sotdata.hxx>
diff --git a/tools/inc/tools/globname.hxx b/tools/inc/tools/globname.hxx
index 97fbce5..cbca216 100644
--- a/tools/inc/tools/globname.hxx
+++ b/tools/inc/tools/globname.hxx
@@ -28,10 +28,11 @@
 #ifndef _GLOBNAME_HXX
 #define _GLOBNAME_HXX
 
+#include <vector>
+
 #include "tools/toolsdllapi.h"
 #include <com/sun/star/uno/Sequence.hxx>
 #include <tools/string.hxx>
-#include <tools/list.hxx>
 
 /*************************************************************************
 *************************************************************************/
@@ -120,7 +121,7 @@ public:
 
 class SvGlobalNameList
 {
-    List aList;
+    std::vector<ImpSvGlobalName*> 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 7a7f5c5..7f5d3c8 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<ImpSvGlobalName*>::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<ImpSvGlobalName*>::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


More information about the Libreoffice-commits mailing list