summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-09-26 10:29:45 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-26 15:35:52 +0200
commitabe229291b292e1e5d0d07b23c130991b347ae78 (patch)
treeaec73ea8efed8312e793c65b204cdc223fcca8d3
parenteff4a0f3fca2e22d4be888cdd7953e1c2ab8c918 (diff)
downloadqtscript-abe229291b292e1e5d0d07b23c130991b347ae78.tar.gz
Remove QtAlgorithms usage from QtScript.
QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: If4dc8f69fd75315390a4850be732715064f5fdd8 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r--src/script/api/qscriptengine.cpp5
-rw-r--r--src/scripttools/debugging/qscriptcompletiontask.cpp4
-rw-r--r--src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp4
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsolecommandmanager.cpp4
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp4
-rw-r--r--src/scripttools/debugging/qscriptsyntaxhighlighter.cpp8
6 files changed, 21 insertions, 8 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index cefcd50..4c7670d 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -42,6 +42,7 @@
#include <QtCore/qmetaobject.h>
#include <math.h>
+#include <algorithm>
#include "CodeBlock.h"
#include "Error.h"
@@ -3849,7 +3850,7 @@ QStringList QScriptEngine::availableExtensions() const
}
QStringList lst = result.toList();
- qSort(lst);
+ std::sort(lst.begin(), lst.end());
return lst;
#endif
}
@@ -3866,7 +3867,7 @@ QStringList QScriptEngine::importedExtensions() const
{
Q_D(const QScriptEngine);
QStringList lst = d->importedExtensions.toList();
- qSort(lst);
+ std::sort(lst.begin(), lst.end());
return lst;
}
diff --git a/src/scripttools/debugging/qscriptcompletiontask.cpp b/src/scripttools/debugging/qscriptcompletiontask.cpp
index 7ea204f..769293d 100644
--- a/src/scripttools/debugging/qscriptcompletiontask.cpp
+++ b/src/scripttools/debugging/qscriptcompletiontask.cpp
@@ -54,6 +54,8 @@
#include <QtCore/qset.h>
#include <QtCore/qdebug.h>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
class QScriptCompletionTaskPrivate
@@ -284,7 +286,7 @@ void QScriptCompletionTask::start()
if (isPrefixOf(arg, name))
d->results.append(name);
}
- qStableSort(d->results);
+ std::stable_sort(d->results.begin(), d->results.end());
} else if (argType == QLatin1String("script")) {
d->completeScriptExpression();
} else {
diff --git a/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp b/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp
index c8a048a..e6866b4 100644
--- a/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp
+++ b/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp
@@ -56,6 +56,8 @@
#include <QtScript/qscriptvalueiterator.h>
#include <QtCore/qdebug.h>
+#include <algorithm>
+
Q_DECLARE_METATYPE(QScriptScriptsDelta)
Q_DECLARE_METATYPE(QScriptDebuggerValueProperty)
Q_DECLARE_METATYPE(QScriptDebuggerValuePropertyList)
@@ -399,7 +401,7 @@ QScriptDebuggerResponse QScriptDebuggerCommandExecutor::execute(
}
}
QStringList matchesList = matches.toList();
- qStableSort(matchesList);
+ std::stable_sort(matchesList.begin(), matchesList.end());
response.setResult(matchesList);
} break;
diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager.cpp b/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager.cpp
index 6fe100d..19f05c1 100644
--- a/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager.cpp
@@ -46,6 +46,8 @@
#include <QtCore/qlist.h>
#include <QtCore/qstringlist.h>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
/*!
@@ -237,7 +239,7 @@ QStringList QScriptDebuggerConsoleCommandManager::completions(const QString &pre
result.append(name);
}
}
- qStableSort(result);
+ std::stable_sort(result.begin(), result.end());
return result;
}
diff --git a/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp b/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp
index 78bb5fc..55cfc2e 100644
--- a/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp
@@ -54,6 +54,8 @@
#include <QtWidgets/qboxlayout.h>
#include <QtWidgets/qcompleter.h>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
namespace {
@@ -277,7 +279,7 @@ void QScriptDebuggerConsoleWidgetPrivate::_q_onCompletionTaskFinished()
QStringList lst;
for (int i = 0; i < task->resultCount(); ++i)
lst.append(task->resultAt(i).mid(task->length()));
- qSort(lst.begin(), lst.end(), lengthLessThan);
+ std::sort(lst.begin(), lst.end(), lengthLessThan);
QString lcp = longestCommonPrefix(lst);
if (!lcp.isEmpty()) {
QString tmp = commandLine->input();
diff --git a/src/scripttools/debugging/qscriptsyntaxhighlighter.cpp b/src/scripttools/debugging/qscriptsyntaxhighlighter.cpp
index a8ccd95..112b4a9 100644
--- a/src/scripttools/debugging/qscriptsyntaxhighlighter.cpp
+++ b/src/scripttools/debugging/qscriptsyntaxhighlighter.cpp
@@ -42,6 +42,8 @@
#include "qscriptsyntaxhighlighter_p.h"
#include "private/qfunctions_p.h"
+#include <algorithm>
+
#ifndef QT_NO_SYNTAXHIGHLIGHTER
QT_BEGIN_NAMESPACE
@@ -143,9 +145,11 @@ static bool isKeyword(const QString &word)
{
const char * const *start = &keywords[0];
const char * const *end = &keywords[MAX_KEYWORD - 1];
- const char * const *kw = qBinaryFind(start, end, KeywordHelper(word));
- return kw != end;
+ const KeywordHelper keywordHelper(word);
+ const char * const *kw = std::lower_bound(start, end, keywordHelper);
+
+ return kw != end && !(keywordHelper < *kw);
}
QScriptSyntaxHighlighter::QScriptSyntaxHighlighter(QTextDocument *document)