basic/source/comp/symtbl.cxx |   32 ++++++++++++++------------------
 basic/source/inc/symtbl.hxx  |   14 +++++++-------
 2 files changed, 21 insertions(+), 25 deletions(-)

New commits:
commit ee3ad385fb3ca476e57e80d7b77c1e184e52e1d8
Author: August Sodora <aug...@gmail.com>
Date:   Sun Nov 20 23:44:21 2011 -0500

    Convert to boost::ptr_vector

diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 4e6e932..22b31ea 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -34,7 +34,6 @@
 #include <string.h>
 #include <ctype.h>
 
-SV_IMPL_PTRARR(SbiStrings,String*)
 SV_IMPL_PTRARR(SbiSymbols,SbiSymDef*)
 
 // All symbol names are laid down int the symbol-pool's stringpool, so that
@@ -57,30 +56,27 @@ SbiStringPool::SbiStringPool( SbiParser* p )
 SbiStringPool::~SbiStringPool()
 {}
 
-
-const String& SbiStringPool::Find( sal_uInt16 n ) const
+const rtl::OUString& SbiStringPool::Find( sal_uInt32 n ) const
 {
-    if( !n || n > aData.Count() )
-        return aEmpty;
+    if( n == 0 || n > aData.size() )
+        return aEmpty; //hack, returning a reference to a simulation of null
     else
-        return *aData.GetObject( n-1 );
+        return aData[n - 1];
 }
 
-
-
-short SbiStringPool::Add( const String& rVal, sal_Bool bNoCase )
+short SbiStringPool::Add( const rtl::OUString& rVal, sal_Bool bNoCase )
 {
-    sal_uInt16 n = aData.Count();
-    for( sal_uInt16 i = 0; i < n; i++ )
+    sal_uInt32 n = aData.size();
+    for( sal_uInt32 i = 0; i < n; ++i )
     {
-        String* p = aData.GetObject( i );
-        if( (  bNoCase && p->Equals( rVal ) )
-         || ( !bNoCase && p->EqualsIgnoreCaseAscii( rVal ) ) )
+        rtl::OUString& p = aData[i];
+        if( (  bNoCase && p == rVal )
+            || ( !bNoCase && p.equalsIgnoreAsciiCase( rVal ) ) )
             return i+1;
     }
-    const String* pNew = new String( rVal );
-    aData.Insert( pNew, n++ );
-    return (short) n;
+
+    aData.push_back(new rtl::OUString(rVal));
+    return (short) ++n;
 }
 
 short SbiStringPool::Add( double n, SbxDataType t )
@@ -94,7 +90,7 @@ short SbiStringPool::Add( double n, SbxDataType t )
         case SbxDOUBLE:  snprintf( buf, sizeof(buf), "%.16g", n ); break;
         default: break;
     }
-    return Add( String::CreateFromAscii( buf ) );
+    return Add( rtl::OUString::createFromAscii( buf ) );
 }
 
 /***************************************************************************
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index 8e4540e..33da527 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -29,6 +29,8 @@
 #ifndef _SYMTBL_HXX
 #define _SYMTBL_HXX
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
 class SbiConstDef;
 class SbiParser;
 class SbiProcDef;
@@ -40,21 +42,19 @@ enum SbiSymScope { SbLOCAL, SbPARAM, SbPUBLIC, SbGLOBAL, 
SbRTL };
 // The string-pool collects string entries and
 // makes sure that they don't exist twice.
 
-SV_DECL_PTRARR_DEL(SbiStrings,String*,5,5)
-
 class SbiStringPool {
-    SbiStrings aData;
-    String     aEmpty;              // for convenience
+    const rtl::OUString aEmpty;
+    boost::ptr_vector<rtl::OUString> aData;
     SbiParser* pParser;
 public:
     SbiStringPool( SbiParser* );
    ~SbiStringPool();
-    sal_uInt16 GetSize() const { return aData.Count(); }
+    sal_uInt32 GetSize() const { return aData.size(); }
     // From 8.4.1999: default changed to sal_True because of #64236 -
     // change it back to sal_False when the bug is cleanly removed.
-    short Add( const String&, sal_Bool=sal_True );
+    short Add( const rtl::OUString&, sal_Bool=sal_True );
     short Add( double, SbxDataType );
-    const String& Find( sal_uInt16 ) const;
+    const rtl::OUString& Find( sal_uInt32 ) const;
     SbiParser* GetParser() { return pParser; }
 };
 
_______________________________________________
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to