[Libreoffice-commits] .: xmloff/source

Joseph Powers jpowers at kemper.freedesktop.org
Fri Jan 7 20:06:17 PST 2011


 xmloff/source/style/impastp1.cxx |   21 +++++++++++----------
 xmloff/source/style/impastp4.cxx |   21 ++++++++++-----------
 xmloff/source/style/impastpl.hxx |    9 +++++----
 3 files changed, 26 insertions(+), 25 deletions(-)

New commits:
commit ed0151aff248fa609847820d7ef9edd2a5273406
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Fri Jan 7 19:56:15 2011 -0800

    Remove DECLARE_LIST( SvXMLAutoStylePoolCache_Impl, OUStringPtr )

diff --git a/xmloff/source/style/impastp1.cxx b/xmloff/source/style/impastp1.cxx
index 0b72276..20e2464 100644
--- a/xmloff/source/style/impastp1.cxx
+++ b/xmloff/source/style/impastp1.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
@@ -51,7 +51,7 @@ XMLFamilyData_Impl::XMLFamilyData_Impl(
         sal_Bool bAsFam )
     : pCache( 0 ), mnFamily( nFamily ), maStrFamilyName( rStrName), mxMapper( rMapper ),
       mnCount( 0 ), mnName( 0 ), maStrPrefix( rStrPrefix ), bAsFamily( bAsFam )
-      
+
 {
     mpParentList = new SvXMLAutoStylePoolParentsP_Impl( 5, 5 );
     mpNameList   = new SvXMLAutoStylePoolNamesP_Impl( 5, 5 );
@@ -61,12 +61,13 @@ XMLFamilyData_Impl::~XMLFamilyData_Impl()
 {
     if( mpParentList ) delete mpParentList;
     if( mpNameList ) delete mpNameList;
-    DBG_ASSERT( !pCache || !pCache->Count(),
-                "auto style pool cache is not empty!" );
+    DBG_ASSERT( !pCache || !pCache->size(), "auto style pool cache is not empty!" );
     if( pCache )
     {
-        while( pCache->Count() )
-            delete pCache->Remove( 0UL );
+        for ( size_t i = 0, n = pCache->size(); i < n; ++i )
+            delete (*pCache)[ i ];
+        pCache->clear();
+        delete pCache;
     }
 }
 
@@ -75,12 +76,12 @@ void XMLFamilyData_Impl::ClearEntries()
     if( mpParentList )
         delete mpParentList;
     mpParentList = new SvXMLAutoStylePoolParentsP_Impl( 5, 5 );
-    DBG_ASSERT( !pCache || !pCache->Count(),
-                "auto style pool cache is not empty!" );
+    DBG_ASSERT( !pCache || !pCache->size(), "auto style pool cache is not empty!" );
     if( pCache )
     {
-        while( pCache->Count() )
-            delete pCache->Remove( 0UL );
+        for ( size_t i = 0, n = pCache->size(); i < n; ++i )
+            delete (*pCache)[ i ];
+        pCache->clear();
     }
 }
 
diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx
index 0ae9397..9aea30d 100644
--- a/xmloff/source/style/impastp4.cxx
+++ b/xmloff/source/style/impastp4.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
@@ -221,10 +221,9 @@ sal_Bool SvXMLAutoStylePoolP_Impl::Add(OUString& rName, sal_Int32 nFamily,
         if( bCache )
         {
             if( !pFamily->pCache )
-                pFamily->pCache = new SvXMLAutoStylePoolCache_Impl( 256, 256 );
-            if( pFamily->pCache->Count() < MAX_CACHE_SIZE )
-                pFamily->pCache->Insert( new OUString( rName ),
-                                         pFamily->pCache->Count() );
+                pFamily->pCache = new SvXMLAutoStylePoolCache_Impl();
+            if( pFamily->pCache->size() < MAX_CACHE_SIZE )
+                pFamily->pCache->push_back( new OUString( rName ) );
         }
     }
 
@@ -288,10 +287,9 @@ OUString SvXMLAutoStylePoolP_Impl::AddToCache( sal_Int32 nFamily,
     if( pFamily )
     {
         if( !pFamily->pCache )
-            pFamily->pCache = new SvXMLAutoStylePoolCache_Impl( 256, 256 );
-        if( pFamily->pCache->Count() < MAX_CACHE_SIZE )
-            pFamily->pCache->Insert( new OUString( rParent ),
-                                     pFamily->pCache->Count() );
+            pFamily->pCache = new SvXMLAutoStylePoolCache_Impl();
+        if( pFamily->pCache->size() < MAX_CACHE_SIZE )
+            pFamily->pCache->push_back( new OUString( rParent ) );
     }
 
     return rParent;
@@ -350,9 +348,10 @@ OUString SvXMLAutoStylePoolP_Impl::FindAndRemoveCached( sal_Int32 nFamily ) cons
 
         // The cache may be empty already. This happens if it was filled
         // completly.
-        if( pFamily->pCache && pFamily->pCache->Count() )
+        if( pFamily->pCache && !pFamily->pCache->empty() )
         {
-            OUString *pName = pFamily->pCache->Remove( 0UL );
+            OUString *pName = (*pFamily->pCache)[ 0 ];
+            pFamily->pCache->erase( pFamily->pCache->begin() );
             sName = *pName;
             delete pName;
         }
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
index e22bb89..5d391de 100644
--- a/xmloff/source/style/impastpl.hxx
+++ b/xmloff/source/style/impastpl.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
@@ -39,6 +39,7 @@
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <xmloff/maptype.hxx>
 #include <xmloff/xmlexppr.hxx>
+#include <vector>
 
 class SvXMLAutoStylePoolP;
 class SvXMLAutoStylePoolParentsP_Impl;
@@ -54,8 +55,8 @@ class SvXMLExport;
 // Implementationclass for stylefamily-information
 //
 
-typedef ::rtl::OUString *OUStringPtr;
-DECLARE_LIST( SvXMLAutoStylePoolCache_Impl, OUStringPtr )
+typedef ::rtl::OUString* OUStringPtr;
+typedef ::std::vector< OUStringPtr > SvXMLAutoStylePoolCache_Impl;
 
 class XMLFamilyData_Impl
 {
@@ -81,7 +82,7 @@ public:
         pCache( 0 ),
         mnFamily( nFamily ), mpParentList( NULL ),
         mpNameList( NULL ), mnCount( 0 ), mnName( 0 )
-        
+
     {}
     ~XMLFamilyData_Impl();
 


More information about the Libreoffice-commits mailing list