Kaydet (Commit) fffc9b2f authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Markus Mohrhard

fdo#75757: remove inheritance to std::vector

... which was introduced at 21103976.

Change-Id: If0f634b29e1891574267edf8cc07b24d07a9406c
Reviewed-on: https://gerrit.libreoffice.org/10363Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 1e2107e7
...@@ -110,7 +110,7 @@ SbiSymDef* SbiSymPool::Next() ...@@ -110,7 +110,7 @@ SbiSymDef* SbiSymPool::Next()
if( ++nCur >= aData.size() ) if( ++nCur >= aData.size() )
return NULL; return NULL;
else else
return aData[ nCur ]; return &aData[ nCur ];
} }
...@@ -177,16 +177,16 @@ void SbiSymPool::Add( SbiSymDef* pDef ) ...@@ -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(); sal_uInt16 nCount = aData.size();
for( sal_uInt16 i = 0; i < nCount; i++ ) for( sal_uInt16 i = 0; i < nCount; i++ )
{ {
SbiSymDef* p = aData[ nCount - i - 1 ]; SbiSymDef &r = aData[ nCount - i - 1 ];
if( ( !p->nProcId || ( p->nProcId == nProcId)) && if( ( !r.nProcId || ( r.nProcId == nProcId)) &&
( p->aName.equalsIgnoreAsciiCase(rName))) ( r.aName.equalsIgnoreAsciiCase(rName)))
{ {
return p; return &r;
} }
} }
if( pParent ) if( pParent )
...@@ -200,14 +200,14 @@ SbiSymDef* SbiSymPool::Find( const OUString& rName ) const ...@@ -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++ ) for( sal_uInt16 i = 0; i < aData.size(); i++ )
{ {
SbiSymDef* p = aData[ i ]; const SbiSymDef &r = aData[ i ];
if( p->nId == n && ( !p->nProcId || ( p->nProcId == nProcId ) ) ) if( r.nId == n && ( !r.nProcId || ( r.nProcId == nProcId ) ) )
{ {
return p; return &r;
} }
} }
if( pParent ) if( pParent )
...@@ -222,7 +222,7 @@ SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const ...@@ -222,7 +222,7 @@ SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const
// find via position (from 0) // find via position (from 0)
SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) const SbiSymDef* SbiSymPool::Get( sal_uInt16 n )
{ {
if( n >= aData.size() ) if( n >= aData.size() )
{ {
...@@ -230,7 +230,7 @@ SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) const ...@@ -230,7 +230,7 @@ SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) const
} }
else else
{ {
return aData[ n ]; return &aData[ n ];
} }
} }
...@@ -268,10 +268,10 @@ void SbiSymPool::CheckRefs() ...@@ -268,10 +268,10 @@ void SbiSymPool::CheckRefs()
{ {
for( sal_uInt16 i = 0; i < aData.size(); i++ ) for( sal_uInt16 i = 0; i < aData.size(); i++ )
{ {
SbiSymDef* p = aData[ i ]; SbiSymDef &r = aData[ i ];
if( !p->IsDefined() ) 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 ) ...@@ -479,10 +479,10 @@ void SbiProcDef::Match( SbiProcDef* pOld )
if( !pIn && pOld->pIn ) if( !pIn && pOld->pIn )
{ {
// Replace old entry with the new one // Replace old entry with the new one
pOld->pIn->aData[ pOld->nPos ] = this;
nPos = pOld->nPos; nPos = pOld->nPos;
nId = pOld->nId; nId = pOld->nId;
pIn = pOld->pIn; pIn = pOld->pIn;
pIn->aData.replace( nPos, this ).release();
} }
delete pOld; delete pOld;
} }
...@@ -536,13 +536,4 @@ SbiConstDef* SbiConstDef::GetConstDef() ...@@ -536,13 +536,4 @@ SbiConstDef* SbiConstDef::GetConstDef()
return this; return this;
} }
SbiSymbols::~SbiSymbols()
{
for( const_iterator it = begin(); it != end(); ++it )
{
delete *it;
}
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define INCLUDED_BASIC_SOURCE_INC_SYMTBL_HXX #define INCLUDED_BASIC_SOURCE_INC_SYMTBL_HXX
#include <vector> #include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
class SbiConstDef; class SbiConstDef;
class SbiParser; class SbiParser;
...@@ -50,11 +51,7 @@ public: ...@@ -50,11 +51,7 @@ public:
}; };
class SbiSymbols : public std::vector<SbiSymDef*> typedef boost::ptr_vector<SbiSymDef> SbiSymbols;
{
public:
~SbiSymbols();
};
class SbiSymPool { class SbiSymPool {
friend class SbiSymDef; friend class SbiSymDef;
...@@ -81,9 +78,9 @@ public: ...@@ -81,9 +78,9 @@ public:
SbiSymDef* AddSym( const OUString& ); SbiSymDef* AddSym( const OUString& );
SbiProcDef* AddProc( const OUString& ); SbiProcDef* AddProc( const OUString& );
void Add( SbiSymDef* ); void Add( SbiSymDef* );
SbiSymDef* Find( const OUString& ) const; // variable name SbiSymDef* Find( const OUString& ); // variable name
SbiSymDef* FindId( sal_uInt16 ) const; const SbiSymDef* FindId( sal_uInt16 ) const;
SbiSymDef* Get( sal_uInt16 ) const; // find variable per position SbiSymDef* Get( sal_uInt16 ); // find variable per position
SbiSymDef* First(), *Next(); // iterators SbiSymDef* First(), *Next(); // iterators
sal_uInt32 Define( const OUString& ); sal_uInt32 Define( const OUString& );
......
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