From 177abf404881b3557ef1cc99ef56cf9b6f90abe4 Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Tue, 1 Feb 2011 07:24:09 -0800 Subject: Remove DECLARE_LIST( FileStringList, String* ) --- sot/inc/filelist.hxx | 22 +++++++++--------- sot/source/base/filelist.cxx | 54 ++++++++++++++------------------------------ 2 files changed, 28 insertions(+), 48 deletions(-) (limited to 'sot') diff --git a/sot/inc/filelist.hxx b/sot/inc/filelist.hxx index bf9aa3e4084d..e4f920437165 100644 --- a/sot/inc/filelist.hxx +++ b/sot/inc/filelist.hxx @@ -32,32 +32,32 @@ #include #include "sot/sotdllapi.h" -class FileStringList; +#include +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,8 +68,8 @@ 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; }; diff --git a/sot/source/base/filelist.cxx b/sot/source/base/filelist.cxx index a35b2ecb80e3..8a2337ea5017 100644 --- a/sot/source/base/filelist.cxx +++ b/sot/source/base/filelist.cxx @@ -29,31 +29,22 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sot.hxx" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include 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; } @@ -147,7 +128,6 @@ SvStream& operator<<( SvStream& rOStm, const FileList& /*rFileList*/ ) SvStream& operator>>( SvStream& rIStm, FileList& rFileList ) { rFileList.ClearAll(); - rFileList.pStrList = new FileStringList(); String aStr; sal_uInt16 c; @@ -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: */ -- cgit