From 440a7c9b92822206db52861dc79d053450004a9f Mon Sep 17 00:00:00 2001 From: August Sodora Date: Sat, 14 Jan 2012 01:48:28 -0500 Subject: SV_DECL_PTRARR_DEL->boost::ptr_vector --- basic/source/sbx/sbxbase.cxx | 29 ++++++++++++----------------- basic/source/sbx/sbxvar.cxx | 19 +++++++++---------- 2 files changed, 21 insertions(+), 27 deletions(-) (limited to 'basic/source/sbx') diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index 9e1baf39f0ef..84dc30725ee6 100644 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -26,8 +26,6 @@ * ************************************************************************/ - - #include #include @@ -41,7 +39,6 @@ // AppData-Structure for SBX: -SV_IMPL_PTRARR(SbxParams,SbxParamInfo*); SV_IMPL_PTRARR(SbxFacs,SbxFactory*); TYPEINIT0(SbxBase) @@ -367,21 +364,20 @@ SbxInfo::~SbxInfo() void SbxInfo::AddParam ( const XubString& rName, SbxDataType eType, sal_uInt16 nFlags ) { - const SbxParamInfo* p = new SbxParamInfo( rName, eType, nFlags ); - aParams.Insert( p, aParams.Count() ); + aParams.push_back(new SbxParamInfo(rName, eType, nFlags)); } const SbxParamInfo* SbxInfo::GetParam( sal_uInt16 n ) const { - if( n < 1 || n > aParams.Count() ) + if( n < 1 || n > aParams.size() ) return NULL; else - return aParams.GetObject( n-1 ); + return &(aParams[n - 1]); } sal_Bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { - aParams.Remove( 0, aParams.Count() ); + aParams.clear(); sal_uInt16 nParam; aComment = read_lenPrefixed_uInt8s_ToOUString(rStrm, RTL_TEXTENCODING_ASCII_US); @@ -399,8 +395,8 @@ sal_Bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer ) if( nVer > 1 ) rStrm >> nUserData; AddParam( aName, (SbxDataType) nType, nFlags ); - SbxParamInfo* p = aParams.GetObject( aParams.Count() - 1 ); - p->nUserData = nUserData; + SbxParamInfo& p(aParams.back()); + p.nUserData = nUserData; } return sal_True; } @@ -411,15 +407,14 @@ sal_Bool SbxInfo::StoreData( SvStream& rStrm ) const RTL_TEXTENCODING_ASCII_US ); write_lenPrefixed_uInt8s_FromOUString(rStrm, aHelpFile, RTL_TEXTENCODING_ASCII_US); - rStrm << nHelpId << aParams.Count(); - for( sal_uInt16 i = 0; i < aParams.Count(); i++ ) + rStrm << nHelpId << static_cast(aParams.size()); + for(SbxParams::const_iterator i = aParams.begin(); i != aParams.end(); ++i) { - SbxParamInfo* p = aParams.GetObject( i ); - write_lenPrefixed_uInt8s_FromOUString(rStrm, p->aName, + write_lenPrefixed_uInt8s_FromOUString(rStrm, i->aName, RTL_TEXTENCODING_ASCII_US); - rStrm << (sal_uInt16) p->eType - << (sal_uInt16) p->nFlags - << (sal_uInt32) p->nUserData; + rStrm << (sal_uInt16) i->eType + << (sal_uInt16) i->nFlags + << (sal_uInt32) i->nUserData; } return sal_True; } diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 386c8d3473c4..e4ad651532df 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -236,7 +236,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const ((SbxVariable*)this)->GetInfo(); // Append nothing, if it is a simple property (no empty brackets) if( !pInfo - || ( !pInfo->aParams.Count() && GetClass() == SbxCLASS_PROPERTY ) ) + || ( pInfo->aParams.empty() && GetClass() == SbxCLASS_PROPERTY ) ) return maName; xub_Unicode cType = ' '; XubString aTmp( maName ); @@ -250,17 +250,16 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const aTmp += cType; } aTmp += '('; - for( sal_uInt16 i = 0; i < pInfo->aParams.Count(); i++ ) + for(SbxParams::const_iterator i = pInfo->aParams.begin(); i != pInfo->aParams.end(); ++i) { - const SbxParamInfo* q = pInfo->aParams.GetObject( i ); - int nt = q->eType & 0x0FFF; - if( i ) + int nt = i->eType & 0x0FFF; + if( i != pInfo->aParams.begin() ) aTmp += ','; - if( q->nFlags & SBX_OPTIONAL ) + if( i->nFlags & SBX_OPTIONAL ) aTmp += String( SbxRes( STRING_OPTIONAL ) ); - if( q->eType & SbxBYREF ) + if( i->eType & SbxBYREF ) aTmp += String( SbxRes( STRING_BYREF ) ); - aTmp += q->aName; + aTmp += i->aName; cType = ' '; // short type? Then fetch it, posible this is 0. if( t == SbxNAME_SHORT_TYPES ) @@ -271,12 +270,12 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const if( cType != ' ' ) { aTmp += cType; - if( q->eType & SbxARRAY ) + if( i->eType & SbxARRAY ) aTmp.AppendAscii( "()" ); } else { - if( q->eType & SbxARRAY ) + if( i->eType & SbxARRAY ) aTmp.AppendAscii( "()" ); // long type? if( t != SbxNAME_SHORT ) -- cgit