diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-07-17 17:44:51 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-07-17 20:26:59 +0200 |
commit | 15f32b5a1ea289159703dd7b118a911c8d0da61d (patch) | |
tree | d75860a270c00a61713fe842aa5a995488749461 | |
parent | ce6466f5736258b41f7aa892bdc1fc1451f6593d (diff) |
basic: replace boost::ptr_vector with std::vector<std::unique_ptr>>
Change-Id: I96ea97c1df7903a28387d8e1171075be55a80ca7
-rw-r--r-- | basic/source/sbx/sbxbase.cxx | 14 | ||||
-rw-r--r-- | basic/source/sbx/sbxvar.cxx | 12 | ||||
-rw-r--r-- | include/basic/sbx.hxx | 6 |
3 files changed, 17 insertions, 15 deletions
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index 00728c6a8120..a1c9149a9c6d 100644 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -328,20 +328,20 @@ SbxInfo::~SbxInfo() void SbxInfo::AddParam(const OUString& rName, SbxDataType eType, SbxFlagBits nFlags) { - aParams.push_back(new SbxParamInfo(rName, eType, nFlags)); + m_Params.push_back(std::unique_ptr<SbxParamInfo>(new SbxParamInfo(rName, eType, nFlags))); } const SbxParamInfo* SbxInfo::GetParam( sal_uInt16 n ) const { - if( n < 1 || n > aParams.size() ) + if (n < 1 || n > m_Params.size()) return NULL; else - return &(aParams[n - 1]); + return m_Params[n - 1].get(); } bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { - aParams.clear(); + m_Params.clear(); sal_uInt16 nParam; aComment = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm, RTL_TEXTENCODING_ASCII_US); @@ -359,7 +359,7 @@ bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer ) if( nVer > 1 ) rStrm.ReadUInt32( nUserData ); AddParam( aName, (SbxDataType) nType, nFlags ); - SbxParamInfo& p(aParams.back()); + SbxParamInfo& p(*m_Params.back()); p.nUserData = nUserData; } return true; @@ -371,8 +371,8 @@ bool SbxInfo::StoreData( SvStream& rStrm ) const RTL_TEXTENCODING_ASCII_US ); write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, aHelpFile, RTL_TEXTENCODING_ASCII_US); - rStrm.WriteUInt32( nHelpId ).WriteUInt16( aParams.size() ); - for(SbxParams::const_iterator i = aParams.begin(); i != aParams.end(); ++i) + rStrm.WriteUInt32( nHelpId ).WriteUInt16( m_Params.size() ); + for (auto const& i : m_Params) { write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, i->aName, RTL_TEXTENCODING_ASCII_US); diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index e01c3d41fa58..2ea23d85d5fb 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -228,7 +228,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const // Request parameter-information (not for objects) const_cast<SbxVariable*>(this)->GetInfo(); // Append nothing, if it is a simple property (no empty brackets) - if( !pInfo || ( pInfo->aParams.empty() && GetClass() == SbxCLASS_PROPERTY )) + if (!pInfo || (pInfo->m_Params.empty() && GetClass() == SbxCLASS_PROPERTY)) { return maName; } @@ -249,10 +249,11 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const } aTmp += "("; - for(SbxParams::const_iterator i = pInfo->aParams.begin(); i != pInfo->aParams.end(); ++i) + for (SbxParams::const_iterator iter = pInfo->m_Params.begin(); iter != pInfo->m_Params.end(); ++iter) { + auto const& i = *iter; int nt = i->eType & 0x0FFF; - if( i != pInfo->aParams.begin() ) + if (iter != pInfo->m_Params.begin()) { aTmp += ","; } @@ -639,11 +640,12 @@ bool SbxVariable::StoreData( SvStream& rStrm ) const ////////////////////////////// SbxInfo -SbxInfo::SbxInfo() : aHelpFile(), nHelpId( 0 ), aParams() +SbxInfo::SbxInfo() + : aHelpFile(), nHelpId(0) {} SbxInfo::SbxInfo( const OUString& r, sal_uInt32 n ) - : aHelpFile( r ), nHelpId( n ), aParams() + : aHelpFile( r ), nHelpId( n ) {} ////////////////////////////// SbxAlias diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx index e6fb750d0348..66c2d09cc883 100644 --- a/include/basic/sbx.hxx +++ b/include/basic/sbx.hxx @@ -31,8 +31,8 @@ #include <basic/sbxmeth.hxx> #include <basic/basicdllapi.h> -#include <boost/ptr_container/ptr_vector.hpp> #include <vector> +#include <memory> class SvStream; class SbxBase; @@ -59,7 +59,7 @@ struct SbxParamInfo ~SbxParamInfo() {} }; -typedef boost::ptr_vector<SbxParamInfo> SbxParams; +typedef std::vector<std::unique_ptr<SbxParamInfo>> SbxParams; class BASIC_DLLPUBLIC SbxInfo : public SvRefBase { @@ -69,7 +69,7 @@ class BASIC_DLLPUBLIC SbxInfo : public SvRefBase OUString aComment; OUString aHelpFile; sal_uInt32 nHelpId; - SbxParams aParams; + SbxParams m_Params; protected: bool LoadData( SvStream&, sal_uInt16 ); |