diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-22 15:18:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-23 18:57:35 +0200 |
commit | b64f4847cceef666ba3c86950df729f3c94a1bd9 (patch) | |
tree | 7e25d4e41e0ba58583664da6a9ec270a0bb7aea2 /sc | |
parent | d4f7fc2a892f50873a1f7ded156c55c797adff34 (diff) |
std::list is overkill for small structures
Change-Id: I483ac562eb709d00c3354006da6662122777fbdc
Reviewed-on: https://gerrit.libreoffice.org/59452
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx | 24 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx | 12 |
2 files changed, 13 insertions, 23 deletions
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index ca86e272820e..e44932d2203b 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx @@ -553,24 +553,22 @@ void ScXMLChangeTrackingImportHelper::SetDeletionDependencies(ScMyDelAction* pAc OSL_ENSURE(((pAction->nActionType == SC_CAT_DELETE_COLS) || (pAction->nActionType == SC_CAT_DELETE_ROWS) || (pAction->nActionType == SC_CAT_DELETE_TABS)), "wrong action type"); - ScMyMoveCutOffs::iterator aItr(pAction->aMoveCutOffs.begin()); - ScMyMoveCutOffs::iterator aEndItr(pAction->aMoveCutOffs.end()); - while(aItr != aEndItr) + for (const ScMyMoveCutOff & rCutOff : pAction->aMoveCutOffs) { - ScChangeAction* pChangeAction = pTrack->GetAction(aItr->nID); + ScChangeAction* pChangeAction = pTrack->GetAction(rCutOff.nID); if (pChangeAction && (pChangeAction->GetType() == SC_CAT_MOVE)) { ScChangeActionMove* pMoveAction = static_cast<ScChangeActionMove*>(pChangeAction); if (pMoveAction && pDelAct) - pDelAct->AddCutOffMove(pMoveAction, static_cast<sal_Int16>(aItr->nStartPosition), - static_cast<sal_Int16>(aItr->nEndPosition)); + pDelAct->AddCutOffMove(pMoveAction, static_cast<sal_Int16>(rCutOff.nStartPosition), + static_cast<sal_Int16>(rCutOff.nEndPosition)); } else { OSL_FAIL("no cut off move action"); } - aItr = pAction->aMoveCutOffs.erase(aItr); } + pAction->aMoveCutOffs.clear(); } } @@ -625,13 +623,11 @@ void ScXMLChangeTrackingImportHelper::SetDependencies(ScMyBaseAction* pAction) { if (!pAction->aDependencies.empty()) { - ScMyDependencies::iterator aItr(pAction->aDependencies.begin()); - ScMyDependencies::iterator aEndItr(pAction->aDependencies.end()); - while(aItr != aEndItr) + for (const auto & rID : pAction->aDependencies) { - pAct->AddDependent(*aItr, pTrack); - aItr = pAction->aDependencies.erase(aItr); + pAct->AddDependent(rID, pTrack); } + pAction->aDependencies.clear(); } if (!pAction->aDeletedList.empty()) { @@ -758,8 +754,8 @@ void ScXMLChangeTrackingImportHelper::CreateChangeTrack(ScDocument* pTempDoc) // old files didn't store nanoseconds, disable until encountered pTrack->SetTimeNanoSeconds( false ); - ScMyActions::iterator aItr(aActions.begin()); - ScMyActions::iterator aEndItr(aActions.end()); + auto aItr(aActions.begin()); + auto aEndItr(aActions.end()); while (aItr != aEndItr) { ScChangeAction* pAction = nullptr; diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx index 558eee4289fa..deeb12a6674d 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx @@ -96,8 +96,6 @@ struct ScMyMoveCutOff nID(nTempID), nStartPosition(nStartPos), nEndPosition(nEndPos) {} }; -typedef std::list<ScMyMoveCutOff> ScMyMoveCutOffs; - struct ScMyMoveRanges { ScBigRange aSourceRange; @@ -107,13 +105,11 @@ struct ScMyMoveRanges aSourceRange(rSource), aTargetRange(rTarget) {} }; -typedef std::list<sal_uInt32> ScMyDependencies; - struct ScMyBaseAction { ScMyActionInfo aInfo; ScBigRange aBigRange; - ScMyDependencies aDependencies; + std::deque<sal_uInt32> aDependencies; std::deque<ScMyDeleted> aDeletedList; sal_uInt32 nActionNumber; sal_uInt32 nRejectingNumber; @@ -135,7 +131,7 @@ struct ScMyDelAction : public ScMyBaseAction { std::deque<ScMyGenerated> aGeneratedList; std::unique_ptr<ScMyInsertionCutOff> pInsCutOff; - ScMyMoveCutOffs aMoveCutOffs; + std::deque<ScMyMoveCutOff> aMoveCutOffs; sal_Int32 nD; explicit ScMyDelAction(const ScChangeActionType nActionType); @@ -165,12 +161,10 @@ struct ScMyRejAction : public ScMyBaseAction virtual ~ScMyRejAction() override; }; -typedef std::list<ScMyBaseAction*> ScMyActions; - class ScXMLChangeTrackingImportHelper { std::set<OUString> aUsers; - ScMyActions aActions; + std::deque<ScMyBaseAction*> aActions; css::uno::Sequence<sal_Int8> aProtect; ScDocument* pDoc; ScChangeTrack* pTrack; |