From 25534a62b2ba398c6298c6b9e521f20de1087540 Mon Sep 17 00:00:00 2001 From: Ian Date: Fri, 7 Aug 2015 10:59:28 +0100 Subject: tdf#90222: Removed redundant collection type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed ScaStringList collection and replaced it with std::vector Change-Id: Iba9680454a7a154cc445e2b5c8a436917868b40e Reviewed-on: https://gerrit.libreoffice.org/17573 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- scaddins/source/pricing/pricing.cxx | 14 ++++-------- scaddins/source/pricing/pricing.hxx | 44 +++---------------------------------- 2 files changed, 7 insertions(+), 51 deletions(-) (limited to 'scaddins') diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx index 21174c7fb108..3b83dcf13040 100644 --- a/scaddins/source/pricing/pricing.cxx +++ b/scaddins/source/pricing/pricing.cxx @@ -72,12 +72,6 @@ void ScaList::_Grow() pData = pNewData; } -ScaStringList::~ScaStringList() -{ - for( OUString* pStr = First(); pStr; pStr = Next() ) - delete pStr; -} - ScaResId::ScaResId( sal_uInt16 nId, ResMgr& rResMgr ) : ResId( nId, rResMgr ) { @@ -114,7 +108,7 @@ ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rResMgr ) : const ResStringArray& rArr = aArrLoader.GetStringArray(); for( sal_uInt32 nIndex = 0; nIndex < rArr.Count(); nIndex++ ) - aCompList.Append( rArr.GetString( nIndex ) ); + aCompList.push_back( rArr.GetString( nIndex ) ); } ScaFuncData::~ScaFuncData() @@ -452,14 +446,14 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL ScaPricingAddIn::getCompatibility if( !pFData ) return uno::Sequence< sheet::LocalizedName >( 0 ); - const ScaStringList& rStrList = pFData->GetCompNameList(); - sal_uInt32 nCount = rStrList.Count(); + const std::vector& rStrList = pFData->GetCompNameList(); + sal_uInt32 nCount = rStrList.size(); uno::Sequence< sheet::LocalizedName > aRet( nCount ); sheet::LocalizedName* pArray = aRet.getArray(); for( sal_uInt32 nIndex = 0; nIndex < nCount; nIndex++ ) - pArray[ nIndex ] = sheet::LocalizedName( GetLocale( nIndex ), *rStrList.Get( nIndex ) ); + pArray[ nIndex ] = sheet::LocalizedName( GetLocale( nIndex ), rStrList[nIndex] ); return aRet; } diff --git a/scaddins/source/pricing/pricing.hxx b/scaddins/source/pricing/pricing.hxx index 21a3c4984563..0daf3f8826bb 100644 --- a/scaddins/source/pricing/pricing.hxx +++ b/scaddins/source/pricing/pricing.hxx @@ -29,6 +29,7 @@ #include +#include #include #include #include @@ -90,45 +91,6 @@ inline void ScaList::Append( void* pNew ) } -class ScaStringList : protected ScaList -{ -public: - inline ScaStringList() : ScaList() {}; - virtual ~ScaStringList(); - - using ScaList::Count; - - inline const OUString* Get( sal_uInt32 nIndex ) const; - - inline OUString* First(); - inline OUString* Next(); - - using ScaList::Append; - inline void Append( const OUString& rNew ); -}; - - -inline const OUString* ScaStringList::Get( sal_uInt32 nIndex ) const -{ - return static_cast< const OUString* >( ScaList::GetObject( nIndex ) ); -} - -inline OUString* ScaStringList::First() -{ - return static_cast< OUString* >( ScaList::First() ); -} - -inline OUString* ScaStringList::Next() -{ - return static_cast< OUString* >( ScaList::Next() ); -} - -inline void ScaStringList::Append( const OUString& rNew ) -{ - ScaList::Append( new OUString( rNew ) ); -} - - class ScaResId : public ResId { public: @@ -226,7 +188,7 @@ private: sal_uInt16 nDescrID; // leads also to parameter descriptions! sal_uInt16 nCompListID; // resource ID to list of valid names sal_uInt16 nParamCount; // num of parameters - ScaStringList aCompList; // list of all valid names + std::vector aCompList; // list of all valid names ScaCategory eCat; // function category bool bDouble; // name already exist in Calc bool bWithOpt; // first parameter is internal @@ -244,7 +206,7 @@ public: inline bool Is( const OUString& rCompare ) const { return aIntName == rCompare; } - inline const ScaStringList& GetCompNameList() const { return aCompList; } + inline const std::vector& GetCompNameList() const { return aCompList; } }; -- cgit