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 <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
Takeshi Abe 2014-07-17 14:19:37 +09:00 committed by Markus Mohrhard
parent 1e2107e76b
commit fffc9b2f26
2 changed files with 21 additions and 33 deletions

View File

@ -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: */

View File

@ -21,6 +21,7 @@
#define INCLUDED_BASIC_SOURCE_INC_SYMTBL_HXX
#include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
class SbiConstDef;
class SbiParser;
@ -50,11 +51,7 @@ public:
};
class SbiSymbols : public std::vector<SbiSymDef*>
{
public:
~SbiSymbols();
};
typedef boost::ptr_vector<SbiSymDef> 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& );