summaryrefslogtreecommitdiff
path: root/src/xmlpatterns/expr
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-03 13:19:09 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-07 12:48:14 +0000
commitc4fd65e40d093908f4f5be919a88930c799a2569 (patch)
treee7fcd629c89884d5d618f7f23a29f8b59ee66dbb /src/xmlpatterns/expr
parent3510040dc99a8266963c5e8ce10c2bd0edaaaf76 (diff)
downloadqtxmlpatterns-c4fd65e40d093908f4f5be919a88930c799a2569.tar.gz
OrderBy: Replace deprecated qLess by std::less.
Fix warning: expr\qorderby.cpp:79:7: warning: 'template<class T> class qLess' is deprecated [-Wdeprecated-declarations] class qLess<Item::List> ^ In file included from qtbase\include\QtCore/qalgorithms.h:1:0, from qtbase\include\QtCore/QtAlgorithms:1, from expr\qorderby.cpp:34: qtbase/src/corelib/tools/qalgorithms.h:150:40: note: declared here class QT_DEPRECATED_X("Use std::less") qLess ^ expr\qorderby.cpp: In member function 'virtual QAbstractXmlForwardIterator<QPatternist::Item>::Ptr QPatternist::OrderBy::evaluateSequence(const Ptr&) const': expr\qorderby.cpp:172:11: warning: 'template<class T> class qLess' is deprecated [-Wdeprecated-declarations] const qLess<Item::List> sorter(m_orderSpecs, context); ^ In file included from qtbase\include\QtCore/qalgorithms.h:1:0, from qtbase\include\QtCore/QtAlgorithms:1, from expr\qorderby.cpp:34: Change-Id: Ieb626eb0de96aea670433bb46a52ed780240e8d7 Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
Diffstat (limited to 'src/xmlpatterns/expr')
-rw-r--r--src/xmlpatterns/expr/qorderby.cpp24
1 files changed, 17 insertions, 7 deletions
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);