From 8e694ee17f8d84ac32151b56e4f5aa4663c8c067 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 10 Jan 2014 10:29:24 +0200 Subject: convert custom list implementation to regular std::vector Change-Id: I6749307d5b72ddc69581b4aa685091383117073d Reviewed-on: https://gerrit.libreoffice.org/7369 Reviewed-by: Michael Stahl Tested-by: Michael Stahl --- scaddins/source/analysis/analysis.cxx | 6 +-- scaddins/source/analysis/analysishelper.cxx | 13 ++----- scaddins/source/analysis/analysishelper.hxx | 60 ++--------------------------- 3 files changed, 10 insertions(+), 69 deletions(-) (limited to 'scaddins') diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index 467b603900ad..bec4960e32be 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -478,8 +478,8 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL AnalysisAddIn::getCompatibilityNa if( !p ) return uno::Sequence< sheet::LocalizedName >( 0 ); - const StringList& r = p->GetCompNameList(); - sal_uInt32 nCount = r.Count(); + const std::vector& r = p->GetCompNameList(); + sal_uInt32 nCount = r.size(); uno::Sequence< sheet::LocalizedName > aRet( nCount ); @@ -487,7 +487,7 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL AnalysisAddIn::getCompatibilityNa for( sal_uInt32 n = 0 ; n < nCount ; n++ ) { - pArray[ n ] = sheet::LocalizedName( GetLocale( n ), *r.Get( n ) ); + pArray[ n ] = sheet::LocalizedName( GetLocale( n ), r[n] ); } return aRet; diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index 33c035fa78b6..11c4eb57bced 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -1441,13 +1441,6 @@ void MyList::Insert( void* p, sal_uInt32 n ) -StringList::~StringList() -{ - for( OUString* p = ( OUString* ) First() ; p ; p = ( OUString* ) Next() ) - delete p; -} - - class AnalysisRscStrArrLoader : public Resource { private: @@ -1480,10 +1473,10 @@ FuncData::FuncData( const FuncDataBase& r, ResMgr& rResMgr ) : const ResStringArray& rArr = aArrLoader.GetStringArray(); sal_uInt16 nCount = sal::static_int_cast( rArr.Count() ); - sal_uInt16 n; - for( n = 0 ; n < nCount ; n++ ) - aCompList.Append( rArr.GetString( n ) ); + aCompList.resize( nCount ); + for( sal_uInt16 n = 0 ; n < nCount ; n++ ) + aCompList[n] = rArr.GetString( n ); } diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx index 66a25a525e79..df561548c05e 100644 --- a/scaddins/source/analysis/analysishelper.hxx +++ b/scaddins/source/analysis/analysishelper.hxx @@ -177,27 +177,6 @@ public: }; - - -class StringList : protected MyList -{ -public: - virtual ~StringList(); - - inline const OUString* First( void ); - inline const OUString* Next( void ); - inline const OUString* Get( sal_uInt32 nIndex ) const; - - using MyList::Append; - inline void Append( OUString* pNew ); - inline void Append( const OUString& rNew ); - - using MyList::Count; -}; - - - - enum FDCategory { FDCat_AddIn, @@ -235,7 +214,7 @@ private: sal_uInt16 nParam; // num of parameters sal_uInt16 nCompID; - StringList aCompList; // list of all valid names + std::vector aCompList; // list of all valid names FDCategory eCat; // function category public: FuncData( const FuncDataBase& rBaseData, ResMgr& ); @@ -249,7 +228,8 @@ public: sal_uInt16 GetStrIndex( sal_uInt16 nParamNum ) const; inline sal_Bool Is( const OUString& rCompareTo ) const; - inline const StringList& GetCompNameList( void ) const; + inline const std::vector & + GetCompNameList( void ) const; inline FDCategory GetCategory( void ) const; }; @@ -700,38 +680,6 @@ inline sal_uInt32 MyList::Count( void ) const -inline const OUString* StringList::First( void ) -{ - return ( const OUString* ) MyList::First(); -} - - -inline const OUString* StringList::Next( void ) -{ - return ( const OUString* ) MyList::Next(); -} - - -inline const OUString* StringList::Get( sal_uInt32 n ) const -{ - return ( const OUString* ) MyList::GetObject( n ); -} - - -inline void StringList::Append( OUString* p ) -{ - MyList::Append( p ); -} - - -inline void StringList::Append( const OUString& r ) -{ - MyList::Append( new OUString( r ) ); -} - - - - inline sal_uInt16 FuncData::GetUINameID( void ) const { return nUINameID; @@ -762,7 +710,7 @@ inline sal_Bool FuncData::Is( const OUString& r ) const } -inline const StringList& FuncData::GetCompNameList( void ) const +inline const std::vector & FuncData::GetCompNameList( void ) const { return aCompList; } -- cgit