[Libreoffice-commits] core.git: oox/source
Jan Holesovsky
kendy at collabora.com
Mon Jun 26 23:07:10 UTC 2017
oox/source/drawingml/diagram/diagram.cxx | 9 ++++---
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 5 +---
oox/source/drawingml/diagram/layoutatomvisitors.cxx | 23 ++++++++------------
3 files changed, 17 insertions(+), 20 deletions(-)
New commits:
commit 72b706d7def9e4805e35f3174170dad422b2e7f8
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon Jun 26 23:02:37 2017 +0200
SmartArt: std::for_each -> range-based for loop.
Change-Id: Ie2b36175a52c897bcf39da0ac2daa35979aac923
Reviewed-on: https://gerrit.libreoffice.org/39285
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index 059d891f4b85..86d1cf9cb835 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -75,11 +75,12 @@ DiagramData::DiagramData()
void DiagramData::dump()
{
SAL_INFO("oox.drawingml", "Dgm: DiagramData # of cnx: " << maConnections.size() );
- std::for_each( maConnections.begin(), maConnections.end(),
- [] (dgm::Connection & rConnection) { rConnection.dump(); } );
+ for (auto& rConnection : maConnections)
+ rConnection.dump();
+
SAL_INFO("oox.drawingml", "Dgm: DiagramData # of pt: " << maPoints.size() );
- std::for_each( maPoints.begin(), maPoints.end(),
- [] (dgm::Point & rPoint) { rPoint.dump(); } );
+ for (auto& rPoint : maPoints)
+ rPoint.dump();
}
void Diagram::setData( const DiagramDataPtr & pData)
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index f5461a8df2d3..9b0896249485 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -80,9 +80,8 @@ void ConditionAttr::loadFromXAttr( const Reference< XFastAttributeList >& xAttr
void LayoutAtom::dump(int level)
{
SAL_INFO("oox.drawingml", "level = " << level << " - " << msName << " of type " << typeid(*this).name() );
- const std::vector<LayoutAtomPtr>& rChildren=getChildren();
- std::for_each( rChildren.begin(), rChildren.end(),
- [level] (LayoutAtomPtr const& pAtom) { pAtom->dump(level + 1); } );
+ for (const auto& pAtom : getChildren())
+ pAtom->dump(level + 1);
}
ForEachAtom::ForEachAtom(const Reference< XFastAttributeList >& xAttributes)
diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
index 44bbe0d87458..a0c1609ba927 100755
--- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx
+++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
@@ -34,9 +34,8 @@ namespace oox { namespace drawingml {
void ShapeCreationVisitor::defaultVisit(LayoutAtom& rAtom)
{
- const std::vector<LayoutAtomPtr>& rChildren=rAtom.getChildren();
- std::for_each( rChildren.begin(), rChildren.end(),
- [this] (LayoutAtomPtr const& pAtom) { pAtom->accept(*this); } );
+ for (const auto& pAtom : rAtom.getChildren())
+ pAtom->accept(*this);
}
void ShapeCreationVisitor::visit(ConstraintAtom& /*rAtom*/)
@@ -60,8 +59,8 @@ void ShapeCreationVisitor::visit(ForEachAtom& rAtom)
// attribute that is contained in diagram's
// getPointsPresNameMap()
ShallowPresNameVisitor aVisitor(mrDgm);
- std::for_each( rChildren.begin(), rChildren.end(),
- [&] (LayoutAtomPtr const& pAtom) { pAtom->accept(aVisitor); } );
+ for (const auto& pAtom : rChildren)
+ pAtom->accept(aVisitor);
nChildren = aVisitor.getCount();
}
@@ -74,8 +73,8 @@ void ShapeCreationVisitor::visit(ForEachAtom& rAtom)
for( mnCurrIdx=0; mnCurrIdx<nCnt && nStep>0; mnCurrIdx+=nStep )
{
// TODO there is likely some conditions
- std::for_each( rChildren.begin(), rChildren.end(),
- [this] (LayoutAtomPtr const& pAtom) { pAtom->accept(*this); } );
+ for (const auto& pAtom : rChildren)
+ pAtom->accept(*this);
}
// and restore idx
@@ -139,9 +138,8 @@ void ShapeCreationVisitor::visit(LayoutNode& rAtom)
void ShapeLayoutingVisitor::defaultVisit(LayoutAtom& rAtom)
{
// visit all children, one of them needs to be the layout algorithm
- const std::vector<LayoutAtomPtr>& rChildren=rAtom.getChildren();
- std::for_each( rChildren.begin(), rChildren.end(),
- [this] (LayoutAtomPtr const& pAtom) { pAtom->accept(*this); } );
+ for (const auto& pAtom : rAtom.getChildren())
+ pAtom->accept(*this);
}
void ShapeLayoutingVisitor::visit(ConstraintAtom& /*rAtom*/)
@@ -178,9 +176,8 @@ void ShallowPresNameVisitor::defaultVisit(LayoutAtom& rAtom)
{
// visit all children, at least one of them needs to have proper
// name set
- const std::vector<LayoutAtomPtr>& rChildren=rAtom.getChildren();
- std::for_each( rChildren.begin(), rChildren.end(),
- [this] (LayoutAtomPtr const& pAtom) { pAtom->accept(*this); } );
+ for (const auto& pAtom : rAtom.getChildren())
+ pAtom->accept(*this);
}
void ShallowPresNameVisitor::visit(ConstraintAtom& /*rAtom*/)
More information about the Libreoffice-commits
mailing list