summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-10-14 20:06:10 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-10-14 20:06:10 +0200
commitd570274da3ba262d85cf9a32de34678c85c1af9e (patch)
tree8e67de1cc937e835d3507a38a415ac4aa579608b /src
parent14afeb8512bb4c4614256ebd227c06df2a1c8103 (diff)
parent688b29fc5aeab0eafbb457a0fa6953856eeac928 (diff)
downloadqtxmlpatterns-d570274da3ba262d85cf9a32de34678c85c1af9e.tar.gz
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: tests/auto/xmlpatterns/tst_xmlpatterns.cpp Change-Id: Ib93b62f45d796dd3ed2d5d03f602699295f62705
Diffstat (limited to 'src')
-rw-r--r--src/xmlpatterns/api/qabstractxmlreceiver.cpp2
-rw-r--r--src/xmlpatterns/api/qxmlquery.cpp4
-rw-r--r--src/xmlpatterns/doc/src/xquery-introduction.qdoc2
-rw-r--r--src/xmlpatterns/expr/qexpression_p.h7
-rw-r--r--src/xmlpatterns/expr/qexpressionsequence.cpp9
-rw-r--r--src/xmlpatterns/expr/qliteralsequence.cpp2
-rw-r--r--src/xmlpatterns/expr/qorderby.cpp24
7 files changed, 37 insertions, 13 deletions
diff --git a/src/xmlpatterns/api/qabstractxmlreceiver.cpp b/src/xmlpatterns/api/qabstractxmlreceiver.cpp
index ed5ce2d..3f5b443 100644
--- a/src/xmlpatterns/api/qabstractxmlreceiver.cpp
+++ b/src/xmlpatterns/api/qabstractxmlreceiver.cpp
@@ -340,7 +340,7 @@ allow null QUrls.
This callback is called when a namespace binding is in scope of an
element. A namespace is defined by a URI. In the \l {QXmlName}
\a name, the value of \l {QXmlName::namespaceUri()} is that URI. The
- value of \l {QXmlName::prefix()} is the prefix that the URI is bound
+ value of \l {QXmlName::prefix}() is the prefix that the URI is bound
to. The local name is insignificant and can be an arbitrary value.
*/
diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp
index dd8faae..718b9c8 100644
--- a/src/xmlpatterns/api/qxmlquery.cpp
+++ b/src/xmlpatterns/api/qxmlquery.cpp
@@ -1100,7 +1100,7 @@ void QXmlQuery::setInitialTemplateName(const QXmlName &name)
\overload
Sets the name of the initial template to \a localName, which must be
- a valid \l{QXmlName::localName()} {local name}. The initial template
+ a valid \l{QXmlName::localName}{local name}. The initial template
is the one the processor calls first, instead of attempting to match
a template to the context node (if any). If an initial template is
not set, the standard order of template invocation will be used.
@@ -1109,7 +1109,7 @@ void QXmlQuery::setInitialTemplateName(const QXmlName &name)
stylesheets. The name becomes part of the compiled stylesheet.
Therefore, this function must be called before calling setQuery().
- If \a localName is not a valid \l{QXmlName::localName()} {local
+ If \a localName is not a valid \l{QXmlName::localName} {local
name}, the effect is undefined. If the stylesheet has no template
named \a localName, the processor will use the standard order of
template invocation.
diff --git a/src/xmlpatterns/doc/src/xquery-introduction.qdoc b/src/xmlpatterns/doc/src/xquery-introduction.qdoc
index 6117424..49458ac 100644
--- a/src/xmlpatterns/doc/src/xquery-introduction.qdoc
+++ b/src/xmlpatterns/doc/src/xquery-introduction.qdoc
@@ -31,7 +31,7 @@
\pagekeywords XPath XQuery
\startpage XQuery
-\target XQuery-introduction
+\keyword XQuery-introduction
XQuery is a language for querying XML data or non-XML data that can be
modeled as XML. XQuery is specified by the \l{http://www.w3.org}{W3C}.
diff --git a/src/xmlpatterns/expr/qexpression_p.h b/src/xmlpatterns/expr/qexpression_p.h
index c799725..7a7899f 100644
--- a/src/xmlpatterns/expr/qexpression_p.h
+++ b/src/xmlpatterns/expr/qexpression_p.h
@@ -375,11 +375,16 @@ namespace QPatternist
IDExistsFN,
/**
- * Identifies ExpressionSequence and LiteralSequence.
+ * Identifies ExpressionSequence.
*/
IDExpressionSequence,
/**
+ * Identifies LiteralSequence.
+ */
+ IDLiteralSequence,
+
+ /**
* Identifies GeneralComparison.
*/
IDGeneralComparison,
diff --git a/src/xmlpatterns/expr/qexpressionsequence.cpp b/src/xmlpatterns/expr/qexpressionsequence.cpp
index 4ff8082..c71beb9 100644
--- a/src/xmlpatterns/expr/qexpressionsequence.cpp
+++ b/src/xmlpatterns/expr/qexpressionsequence.cpp
@@ -34,6 +34,8 @@
#include "qcardinalityverifier_p.h"
#include "qcommonsequencetypes_p.h"
#include "qemptysequence_p.h"
+#include "qabstractxmlforwarditerator_p.h"
+#include "qliteral_p.h"
#include "qsequencemappingiterator_p.h"
#include "qexpressionsequence_p.h"
@@ -106,6 +108,13 @@ Expression::Ptr ExpressionSequence::compress(const StaticContext::Ptr &context)
for(; seqIt != seqEnd; ++seqIt)
result.append(*seqIt);
+ } 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.
+ Item::Iterator::Ptr seqIt = (*it)->evaluateSequence(DynamicContext::Ptr(Q_NULLPTR));
+
+ while (!seqIt->next().isNull())
+ result.append(Literal::Ptr(new Literal(seqIt->current())));
}
else
result.append(*it);
diff --git a/src/xmlpatterns/expr/qliteralsequence.cpp b/src/xmlpatterns/expr/qliteralsequence.cpp
index e0b610d..8c920d3 100644
--- a/src/xmlpatterns/expr/qliteralsequence.cpp
+++ b/src/xmlpatterns/expr/qliteralsequence.cpp
@@ -73,7 +73,7 @@ ExpressionVisitorResult::Ptr LiteralSequence::accept(const ExpressionVisitor::Pt
Expression::ID LiteralSequence::id() const
{
- return IDExpressionSequence;
+ return IDLiteralSequence;
}
Expression::Properties LiteralSequence::properties() const
diff --git a/src/xmlpatterns/expr/qorderby.cpp b/src/xmlpatterns/expr/qorderby.cpp
index ba6bcb2..7dbf320 100644
--- a/src/xmlpatterns/expr/qorderby.cpp
+++ b/src/xmlpatterns/expr/qorderby.cpp
@@ -44,6 +44,7 @@
#include "qorderby_p.h"
#include <algorithm>
+#include <functional>
QT_BEGIN_NAMESPACE
@@ -72,11 +73,17 @@ void OrderBy::OrderSpec::prepare(const Expression::Ptr &source,
* @short Functor used by Qt's qSort() and qStableSort(). Used for FLWOR's
* <tt>order by</tt> expression.
*
- * This must be in the global namespace, since it is specializing qLess(), which
- * is in the global namespace. Hence it can't be in QPatternist.
+ * This must be in the std namespace, since it is specializing std::less(), which
+ * is in the std namespace. Hence it can't be in QPatternist.
*/
+
+QT_END_NAMESPACE
+
+QT_USE_NAMESPACE
+
+namespace std {
template<>
-class qLess<Item::List>
+struct less<Item::List>
{
private:
@@ -87,9 +94,9 @@ private:
}
public:
- inline qLess(const OrderBy::OrderSpec::Vector &orderspecs,
- const DynamicContext::Ptr &context) : m_orderSpecs(orderspecs)
- , m_context(context)
+ inline less(const OrderBy::OrderSpec::Vector &orderspecs,
+ const DynamicContext::Ptr &context) : m_orderSpecs(orderspecs)
+ , m_context(context)
{
Q_ASSERT(!m_orderSpecs.isEmpty());
Q_ASSERT(context);
@@ -158,6 +165,9 @@ private:
const OrderBy::OrderSpec::Vector & m_orderSpecs;
const DynamicContext::Ptr & m_context;
};
+} // namespace std
+
+QT_BEGIN_NAMESPACE
Item::Iterator::Ptr OrderBy::mapToSequence(const Item &i,
const DynamicContext::Ptr &) const
@@ -169,7 +179,7 @@ Item::Iterator::Ptr OrderBy::evaluateSequence(const DynamicContext::Ptr &context
{
Item::List tuples(m_operand->evaluateSequence(context)->toList());
- const qLess<Item::List> sorter(m_orderSpecs, context);
+ const std::less<Item::List> sorter(m_orderSpecs, context);
Q_ASSERT(m_stability == StableOrder || m_stability == UnstableOrder);