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

Joseph Powers jpowers at kemper.freedesktop.org
Tue Feb 1 07:24:38 PST 2011


 sot/inc/filelist.hxx         |   28 ++++++++---------
 sot/source/base/filelist.cxx |   70 +++++++++++++++----------------------------
 2 files changed, 39 insertions(+), 59 deletions(-)

New commits:
commit e3e3b8d6b0b2a6c89cdfa8c1fe26f722d108d375
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Tue Feb 1 07:24:09 2011 -0800

    Remove DECLARE_LIST( FileStringList, String* )

diff --git a/sot/inc/filelist.hxx b/sot/inc/filelist.hxx
index 0bfdbfa..3512589 100644
--- a/sot/inc/filelist.hxx
+++ b/sot/inc/filelist.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,32 +32,32 @@
 #include <tools/stream.hxx>
 #include "sot/sotdllapi.h"
 
-class FileStringList;
+#include <vector>
+typedef ::std::vector< String* > FileStringList;
 
 class SOT_DLLPUBLIC FileList : public SvDataCopyStream
 {
-    FileStringList*		pStrList;
+    FileStringList  aStrList;
 
 protected:
 
     // SvData-Methoden
-    virtual	void		Load( SvStream& );
-    virtual	void		Save( SvStream& );
-    virtual	void		Assign( const SvDataCopyStream& );
+    virtual	void    Load( SvStream& );
+    virtual	void    Save( SvStream& );
+    virtual	void    Assign( const SvDataCopyStream& );
 
     // Liste loeschen;
-    void ClearAll( void );
+    void            ClearAll( void );
 
 public:
-        
+
     TYPEINFO();
-                        FileList();
-                        ~FileList();
+    FileList() {};
+    ~FileList();
 
     // Zuweisungsoperator
     FileList&			operator=( const FileList& rFileList );
 
-
     // Im-/Export
     SOT_DLLPUBLIC friend SvStream&	operator<<( SvStream& rOStm, const FileList& rFileList );
     SOT_DLLPUBLIC friend SvStream&	operator>>( SvStream& rIStm, FileList& rFileList );
@@ -68,10 +68,10 @@ public:
 
     // Liste fuellen/abfragen
     void AppendFile( const String& rStr );
-    String GetFile( ULONG i ) const;
-    ULONG Count( void ) const;
+    String GetFile( size_t i ) const;
+    size_t Count( void ) const;
 
-};	
+};
 
 #endif // _FILELIST_HXX
 
diff --git a/sot/source/base/filelist.cxx b/sot/source/base/filelist.cxx
index 593158e..b1691e5 100644
--- a/sot/source/base/filelist.cxx
+++ b/sot/source/base/filelist.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
@@ -29,31 +29,22 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sot.hxx"
 
-#include<tools/list.hxx>
-#include<tools/stream.hxx>
-#include<tools/string.hxx>
-#include<tools/rtti.hxx>
-#include<sot/exchange.hxx>
-#include<filelist.hxx>
+#include <tools/list.hxx>
+#include <tools/stream.hxx>
+#include <tools/string.hxx>
+#include <tools/rtti.hxx>
+#include <sot/exchange.hxx>
+#include <filelist.hxx>
 #include <osl/thread.h>
 
 TYPEINIT1_AUTOFACTORY( FileList, SvDataCopyStream );
 
-// String-Liste zum Speichern der Namen deklarieren
-DECLARE_LIST( FileStringList, String* )
-
-
 /*************************************************************************
 |*
 |*    FileList - Ctor/Dtor
 |*
 \*************************************************************************/
 
-FileList::FileList()
-{
-    pStrList = new FileStringList();
-}
-
 FileList::~FileList()
 {
     ClearAll();
@@ -61,13 +52,9 @@ FileList::~FileList()
 
 void FileList::ClearAll( void )
 {
-    // Strings in der Liste loeschen
-    ULONG nCount = pStrList->Count();
-    for( ULONG i = 0 ; i < nCount ; i++ )
-        delete pStrList->GetObject( i );
-
-    // Liste loeschen
-    delete pStrList;
+    for ( size_t i = 0, n = aStrList.size(); i < n; ++i )
+        delete aStrList[ i ];
+    aStrList.clear();
 }
 
 /*************************************************************************
@@ -78,14 +65,8 @@ void FileList::ClearAll( void )
 
 FileList& FileList::operator=( const FileList& rFileList )
 {
-    // Liste duplizieren
-    *pStrList = *rFileList.pStrList;
-
-    // Strings in der Liste kopieren
-    ULONG nCount = pStrList->Count();
-    for( ULONG i = 0 ; i < nCount ; i++ )
-        pStrList->Replace( new String( *rFileList.pStrList->GetObject( i ) ), i );
-
+    for ( size_t i = 0, n = rFileList.aStrList.size(); i < n; ++i )
+        aStrList.push_back( new String( *rFileList.aStrList[ i ] ) );
     return *this;
 }
 
@@ -134,24 +115,23 @@ void FileList::Assign( const SvDataCopyStream& rCopyStream )
 
 SvStream& operator<<( SvStream& rOStm, const FileList& /*rFileList*/ )
 {
-    OSL_ENSURE(false, "Not implemented!");    	    
+    OSL_ENSURE(false, "Not implemented!");
     return rOStm;
 }
 
-/* #i28176# 
+/* #i28176#
    The Windows clipboard bridge now provides a double '\0'
-   terminated list of file names for format SOT_FORMAT_FILE_LIST 
+   terminated list of file names for format SOT_FORMAT_FILE_LIST
    instead of the original Windows Sv_DROPFILES structure. All strings
-   in this list are UTF16 strings. Shell link files will be already 
+   in this list are UTF16 strings. Shell link files will be already
    resolved by the Windows clipboard bridge.*/
 SvStream& operator>>( SvStream& rIStm, FileList& rFileList )
 {
     rFileList.ClearAll();
-    rFileList.pStrList = new FileStringList();
-    
+
     String aStr;
     sal_uInt16 c;
-    
+
     while (!rIStm.IsEof())
     {
         aStr.Erase();
@@ -170,7 +150,7 @@ SvStream& operator>>( SvStream& rIStm, FileList& rFileList )
 
         // append the filepath
         rFileList.AppendFile(aStr);
-    }    						
+    }
     return rIStm;
 }
 
@@ -182,20 +162,20 @@ SvStream& operator>>( SvStream& rIStm, FileList& rFileList )
 
 void FileList::AppendFile( const String& rStr )
 {
-    pStrList->Insert( new String( rStr ) , pStrList->Count() );
+    aStrList.push_back( new String( rStr ) );
 }
 
-String FileList::GetFile( ULONG i ) const
+String FileList::GetFile( size_t i ) const
 {
     String aStr;
-    if( i < pStrList->Count() )
-        aStr = *pStrList->GetObject( i );
+    if( i < aStrList.size() )
+        aStr = *aStrList[ i ];
     return aStr;
 }
 
-ULONG FileList::Count( void ) const
+size_t FileList::Count( void ) const
 {
-    return pStrList->Count();
+    return aStrList.size();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list