replace pointers with objects in std::vectors
Change-Id: Id5577ae0b3bdf31b6d5e409cd2c0033d9f2591a2 Reviewed-on: https://gerrit.libreoffice.org/34046 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
0bf5254b00
commit
5b19a738ed
@ -560,9 +560,9 @@ void ExcTable::FillAsTableBinary( SCTAB nCodeNameIdx )
|
||||
if( rR.pUserBViewList )
|
||||
{
|
||||
XclExpUserBViewList::const_iterator iter;
|
||||
for ( iter = rR.pUserBViewList->begin(); iter != rR.pUserBViewList->end(); ++iter)
|
||||
for ( iter = rR.pUserBViewList->cbegin(); iter != rR.pUserBViewList->cend(); ++iter)
|
||||
{
|
||||
Add( new XclExpUsersViewBegin( (*iter)->GetGUID(), nExcTab ) );
|
||||
Add( new XclExpUsersViewBegin( (*iter).GetGUID(), nExcTab ) );
|
||||
Add( new XclExpUsersViewEnd );
|
||||
}
|
||||
}
|
||||
|
@ -61,18 +61,17 @@ public:
|
||||
class XclExpUserBViewList : public ExcEmptyRec
|
||||
{
|
||||
private:
|
||||
std::vector<XclExpUserBView*> aViews;
|
||||
std::vector<XclExpUserBView> aViews;
|
||||
|
||||
public:
|
||||
|
||||
typedef std::vector<XclExpUserBView*>::iterator iterator;
|
||||
typedef std::vector<XclExpUserBView*>::const_iterator const_iterator;
|
||||
typedef std::vector<XclExpUserBView>::const_iterator const_iterator;
|
||||
|
||||
XclExpUserBViewList( const ScChangeTrack& rChangeTrack );
|
||||
virtual ~XclExpUserBViewList() override;
|
||||
|
||||
inline iterator begin () { return aViews.begin(); }
|
||||
inline iterator end () { return aViews.end(); }
|
||||
inline const_iterator cbegin () { return aViews.cbegin(); }
|
||||
inline const_iterator cend () { return aViews.cend(); }
|
||||
|
||||
virtual void Save( XclExpStream& rStrm ) override;
|
||||
};
|
||||
|
@ -397,7 +397,7 @@ class ExcEScenarioManager : public ExcRecord
|
||||
{
|
||||
private:
|
||||
sal_uInt16 nActive;
|
||||
std::vector<ExcEScenario*> aScenes;
|
||||
std::vector<ExcEScenario> aScenes;
|
||||
|
||||
virtual void SaveCont( XclExpStream& rStrm ) override;
|
||||
|
||||
|
@ -137,20 +137,18 @@ XclExpUserBViewList::XclExpUserBViewList( const ScChangeTrack& rChangeTrack )
|
||||
for (; it != itEnd; ++it)
|
||||
{
|
||||
lcl_GenerateGUID( aGUID, bValidGUID );
|
||||
aViews.push_back( new XclExpUserBView(*it, aGUID) );
|
||||
aViews.emplace_back( *it, aGUID );
|
||||
}
|
||||
}
|
||||
|
||||
XclExpUserBViewList::~XclExpUserBViewList()
|
||||
{
|
||||
for( iterator iter = aViews.begin(); iter != aViews.end(); ++iter )
|
||||
delete *iter;
|
||||
}
|
||||
|
||||
void XclExpUserBViewList::Save( XclExpStream& rStrm )
|
||||
{
|
||||
for( iterator iter = aViews.begin(); iter != aViews.end(); ++iter )
|
||||
(*iter)->Save( rStrm );
|
||||
for( XclExpUserBView& rView : aViews )
|
||||
rView.Save( rStrm );
|
||||
}
|
||||
|
||||
XclExpUsersViewBegin::XclExpUsersViewBegin( const sal_uInt8* pGUID, sal_uInt32 nTab ) :
|
||||
|
@ -1462,7 +1462,7 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab )
|
||||
|
||||
while( rDoc.IsScenario( nNewTab ) )
|
||||
{
|
||||
aScenes.push_back( new ExcEScenario( rRoot, nNewTab ) );
|
||||
aScenes.emplace_back( rRoot, nNewTab );
|
||||
|
||||
if( rDoc.IsActiveScenario( nNewTab ) )
|
||||
nActive = static_cast<sal_uInt16>(nNewTab - nFirstTab);
|
||||
@ -1472,9 +1472,6 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab )
|
||||
|
||||
ExcEScenarioManager::~ExcEScenarioManager()
|
||||
{
|
||||
std::vector<ExcEScenario*>::iterator pIter;
|
||||
for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
|
||||
delete *pIter;
|
||||
}
|
||||
|
||||
void ExcEScenarioManager::SaveCont( XclExpStream& rStrm )
|
||||
@ -1490,9 +1487,8 @@ void ExcEScenarioManager::Save( XclExpStream& rStrm )
|
||||
if( !aScenes.empty() )
|
||||
ExcRecord::Save( rStrm );
|
||||
|
||||
std::vector<ExcEScenario*>::iterator pIter;
|
||||
for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
|
||||
(*pIter)->Save( rStrm );
|
||||
for( ExcEScenario& rScenario : aScenes )
|
||||
rScenario.Save( rStrm );
|
||||
}
|
||||
|
||||
void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm )
|
||||
@ -1507,9 +1503,8 @@ void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm )
|
||||
// OOXTODO: XML_sqref,
|
||||
FSEND );
|
||||
|
||||
std::vector<ExcEScenario*>::iterator pIter;
|
||||
for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
|
||||
(*pIter)->SaveXml( rStrm );
|
||||
for( ExcEScenario& rScenario : aScenes )
|
||||
rScenario.SaveXml( rStrm );
|
||||
|
||||
rWorkbook->endElement( XML_scenarios );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user