From fffc9b2f262a54a163ff43ceb769c95fa41344ff Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Thu, 17 Jul 2014 14:19:37 +0900 Subject: fdo#75757: remove inheritance to std::vector ... which was introduced at 2110397670695991b3a5cd28a15ba0ffd2a3a611. Change-Id: If0f634b29e1891574267edf8cc07b24d07a9406c Reviewed-on: https://gerrit.libreoffice.org/10363 Reviewed-by: Markus Mohrhard Tested-by: Markus Mohrhard --- basic/source/comp/symtbl.cxx | 41 ++++++++++++++++------------------------- basic/source/inc/symtbl.hxx | 13 +++++-------- 2 files changed, 21 insertions(+), 33 deletions(-) (limited to 'basic') diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx index b47583e4f1cc..a8ae8b4dd2c2 100644 --- a/basic/source/comp/symtbl.cxx +++ b/basic/source/comp/symtbl.cxx @@ -110,7 +110,7 @@ SbiSymDef* SbiSymPool::Next() if( ++nCur >= aData.size() ) return NULL; else - return aData[ nCur ]; + return &aData[ nCur ]; } @@ -177,16 +177,16 @@ void SbiSymPool::Add( SbiSymDef* pDef ) } -SbiSymDef* SbiSymPool::Find( const OUString& rName ) const +SbiSymDef* SbiSymPool::Find( const OUString& rName ) { sal_uInt16 nCount = aData.size(); for( sal_uInt16 i = 0; i < nCount; i++ ) { - SbiSymDef* p = aData[ nCount - i - 1 ]; - if( ( !p->nProcId || ( p->nProcId == nProcId)) && - ( p->aName.equalsIgnoreAsciiCase(rName))) + SbiSymDef &r = aData[ nCount - i - 1 ]; + if( ( !r.nProcId || ( r.nProcId == nProcId)) && + ( r.aName.equalsIgnoreAsciiCase(rName))) { - return p; + return &r; } } if( pParent ) @@ -200,14 +200,14 @@ SbiSymDef* SbiSymPool::Find( const OUString& rName ) const } -SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const +const SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const { for( sal_uInt16 i = 0; i < aData.size(); i++ ) { - SbiSymDef* p = aData[ i ]; - if( p->nId == n && ( !p->nProcId || ( p->nProcId == nProcId ) ) ) + const SbiSymDef &r = aData[ i ]; + if( r.nId == n && ( !r.nProcId || ( r.nProcId == nProcId ) ) ) { - return p; + return &r; } } if( pParent ) @@ -222,7 +222,7 @@ SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const // find via position (from 0) -SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) const +SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) { if( n >= aData.size() ) { @@ -230,7 +230,7 @@ SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) const } else { - return aData[ n ]; + return &aData[ n ]; } } @@ -268,10 +268,10 @@ void SbiSymPool::CheckRefs() { for( sal_uInt16 i = 0; i < aData.size(); i++ ) { - SbiSymDef* p = aData[ i ]; - if( !p->IsDefined() ) + SbiSymDef &r = aData[ i ]; + if( !r.IsDefined() ) { - pParser->Error( SbERR_UNDEF_LABEL, p->GetName() ); + pParser->Error( SbERR_UNDEF_LABEL, r.GetName() ); } } } @@ -479,10 +479,10 @@ void SbiProcDef::Match( SbiProcDef* pOld ) if( !pIn && pOld->pIn ) { // Replace old entry with the new one - pOld->pIn->aData[ pOld->nPos ] = this; nPos = pOld->nPos; nId = pOld->nId; pIn = pOld->pIn; + pIn->aData.replace( nPos, this ).release(); } delete pOld; } @@ -536,13 +536,4 @@ SbiConstDef* SbiConstDef::GetConstDef() return this; } -SbiSymbols::~SbiSymbols() -{ - for( const_iterator it = begin(); it != end(); ++it ) - { - delete *it; - } -}; - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx index c2bc4f068448..69f0d849f28c 100644 --- a/basic/source/inc/symtbl.hxx +++ b/basic/source/inc/symtbl.hxx @@ -21,6 +21,7 @@ #define INCLUDED_BASIC_SOURCE_INC_SYMTBL_HXX #include +#include class SbiConstDef; class SbiParser; @@ -50,11 +51,7 @@ public: }; -class SbiSymbols : public std::vector -{ -public: - ~SbiSymbols(); -}; +typedef boost::ptr_vector SbiSymbols; class SbiSymPool { friend class SbiSymDef; @@ -81,9 +78,9 @@ public: SbiSymDef* AddSym( const OUString& ); SbiProcDef* AddProc( const OUString& ); void Add( SbiSymDef* ); - SbiSymDef* Find( const OUString& ) const; // variable name - SbiSymDef* FindId( sal_uInt16 ) const; - SbiSymDef* Get( sal_uInt16 ) const; // find variable per position + SbiSymDef* Find( const OUString& ); // variable name + const SbiSymDef* FindId( sal_uInt16 ) const; + SbiSymDef* Get( sal_uInt16 ); // find variable per position SbiSymDef* First(), *Next(); // iterators sal_uInt32 Define( const OUString& ); -- cgit