From 40ab4d8fda9b69b388ac674c1ee4e88084af9519 Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Sun, 14 Oct 2018 20:25:12 +0300 Subject: Simplify containers iterations in unotools, unoxml, uui, vbahelper Use range-based loop or replace with STL functions. Change-Id: I5a43f6fc62c81453dcef3820bb715f4da76915af Reviewed-on: https://gerrit.libreoffice.org/61762 Tested-by: Jenkins Reviewed-by: Noel Grandin --- unoxml/source/xpath/xpathapi.cxx | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'unoxml/source/xpath') diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx index f62be771f611..74f216d59a7f 100644 --- a/unoxml/source/xpath/xpathapi.cxx +++ b/unoxml/source/xpath/xpathapi.cxx @@ -120,16 +120,14 @@ namespace XPath xmlXPathContextPtr ctx, const nsmap_t& nsmap) { - nsmap_t::const_iterator i = nsmap.begin(); OString oprefix, ouri; - while (i != nsmap.end()) + for (const auto& rEntry : nsmap) { - oprefix = OUStringToOString(i->first, RTL_TEXTENCODING_UTF8); - ouri = OUStringToOString(i->second, RTL_TEXTENCODING_UTF8); + oprefix = OUStringToOString(rEntry.first, RTL_TEXTENCODING_UTF8); + ouri = OUStringToOString(rEntry.second, RTL_TEXTENCODING_UTF8); xmlChar const *p = reinterpret_cast(oprefix.getStr()); xmlChar const *u = reinterpret_cast(ouri.getStr()); (void)xmlXPathRegisterNs(ctx, p, u); - ++i; } } @@ -166,10 +164,9 @@ namespace XPath { nsmap_t namespaces; lcl_collectNamespaces(namespaces, xNamespaceNode); - for (nsmap_t::const_iterator iter = namespaces.begin(); - iter != namespaces.end(); ++iter) + for (const auto& rEntry : namespaces) { - rAPI.registerNS(iter->first, iter->second); + rAPI.registerNS(rEntry.first, rEntry.second); } } @@ -179,10 +176,9 @@ namespace XPath xmlXPathContextPtr ctx, const extensions_t& extensions) { - extensions_t::const_iterator i = extensions.begin(); - while (i != extensions.end()) + for (const auto& rExtensionRef : extensions) { - Libxml2ExtensionHandle aHandle = (*i)->getLibxml2ExtensionHandle(); + Libxml2ExtensionHandle aHandle = rExtensionRef->getLibxml2ExtensionHandle(); if ( aHandle.functionLookupFunction != 0 ) { xmlXPathRegisterFuncLookup(ctx, @@ -199,7 +195,6 @@ namespace XPath reinterpret_cast( sal::static_int_cast(aHandle.variableData))); } - ++i; } } -- cgit