forked from qt-creator/qt-creator
CleanUp usage of QtAlgorithms
Change-Id: I61be20554014f90c2e1313167a3e3c869e26c35e Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -36,7 +36,6 @@
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QSharedData>
|
||||
#include <QtAlgorithms>
|
||||
|
||||
#ifdef DEBUG_UNIT_COUNT
|
||||
# include <QAtomicInt>
|
||||
|
||||
@@ -72,7 +72,6 @@
|
||||
#include <QRegExp>
|
||||
#include <QTextStream>
|
||||
#include <QTimer>
|
||||
#include <QtAlgorithms>
|
||||
#include <QStack>
|
||||
|
||||
#include <QApplication>
|
||||
@@ -6417,7 +6416,7 @@ void FakeVimHandler::Private::indentText(const Range &range, QChar typedChar)
|
||||
int beginBlock = document()->findBlock(range.beginPos).blockNumber();
|
||||
int endBlock = document()->findBlock(range.endPos).blockNumber();
|
||||
if (beginBlock > endBlock)
|
||||
qSwap(beginBlock, endBlock);
|
||||
std::swap(beginBlock, endBlock);
|
||||
|
||||
// Don't remember current indentation in last text insertion.
|
||||
const QString lastInsertion = m_buffer->lastInsertion;
|
||||
@@ -6438,7 +6437,7 @@ void FakeVimHandler::Private::shiftRegionRight(int repeat)
|
||||
int endLine = lineForPosition(position());
|
||||
int targetPos = anchor();
|
||||
if (beginLine > endLine) {
|
||||
qSwap(beginLine, endLine);
|
||||
std::swap(beginLine, endLine);
|
||||
targetPos = position();
|
||||
}
|
||||
if (hasConfig(ConfigStartOfLine))
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include <QShortcut>
|
||||
#include <QSignalMapper>
|
||||
#include <QStringList>
|
||||
#include <QtAlgorithms>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/editorconfiguration.h>
|
||||
|
||||
#include <QtAlgorithms>
|
||||
#include <QPointer>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QtAlgorithms>
|
||||
|
||||
enum {
|
||||
debug = false
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "qmljshighlighter.h"
|
||||
|
||||
#include <QSet>
|
||||
#include <QtAlgorithms>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
#include <QTextStream>
|
||||
#include <QTimer>
|
||||
#include <QRegExp>
|
||||
#include <QtAlgorithms>
|
||||
#include <QLibraryInfo>
|
||||
#include <qglobal.h>
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ bool BasicProposalItemListModel::isSortable(const QString &prefix) const
|
||||
|
||||
void BasicProposalItemListModel::sort(const QString &prefix)
|
||||
{
|
||||
qStableSort(m_currentItems.begin(), m_currentItems.end(), ContentLessThan(prefix));
|
||||
std::stable_sort(m_currentItems.begin(), m_currentItems.end(), ContentLessThan(prefix));
|
||||
}
|
||||
|
||||
int BasicProposalItemListModel::persistentId(int index) const
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QtAlgorithms>
|
||||
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
@@ -51,29 +50,16 @@ using namespace Internal;
|
||||
|
||||
namespace {
|
||||
|
||||
struct SnippetComp
|
||||
static bool snippetComp(const Snippet &a, const Snippet &b)
|
||||
{
|
||||
bool operator()(const Snippet &a, const Snippet &b) const
|
||||
{
|
||||
const int comp = a.trigger().toLower().localeAwareCompare(b.trigger().toLower());
|
||||
if (comp < 0)
|
||||
return true;
|
||||
else if (comp == 0 &&
|
||||
a.complement().toLower().localeAwareCompare(b.complement().toLower()) < 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
SnippetComp snippetComp;
|
||||
|
||||
struct RemovedSnippetPred
|
||||
{
|
||||
bool operator()(const Snippet &s) const
|
||||
{
|
||||
return s.isRemoved();
|
||||
}
|
||||
};
|
||||
RemovedSnippetPred removedSnippetPred;
|
||||
const int comp = a.trigger().toLower().localeAwareCompare(b.trigger().toLower());
|
||||
if (comp < 0)
|
||||
return true;
|
||||
else if (comp == 0 &&
|
||||
a.complement().toLower().localeAwareCompare(b.complement().toLower()) < 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
} // Anonymous
|
||||
|
||||
@@ -140,8 +126,8 @@ SnippetsCollection::Hint SnippetsCollection::computeInsertionHint(const Snippet
|
||||
{
|
||||
const int group = groupIndex(snippet.groupId());
|
||||
QList<Snippet> &snippets = m_snippets[group];
|
||||
QList<Snippet>::iterator it = qUpperBound(
|
||||
snippets.begin(), m_activeSnippetsEnd.at(group), snippet, snippetComp);
|
||||
QList<Snippet>::iterator it = std::upper_bound(snippets.begin(), m_activeSnippetsEnd.at(group),
|
||||
snippet, snippetComp);
|
||||
return Hint(static_cast<int>(std::distance(snippets.begin(), it)), it);
|
||||
}
|
||||
|
||||
@@ -175,12 +161,12 @@ SnippetsCollection::Hint SnippetsCollection::computeReplacementHint(int index,
|
||||
{
|
||||
const int group = groupIndex(snippet.groupId());
|
||||
QList<Snippet> &snippets = m_snippets[group];
|
||||
QList<Snippet>::iterator it = qLowerBound(
|
||||
snippets.begin(), m_activeSnippetsEnd.at(group), snippet, snippetComp);
|
||||
QList<Snippet>::iterator it = std::lower_bound(snippets.begin(), m_activeSnippetsEnd.at(group),
|
||||
snippet, snippetComp);
|
||||
int hintIndex = static_cast<int>(std::distance(snippets.begin(), it));
|
||||
if (index < hintIndex - 1)
|
||||
return Hint(hintIndex - 1, it);
|
||||
it = qUpperBound(it, m_activeSnippetsEnd.at(group), snippet, snippetComp);
|
||||
it = std::upper_bound(it, m_activeSnippetsEnd.at(group), snippet, snippetComp);
|
||||
hintIndex = static_cast<int>(std::distance(snippets.begin(), it));
|
||||
if (index > hintIndex)
|
||||
return Hint(hintIndex, it);
|
||||
@@ -249,7 +235,7 @@ void SnippetsCollection::updateActiveSnippetsEnd(int groupIndex)
|
||||
{
|
||||
m_activeSnippetsEnd[groupIndex] = std::find_if(m_snippets[groupIndex].begin(),
|
||||
m_snippets[groupIndex].end(),
|
||||
removedSnippetPred);
|
||||
[](const Snippet &s) { return s.isRemoved(); });
|
||||
}
|
||||
|
||||
void SnippetsCollection::restoreRemovedSnippets(const QString &groupId)
|
||||
@@ -258,7 +244,7 @@ void SnippetsCollection::restoreRemovedSnippets(const QString &groupId)
|
||||
// Reverting the snippet can still bring it to the original version
|
||||
const int group = groupIndex(groupId);
|
||||
QVector<Snippet> toRestore(std::distance(m_activeSnippetsEnd[group], m_snippets[group].end()));
|
||||
qCopy(m_activeSnippetsEnd[group], m_snippets[group].end(), toRestore.begin());
|
||||
std::copy(m_activeSnippetsEnd[group], m_snippets[group].end(), toRestore.begin());
|
||||
m_snippets[group].erase(m_activeSnippetsEnd[group], m_snippets[group].end());
|
||||
foreach (Snippet snippet, toRestore) {
|
||||
snippet.setIsRemoved(false);
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <QTextStream>
|
||||
#include <QVector>
|
||||
|
||||
#include <QtAlgorithms>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Valgrind {
|
||||
namespace XmlProtocol {
|
||||
@@ -95,7 +95,7 @@ Error::Error(const Error &other) :
|
||||
|
||||
void Error::swap(Error &other)
|
||||
{
|
||||
qSwap(d, other.d);
|
||||
std::swap(d, other.d);
|
||||
}
|
||||
|
||||
Error &Error::operator=(const Error &other)
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
#include "frame.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QtAlgorithms>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Valgrind {
|
||||
namespace XmlProtocol {
|
||||
@@ -91,7 +92,7 @@ bool Frame::operator!=(const Frame &other) const
|
||||
|
||||
void Frame::swap(Frame &other)
|
||||
{
|
||||
qSwap(d, other.d);
|
||||
std::swap(d, other.d);
|
||||
}
|
||||
|
||||
quint64 Frame::instructionPointer() const
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtAlgorithms>
|
||||
#include <QRegExp>
|
||||
|
||||
/*!
|
||||
@@ -82,7 +81,7 @@ enum FoldingState {
|
||||
Location
|
||||
};
|
||||
|
||||
}; // namespace Internal;
|
||||
} // namespace Internal;
|
||||
|
||||
static inline QTextCharFormat invertedColorFormat(const QTextCharFormat &in)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user