diff options
author | Ian <ian.gilham@gmail.com> | 2015-08-06 16:24:50 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-08-07 07:03:39 +0000 |
commit | 09a9234c021ad98c5adeb493b5814e97b92ee912 (patch) | |
tree | 5a73f74d1e90d5a0a2dfb9e0452397de3da431ce /scaddins | |
parent | 46791546a8aaef40eafc08e6e71b4b0785324564 (diff) |
tdf#90222: Removed ScaStringList and replaced all uses with std::vector
Change-Id: Icd12e4a1557b39fd387173ce261118c27200dd2b
Reviewed-on: https://gerrit.libreoffice.org/17543
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'scaddins')
-rw-r--r-- | scaddins/source/datefunc/datefunc.cxx | 14 | ||||
-rw-r--r-- | scaddins/source/datefunc/datefunc.hxx | 44 |
2 files changed, 7 insertions, 51 deletions
diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx index 64679fffc2fb..f3fe9a874332 100644 --- a/scaddins/source/datefunc/datefunc.cxx +++ b/scaddins/source/datefunc/datefunc.cxx @@ -62,12 +62,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 ) { @@ -109,7 +103,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() @@ -445,14 +439,14 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL ScaDateAddIn::getCompatibilityNam if( !pFData ) return uno::Sequence< sheet::LocalizedName >( 0 ); - const ScaStringList& rStrList = pFData->GetCompNameList(); - sal_uInt32 nCount = rStrList.Count(); + const std::vector<OUString>& 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.at( nIndex ) ); return aRet; } diff --git a/scaddins/source/datefunc/datefunc.hxx b/scaddins/source/datefunc/datefunc.hxx index 9922bdfa1d11..db6e8f19a96e 100644 --- a/scaddins/source/datefunc/datefunc.hxx +++ b/scaddins/source/datefunc/datefunc.hxx @@ -23,6 +23,7 @@ #define INCLUDED_SCADDINS_SOURCE_DATEFUNC_DATEFUNC_HXX #include <string.h> +#include <vector> #include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -78,45 +79,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: @@ -214,7 +176,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<OUString> aCompList; // list of all valid names ScaCategory eCat; // function category bool bDouble; // name already exist in Calc bool bWithOpt; // first parameter is internal @@ -232,7 +194,7 @@ public: inline bool Is( const OUString& rCompare ) const { return aIntName == rCompare; } - inline const ScaStringList& GetCompNameList() const { return aCompList; } + inline const std::vector<OUString>& GetCompNameList() const { return aCompList; } }; |