Kaydet (Commit) 25534a62 authored tarafından Ian's avatar Ian Kaydeden (comit) Caolán McNamara

tdf#90222: Removed redundant collection type

Removed ScaStringList collection and replaced it with
std::vector<OUString>

Change-Id: Iba9680454a7a154cc445e2b5c8a436917868b40e
Reviewed-on: https://gerrit.libreoffice.org/17573Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 0dc79f35
...@@ -72,12 +72,6 @@ void ScaList::_Grow() ...@@ -72,12 +72,6 @@ void ScaList::_Grow()
pData = pNewData; pData = pNewData;
} }
ScaStringList::~ScaStringList()
{
for( OUString* pStr = First(); pStr; pStr = Next() )
delete pStr;
}
ScaResId::ScaResId( sal_uInt16 nId, ResMgr& rResMgr ) : ScaResId::ScaResId( sal_uInt16 nId, ResMgr& rResMgr ) :
ResId( nId, rResMgr ) ResId( nId, rResMgr )
{ {
...@@ -114,7 +108,7 @@ ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rResMgr ) : ...@@ -114,7 +108,7 @@ ScaFuncData::ScaFuncData( const ScaFuncDataBase& rBaseData, ResMgr& rResMgr ) :
const ResStringArray& rArr = aArrLoader.GetStringArray(); const ResStringArray& rArr = aArrLoader.GetStringArray();
for( sal_uInt32 nIndex = 0; nIndex < rArr.Count(); nIndex++ ) for( sal_uInt32 nIndex = 0; nIndex < rArr.Count(); nIndex++ )
aCompList.Append( rArr.GetString( nIndex ) ); aCompList.push_back( rArr.GetString( nIndex ) );
} }
ScaFuncData::~ScaFuncData() ScaFuncData::~ScaFuncData()
...@@ -452,14 +446,14 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL ScaPricingAddIn::getCompatibility ...@@ -452,14 +446,14 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL ScaPricingAddIn::getCompatibility
if( !pFData ) if( !pFData )
return uno::Sequence< sheet::LocalizedName >( 0 ); return uno::Sequence< sheet::LocalizedName >( 0 );
const ScaStringList& rStrList = pFData->GetCompNameList(); const std::vector<OUString>& rStrList = pFData->GetCompNameList();
sal_uInt32 nCount = rStrList.Count(); sal_uInt32 nCount = rStrList.size();
uno::Sequence< sheet::LocalizedName > aRet( nCount ); uno::Sequence< sheet::LocalizedName > aRet( nCount );
sheet::LocalizedName* pArray = aRet.getArray(); sheet::LocalizedName* pArray = aRet.getArray();
for( sal_uInt32 nIndex = 0; nIndex < nCount; nIndex++ ) 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; return aRet;
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <string.h> #include <string.h>
#include <vector>
#include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
...@@ -90,45 +91,6 @@ inline void ScaList::Append( void* pNew ) ...@@ -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 class ScaResId : public ResId
{ {
public: public:
...@@ -226,7 +188,7 @@ private: ...@@ -226,7 +188,7 @@ private:
sal_uInt16 nDescrID; // leads also to parameter descriptions! sal_uInt16 nDescrID; // leads also to parameter descriptions!
sal_uInt16 nCompListID; // resource ID to list of valid names sal_uInt16 nCompListID; // resource ID to list of valid names
sal_uInt16 nParamCount; // num of parameters 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 ScaCategory eCat; // function category
bool bDouble; // name already exist in Calc bool bDouble; // name already exist in Calc
bool bWithOpt; // first parameter is internal bool bWithOpt; // first parameter is internal
...@@ -244,7 +206,7 @@ public: ...@@ -244,7 +206,7 @@ public:
inline bool Is( const OUString& rCompare ) const inline bool Is( const OUString& rCompare ) const
{ return aIntName == rCompare; } { return aIntName == rCompare; }
inline const ScaStringList& GetCompNameList() const { return aCompList; } inline const std::vector<OUString>& GetCompNameList() const { return aCompList; }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment