Kaydet (Commit) 6c42e396 authored tarafından Julien Nabet's avatar Julien Nabet

Modernize code in sdext

Change-Id: I2257014cf77b14aba263718b4730744960cc1dc2
Reviewed-on: https://gerrit.libreoffice.org/46178Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 0201942d
......@@ -34,17 +34,14 @@ namespace pdfi
Element::~Element()
{
while( !Children.empty() )
{
Element* pCurr( Children.front() );
delete pCurr;
Children.pop_front();
}
for (auto const& child : Children)
delete child;
Children.clear();
}
void Element::applyToChildren( ElementTreeVisitor& rVisitor )
{
for( std::list< Element* >::iterator it = Children.begin(); it != Children.end(); ++it )
for( auto it = Children.begin(); it != Children.end(); ++it )
(*it)->visitedBy( rVisitor, it );
}
......@@ -92,8 +89,8 @@ void Element::emitStructure( int nLevel)
{
SAL_INFO( "sdext", std::string(nLevel, ' ') << "<" << typeid( *this ).name() << " " << this << "> ("
<< std::setprecision(1) << x << "," << y << ")+(" << w << "x" << h << ")" );
for( std::list< Element* >::iterator it = Children.begin(); it != Children.end(); ++it )
(*it)->emitStructure(nLevel+1 );
for (auto const& child : Children)
child->emitStructure(nLevel+1);
SAL_INFO( "sdext", std::string(nLevel, ' ') << "</" << typeid( *this ).name() << ">" );
}
#endif
......@@ -179,8 +176,8 @@ void PolyPolyElement::emitStructure( int nLevel)
}
SAL_WARN( "sdext", " " << buff.makeStringAndClear() );
}
for( std::list< Element* >::iterator it = Children.begin(); it != Children.end(); ++it )
(*it)->emitStructure( nLevel+1 );
for (auto const& child : Children)
child->emitStructure( nLevel+1 );
SAL_WARN( "sdext", std::string(nLevel, ' ') << "</" << typeid( *this ).name() << ">");
}
#endif
......
......@@ -696,10 +696,9 @@ void PDFIProcessor::sortElements( Element* pEle, bool bDeep )
if( bDeep )
{
for( std::list< Element* >::iterator it = pEle->Children.begin();
it != pEle->Children.end(); ++it )
for (auto const& child : pEle->Children)
{
sortElements( *it, bDeep );
sortElements( child, bDeep );
}
}
// HACK: the stable sort member on std::list that takes a
......@@ -716,9 +715,8 @@ void PDFIProcessor::sortElements( Element* pEle, bool bDeep )
pEle->Children.pop_front();
}
std::stable_sort( aChildren.begin(), aChildren.end(), lr_tb_sort );
int nChildren = aChildren.size();
for( int i = 0; i < nChildren; i++ )
pEle->Children.push_back( aChildren[i] );
for (auto const& child : aChildren)
pEle->Children.push_back(child);
}
// helper method: get a mirrored string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment