summaryrefslogtreecommitdiff
path: root/src/xmlpatterns
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-11-15 09:12:02 +0100
committerLiang Qi <liang.qi@qt.io>2017-11-15 09:12:02 +0100
commitffd8366ad503649c6de365c427d0de15ab9a75db (patch)
treea43b8a9bd245a81e1d9dfae8f672beefd8bc4023 /src/xmlpatterns
parent40a50c0c585eaa838261742e33a547e09d4040d6 (diff)
parent0b20348321b0c5663e46f293ed0ceb3c68594e63 (diff)
downloadqtxmlpatterns-ffd8366ad503649c6de365c427d0de15ab9a75db.tar.gz
Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: Idcfaa401ee18ab56f63d2089eca666be12abadcd
Diffstat (limited to 'src/xmlpatterns')
-rw-r--r--src/xmlpatterns/expr/qexpressionsequence.cpp10
-rw-r--r--src/xmlpatterns/functions/qconstructorfunctionsfactory.cpp5
-rw-r--r--src/xmlpatterns/functions/qfunctionfactorycollection.cpp5
3 files changed, 11 insertions, 9 deletions
diff --git a/src/xmlpatterns/expr/qexpressionsequence.cpp b/src/xmlpatterns/expr/qexpressionsequence.cpp
index 193e15f..d796de4 100644
--- a/src/xmlpatterns/expr/qexpressionsequence.cpp
+++ b/src/xmlpatterns/expr/qexpressionsequence.cpp
@@ -46,6 +46,9 @@
#include "qexpressionsequence_p.h"
+#include <algorithm>
+#include <iterator>
+
QT_BEGIN_NAMESPACE
using namespace QPatternist;
@@ -109,11 +112,8 @@ Expression::Ptr ExpressionSequence::compress(const StaticContext::Ptr &context)
else if(Id == IDExpressionSequence)
{
/* Rewrite "(1, (2, 3), 4)" into "(1, 2, 3, 4)" */
- Expression::List::const_iterator seqIt((*it)->operands().constBegin());
- const Expression::List::const_iterator seqEnd((*it)->operands().constEnd());
-
- for(; seqIt != seqEnd; ++seqIt)
- result.append(*seqIt);
+ const auto &operands = (*it)->operands();
+ std::copy(operands.cbegin(), operands.cend(), std::back_inserter(result));
} else if (Id == IDLiteralSequence) {
/* Rewrite "(1, (2, 3), 4)" into "(1, 2, 3, 4)" */
// Note: LiteralSequence does not use the dynamic context, so we pass in a nullptr.
diff --git a/src/xmlpatterns/functions/qconstructorfunctionsfactory.cpp b/src/xmlpatterns/functions/qconstructorfunctionsfactory.cpp
index 67c9e84..10d5829 100644
--- a/src/xmlpatterns/functions/qconstructorfunctionsfactory.cpp
+++ b/src/xmlpatterns/functions/qconstructorfunctionsfactory.cpp
@@ -58,8 +58,9 @@ ConstructorFunctionsFactory::ConstructorFunctionsFactory(const NamePool::Ptr &np
{
Q_ASSERT(m_typeFactory);
Q_ASSERT(np);
- SchemaType::Hash::const_iterator it(m_typeFactory->types().constBegin());
- const SchemaType::Hash::const_iterator end(m_typeFactory->types().constEnd());
+ const auto &schemaHash = m_typeFactory->types();
+ SchemaType::Hash::const_iterator it(schemaHash.constBegin());
+ const SchemaType::Hash::const_iterator end(schemaHash.constEnd());
FunctionArgument::List args;
const QXmlName argName(StandardNamespaces::empty, StandardLocalNames::sourceValue);
diff --git a/src/xmlpatterns/functions/qfunctionfactorycollection.cpp b/src/xmlpatterns/functions/qfunctionfactorycollection.cpp
index 6c10425..1deb3cc 100644
--- a/src/xmlpatterns/functions/qfunctionfactorycollection.cpp
+++ b/src/xmlpatterns/functions/qfunctionfactorycollection.cpp
@@ -92,8 +92,9 @@ FunctionSignature::Hash FunctionFactoryCollection::functionSignatures() const
for(const_iterator it(constBegin()); it != e; ++it)
{
- const FunctionSignature::Hash::const_iterator e2((*it)->functionSignatures().constEnd());
- FunctionSignature::Hash::const_iterator sit((*it)->functionSignatures().constBegin());
+ const auto &signatures = (*it)->functionSignatures();
+ const FunctionSignature::Hash::const_iterator e2(signatures.constEnd());
+ FunctionSignature::Hash::const_iterator sit(signatures.constBegin());
for(; sit != e2; ++sit)
result.insert(sit.key(), sit.value());