summaryrefslogtreecommitdiff
path: root/unoxml
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2018-10-14 20:25:12 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-15 08:00:08 +0200
commit40ab4d8fda9b69b388ac674c1ee4e88084af9519 (patch)
tree4e793d89f6e5001cd8f43ead80ffa26a5798ac4e /unoxml
parent9ec8bf8f22fe74884185492ef2576ce79b41e4f1 (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')
-rw-r--r--unoxml/source/dom/document.cxx17
-rw-r--r--unoxml/source/rdf/librdf_repository.cxx6
-rw-r--r--unoxml/source/xpath/xpathapi.cxx19
3 files changed, 15 insertions, 27 deletions
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index 69a15862501a..2ba945fb7efa 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -110,10 +110,9 @@ namespace DOM
::osl::MutexGuard const g(m_Mutex);
#ifdef DBG_UTIL
// node map must be empty now, otherwise CDocument must not die!
- for (nodemap_t::iterator i = m_NodeMap.begin();
- i != m_NodeMap.end(); ++i)
+ for (const auto& rEntry : m_NodeMap)
{
- Reference<XNode> const xNode(i->second.first);
+ Reference<XNode> const xNode(rEntry.second.first);
OSL_ENSURE(!xNode.is(),
"CDocument::~CDocument(): ERROR: live node in document node map!");
}
@@ -377,11 +376,9 @@ namespace DOM
}
// notify listeners about start
- listenerlist_t::const_iterator iter1 = streamListeners.begin();
- while (iter1 != streamListeners.end()) {
- Reference< XStreamListener > aListener = *iter1;
+ for (const auto& rStreamListener : streamListeners) {
+ Reference< XStreamListener > aListener = rStreamListener;
aListener->started();
- ++iter1;
}
{
@@ -398,11 +395,9 @@ namespace DOM
}
// call listeners
- listenerlist_t::const_iterator iter2 = streamListeners.begin();
- while (iter2 != streamListeners.end()) {
- Reference< XStreamListener > aListener = *iter2;
+ for (const auto& rStreamListener : streamListeners) {
+ Reference< XStreamListener > aListener = rStreamListener;
aListener->closed();
- ++iter2;
}
}
diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx
index 995c3034d02f..4d0a1ca91f3f 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -1491,13 +1491,11 @@ void SAL_CALL librdf_Repository::setStatementRDFa(
}
try
{
- for (::std::vector< std::shared_ptr<librdf_TypeConverter::Resource> >
- ::iterator iter = predicates.begin(); iter != predicates.end();
- ++iter)
+ for (const auto& rPredicatePtr : predicates)
{
addStatementGraph_Lock(
librdf_TypeConverter::Statement(pSubject,
- std::dynamic_pointer_cast<librdf_TypeConverter::URI>(*iter),
+ std::dynamic_pointer_cast<librdf_TypeConverter::URI>(rPredicatePtr),
pContent),
sContext, true);
}
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;
}
}