summaryrefslogtreecommitdiff
path: root/sax/source/fastparser
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-08-10 19:07:30 +0300
committerArkadiy Illarionov <qarkai@gmail.com>2019-08-17 14:08:33 +0200
commitedcdfe5477559ca6c62897f0cad47d4d6149d77a (patch)
treebf97f0a716e760a3de4d95604483d26d943bd69f /sax/source/fastparser
parent5ad254ed246cf8d11b55e50ed0ccba5736d0cdbb (diff)
Simplify Sequence iterations in postprocess..sax
Use range-based loops, STL and comphelper functions Change-Id: If738d8f4e792c4686870183b0c0fdfbb61fd3351 Reviewed-on: https://gerrit.libreoffice.org/77245 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'sax/source/fastparser')
-rw-r--r--sax/source/fastparser/fastparser.cxx7
-rw-r--r--sax/source/fastparser/legacyfastparser.cxx18
2 files changed, 11 insertions, 14 deletions
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 4f1641f80b76..517f16f7c14a 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -408,11 +408,10 @@ void Entity::startElement( Event const *pEvent )
if ( mxNamespaceHandler.is() )
{
- Sequence< xml::Attribute > NSDeclAttribs = pEvent->mxDeclAttributes->getUnknownAttributes();
- sal_uInt16 len = NSDeclAttribs.getLength();
- for (sal_uInt16 i = 0; i < len; i++)
+ const Sequence< xml::Attribute > NSDeclAttribs = pEvent->mxDeclAttributes->getUnknownAttributes();
+ for (const auto& rNSDeclAttrib : NSDeclAttribs)
{
- mxNamespaceHandler->registerNamespace( NSDeclAttribs[i].Name, NSDeclAttribs[i].Value );
+ mxNamespaceHandler->registerNamespace( rNSDeclAttrib.Name, rNSDeclAttrib.Value );
}
}
diff --git a/sax/source/fastparser/legacyfastparser.cxx b/sax/source/fastparser/legacyfastparser.cxx
index 13dfc3b1d9bf..994835acc666 100644
--- a/sax/source/fastparser/legacyfastparser.cxx
+++ b/sax/source/fastparser/legacyfastparser.cxx
@@ -227,12 +227,11 @@ void SAL_CALL CallbackDocumentHandler::startUnknownElement( const OUString& /*Na
rtl::Reference < comphelper::AttributeList > rAttrList = new comphelper::AttributeList;
m_aNamespaceHandler->addNSDeclAttributes( rAttrList );
- Sequence< xml::FastAttribute > fastAttribs = Attribs->getFastAttributes();
- sal_uInt16 len = fastAttribs.getLength();
- for (sal_uInt16 i = 0; i < len; i++)
+ const Sequence< xml::FastAttribute > fastAttribs = Attribs->getFastAttributes();
+ for (const auto& rAttr : fastAttribs)
{
- const OUString& rAttrValue = fastAttribs[i].Value;
- sal_Int32 nToken = fastAttribs[i].Token;
+ const OUString& rAttrValue = rAttr.Value;
+ sal_Int32 nToken = rAttr.Token;
const OUString& rAttrNamespacePrefix = CallbackDocumentHandler::getNamespacePrefixFromToken( nToken );
OUString sAttrName = CallbackDocumentHandler::getNameFromToken( nToken );
if ( !rAttrNamespacePrefix.isEmpty() )
@@ -241,12 +240,11 @@ void SAL_CALL CallbackDocumentHandler::startUnknownElement( const OUString& /*Na
rAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue );
}
- Sequence< xml::Attribute > unknownAttribs = Attribs->getUnknownAttributes();
- len = unknownAttribs.getLength();
- for (sal_uInt16 i = 0; i < len; i++)
+ const Sequence< xml::Attribute > unknownAttribs = Attribs->getUnknownAttributes();
+ for (const auto& rAttr : unknownAttribs)
{
- const OUString& rAttrValue = unknownAttribs[i].Value;
- const OUString& rAttrName = unknownAttribs[i].Name;
+ const OUString& rAttrValue = rAttr.Value;
+ const OUString& rAttrName = rAttr.Name;
rAttrList->AddAttribute( rAttrName, "CDATA", rAttrValue );
}