diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-10-14 20:25:12 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-15 08:00:08 +0200 |
commit | 40ab4d8fda9b69b388ac674c1ee4e88084af9519 (patch) | |
tree | 4e793d89f6e5001cd8f43ead80ffa26a5798ac4e /unoxml/source/xpath | |
parent | 9ec8bf8f22fe74884185492ef2576ce79b41e4f1 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoxml/source/xpath')
-rw-r--r-- | unoxml/source/xpath/xpathapi.cxx | 19 |
1 files changed, 7 insertions, 12 deletions
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<xmlChar const *>(oprefix.getStr()); xmlChar const *u = reinterpret_cast<xmlChar const *>(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<void*>( sal::static_int_cast<sal_IntPtr>(aHandle.variableData))); } - ++i; } } |