summaryrefslogtreecommitdiff
path: root/sax/source
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-02-12 00:00:22 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-02-12 07:37:08 +0100
commit3f08be2e511dc2300021486a1cc2f1e8ba530373 (patch)
tree4498ff04e82aa36b94274af254b60f35e29805a8 /sax/source
parentf9c57cae202818258b416b4ca28040a44e8887c2 (diff)
Simplify containers iterations in reportdesign, sal, sax
Use range-based loop or replace with STL functions Change-Id: If6b734dab12a7298fce16003d3d175305fbe798d Reviewed-on: https://gerrit.libreoffice.org/67701 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax/source')
-rw-r--r--sax/source/fastparser/fastparser.cxx20
-rw-r--r--sax/source/tools/fastattribs.cxx4
-rw-r--r--sax/source/tools/fastserializer.cxx10
3 files changed, 15 insertions, 19 deletions
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index ff2d0080794b..a8c0c8fc357c 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -839,14 +839,13 @@ void FastSaxParserImpl::parseStream(const InputSource& rStructSource)
if ( rEntity.maPendingEvents.size() <= Entity::mnEventLowWater )
{
aGuard.clear();
- for (auto aEventIt = xEventList->maEvents.begin();
- aEventIt != xEventList->maEvents.end(); ++aEventIt)
+ for (auto& rEvent : xEventList->maEvents)
{
- if (aEventIt->mxAttributes.is())
+ if (rEvent.mxAttributes.is())
{
- aEventIt->mxAttributes->clear();
+ rEvent.mxAttributes->clear();
if( rEntity.mxNamespaceHandler.is() )
- aEventIt->mxDeclAttributes->clear();
+ rEvent.mxDeclAttributes->clear();
}
xEventList->mbIsAttributesEmpty = true;
}
@@ -980,23 +979,22 @@ bool FastSaxParserImpl::consume(EventList& rEventList)
{
Entity& rEntity = getEntity();
rEventList.mbIsAttributesEmpty = false;
- for (auto aEventIt = rEventList.maEvents.begin();
- aEventIt != rEventList.maEvents.end(); ++aEventIt)
+ for (auto& rEvent : rEventList.maEvents)
{
- switch ((*aEventIt).maType)
+ switch (rEvent.maType)
{
case CallbackType::START_ELEMENT:
- rEntity.startElement( &(*aEventIt) );
+ rEntity.startElement( &rEvent );
break;
case CallbackType::END_ELEMENT:
rEntity.endElement();
break;
case CallbackType::CHARACTERS:
- rEntity.characters( (*aEventIt).msChars );
+ rEntity.characters( rEvent.msChars );
break;
case CallbackType::PROCESSING_INSTRUCTION:
rEntity.processingInstruction(
- (*aEventIt).msNamespace, (*aEventIt).msElementName ); // ( target, data )
+ rEvent.msNamespace, rEvent.msElementName ); // ( target, data )
break;
case CallbackType::DONE:
return false;
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 21d36d30b81c..bc80a5b31f4c 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -236,8 +236,8 @@ Sequence< Attribute > FastAttributeList::getUnknownAttributes( )
{
Sequence< Attribute > aSeq( maUnknownAttributes.size() );
Attribute* pAttr = aSeq.getArray();
- for( UnknownAttributeList::iterator attrIter = maUnknownAttributes.begin(); attrIter != maUnknownAttributes.end(); ++attrIter )
- (*attrIter).FillAttribute( pAttr++ );
+ for( auto& rAttr : maUnknownAttributes )
+ rAttr.FillAttribute( pAttr++ );
return aSeq;
}
Sequence< FastAttribute > FastAttributeList::getFastAttributes( )
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index d299ca73ce08..a4c080663cc8 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -751,14 +751,12 @@ namespace sax_fastparser {
#if OSL_DEBUG_LEVEL > 0
void FastSaxSerializer::ForSort::print( )
{
- std::map< sal_Int32, Int8Sequence >::iterator iter = maData.begin();
- while ( iter != maData.end( ) )
+ for ( const auto& [rElement, rData] : maData )
{
- std::cerr << "pair: " << iter->first;
- for ( sal_Int32 i=0, len=iter->second.getLength(); i < len; ++i )
- std::cerr << iter->second[i];
+ std::cerr << "pair: " << rElement;
+ for ( sal_Int32 i=0, len=rData.getLength(); i < len; ++i )
+ std::cerr << rData[i];
std::cerr << "\n";
- ++iter;
}
sort( );