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:
committed by
Noel Grandin
parent
0bf5254b00
commit
5b19a738ed
@@ -560,9 +560,9 @@ void ExcTable::FillAsTableBinary( SCTAB nCodeNameIdx )
|
|||||||
if( rR.pUserBViewList )
|
if( rR.pUserBViewList )
|
||||||
{
|
{
|
||||||
XclExpUserBViewList::const_iterator iter;
|
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 );
|
Add( new XclExpUsersViewEnd );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -61,18 +61,17 @@ public:
|
|||||||
class XclExpUserBViewList : public ExcEmptyRec
|
class XclExpUserBViewList : public ExcEmptyRec
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::vector<XclExpUserBView*> aViews;
|
std::vector<XclExpUserBView> aViews;
|
||||||
|
|
||||||
public:
|
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 );
|
XclExpUserBViewList( const ScChangeTrack& rChangeTrack );
|
||||||
virtual ~XclExpUserBViewList() override;
|
virtual ~XclExpUserBViewList() override;
|
||||||
|
|
||||||
inline iterator begin () { return aViews.begin(); }
|
inline const_iterator cbegin () { return aViews.cbegin(); }
|
||||||
inline iterator end () { return aViews.end(); }
|
inline const_iterator cend () { return aViews.cend(); }
|
||||||
|
|
||||||
virtual void Save( XclExpStream& rStrm ) override;
|
virtual void Save( XclExpStream& rStrm ) override;
|
||||||
};
|
};
|
||||||
|
@@ -397,7 +397,7 @@ class ExcEScenarioManager : public ExcRecord
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
sal_uInt16 nActive;
|
sal_uInt16 nActive;
|
||||||
std::vector<ExcEScenario*> aScenes;
|
std::vector<ExcEScenario> aScenes;
|
||||||
|
|
||||||
virtual void SaveCont( XclExpStream& rStrm ) override;
|
virtual void SaveCont( XclExpStream& rStrm ) override;
|
||||||
|
|
||||||
|
@@ -137,20 +137,18 @@ XclExpUserBViewList::XclExpUserBViewList( const ScChangeTrack& rChangeTrack )
|
|||||||
for (; it != itEnd; ++it)
|
for (; it != itEnd; ++it)
|
||||||
{
|
{
|
||||||
lcl_GenerateGUID( aGUID, bValidGUID );
|
lcl_GenerateGUID( aGUID, bValidGUID );
|
||||||
aViews.push_back( new XclExpUserBView(*it, aGUID) );
|
aViews.emplace_back( *it, aGUID );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XclExpUserBViewList::~XclExpUserBViewList()
|
XclExpUserBViewList::~XclExpUserBViewList()
|
||||||
{
|
{
|
||||||
for( iterator iter = aViews.begin(); iter != aViews.end(); ++iter )
|
|
||||||
delete *iter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XclExpUserBViewList::Save( XclExpStream& rStrm )
|
void XclExpUserBViewList::Save( XclExpStream& rStrm )
|
||||||
{
|
{
|
||||||
for( iterator iter = aViews.begin(); iter != aViews.end(); ++iter )
|
for( XclExpUserBView& rView : aViews )
|
||||||
(*iter)->Save( rStrm );
|
rView.Save( rStrm );
|
||||||
}
|
}
|
||||||
|
|
||||||
XclExpUsersViewBegin::XclExpUsersViewBegin( const sal_uInt8* pGUID, sal_uInt32 nTab ) :
|
XclExpUsersViewBegin::XclExpUsersViewBegin( const sal_uInt8* pGUID, sal_uInt32 nTab ) :
|
||||||
|
@@ -1462,7 +1462,7 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab )
|
|||||||
|
|
||||||
while( rDoc.IsScenario( nNewTab ) )
|
while( rDoc.IsScenario( nNewTab ) )
|
||||||
{
|
{
|
||||||
aScenes.push_back( new ExcEScenario( rRoot, nNewTab ) );
|
aScenes.emplace_back( rRoot, nNewTab );
|
||||||
|
|
||||||
if( rDoc.IsActiveScenario( nNewTab ) )
|
if( rDoc.IsActiveScenario( nNewTab ) )
|
||||||
nActive = static_cast<sal_uInt16>(nNewTab - nFirstTab);
|
nActive = static_cast<sal_uInt16>(nNewTab - nFirstTab);
|
||||||
@@ -1472,9 +1472,6 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab )
|
|||||||
|
|
||||||
ExcEScenarioManager::~ExcEScenarioManager()
|
ExcEScenarioManager::~ExcEScenarioManager()
|
||||||
{
|
{
|
||||||
std::vector<ExcEScenario*>::iterator pIter;
|
|
||||||
for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
|
|
||||||
delete *pIter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExcEScenarioManager::SaveCont( XclExpStream& rStrm )
|
void ExcEScenarioManager::SaveCont( XclExpStream& rStrm )
|
||||||
@@ -1490,9 +1487,8 @@ void ExcEScenarioManager::Save( XclExpStream& rStrm )
|
|||||||
if( !aScenes.empty() )
|
if( !aScenes.empty() )
|
||||||
ExcRecord::Save( rStrm );
|
ExcRecord::Save( rStrm );
|
||||||
|
|
||||||
std::vector<ExcEScenario*>::iterator pIter;
|
for( ExcEScenario& rScenario : aScenes )
|
||||||
for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
|
rScenario.Save( rStrm );
|
||||||
(*pIter)->Save( rStrm );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm )
|
void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm )
|
||||||
@@ -1507,9 +1503,8 @@ void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm )
|
|||||||
// OOXTODO: XML_sqref,
|
// OOXTODO: XML_sqref,
|
||||||
FSEND );
|
FSEND );
|
||||||
|
|
||||||
std::vector<ExcEScenario*>::iterator pIter;
|
for( ExcEScenario& rScenario : aScenes )
|
||||||
for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
|
rScenario.SaveXml( rStrm );
|
||||||
(*pIter)->SaveXml( rStrm );
|
|
||||||
|
|
||||||
rWorkbook->endElement( XML_scenarios );
|
rWorkbook->endElement( XML_scenarios );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user