Remove qLowerBound usages from qtbase
Replace them with std::lower_bound; this allows for deprecation of qLowerBound. Change-Id: I536e7338eb85ea6c7c1a5bf23121292767927e0b Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
parent
21d3445243
commit
1e37d854f7
@ -46,6 +46,8 @@
|
||||
#include <QtCore/qline.h>
|
||||
#include <QtCore/qmutex.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef QT_NO_ANIMATION
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -243,10 +245,10 @@ void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/)
|
||||
if (force || (currentInterval.start.first > 0 && progress < currentInterval.start.first)
|
||||
|| (currentInterval.end.first < 1 && progress > currentInterval.end.first)) {
|
||||
//let's update currentInterval
|
||||
QVariantAnimation::KeyValues::const_iterator it = qLowerBound(keyValues.constBegin(),
|
||||
keyValues.constEnd(),
|
||||
qMakePair(progress, QVariant()),
|
||||
animationValueLessThan);
|
||||
QVariantAnimation::KeyValues::const_iterator it = std::lower_bound(keyValues.constBegin(),
|
||||
keyValues.constEnd(),
|
||||
qMakePair(progress, QVariant()),
|
||||
animationValueLessThan);
|
||||
if (it == keyValues.constBegin()) {
|
||||
//the item pointed to by it is the start element in the range
|
||||
if (it->first == 0 && keyValues.count() > 1) {
|
||||
@ -321,7 +323,7 @@ void QVariantAnimationPrivate::setValueAt(qreal step, const QVariant &value)
|
||||
|
||||
QVariantAnimation::KeyValue pair(step, value);
|
||||
|
||||
QVariantAnimation::KeyValues::iterator result = qLowerBound(keyValues.begin(), keyValues.end(), pair, animationValueLessThan);
|
||||
QVariantAnimation::KeyValues::iterator result = std::lower_bound(keyValues.begin(), keyValues.end(), pair, animationValueLessThan);
|
||||
if (result == keyValues.end() || result->first != step) {
|
||||
keyValues.insert(result, pair);
|
||||
} else {
|
||||
|
@ -916,7 +916,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
|
||||
|
||||
\snippet code/src_corelib_tools_qmap.cpp 16
|
||||
|
||||
\sa qLowerBound(), upperBound(), find()
|
||||
\sa upperBound(), find()
|
||||
*/
|
||||
|
||||
/*! \fn QMap::const_iterator QMap::lowerBound(const Key &key) const
|
||||
|
@ -53,6 +53,8 @@
|
||||
#include "qdbusabstractadaptor_p.h"
|
||||
#include "qdbusmetatype_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef QT_NO_DBUS
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -222,8 +224,8 @@ void QDBusAdaptorConnector::addAdaptor(QDBusAbstractAdaptor *adaptor)
|
||||
if (*mci.value()) {
|
||||
// find out if this interface exists first
|
||||
const char *interface = mci.value();
|
||||
AdaptorMap::Iterator it = qLowerBound(adaptors.begin(), adaptors.end(),
|
||||
QByteArray(interface));
|
||||
AdaptorMap::Iterator it = std::lower_bound(adaptors.begin(), adaptors.end(),
|
||||
QByteArray(interface));
|
||||
if (it != adaptors.end() && qstrcmp(interface, it->interface) == 0) {
|
||||
// exists. Replace it (though it's probably the same)
|
||||
if (it->adaptor != adaptor) {
|
||||
|
@ -56,6 +56,8 @@
|
||||
|
||||
#include "qdbusthreaddebug_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef QT_NO_DBUS
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -829,7 +831,7 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
|
||||
|
||||
// find the position where we'd insert the node
|
||||
QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it =
|
||||
qLowerBound(node->children.begin(), node->children.end(), pathComponents.at(i));
|
||||
std::lower_bound(node->children.begin(), node->children.end(), pathComponents.at(i));
|
||||
if (it != node->children.end() && it->name == pathComponents.at(i)) {
|
||||
// match: this node exists
|
||||
node = it;
|
||||
@ -902,7 +904,7 @@ void QDBusConnection::unregisterObject(const QString &path, UnregisterMode mode)
|
||||
}
|
||||
|
||||
QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it =
|
||||
qLowerBound(node->children.begin(), node->children.end(), pathComponents.at(i));
|
||||
std::lower_bound(node->children.begin(), node->children.end(), pathComponents.at(i));
|
||||
if (it == node->children.end() || it->name != pathComponents.at(i))
|
||||
break; // node not found
|
||||
|
||||
@ -938,7 +940,7 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
|
||||
return node->obj;
|
||||
|
||||
QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it =
|
||||
qLowerBound(node->children.constBegin(), node->children.constEnd(), pathComponents.at(i));
|
||||
std::lower_bound(node->children.constBegin(), node->children.constEnd(), pathComponents.at(i));
|
||||
if (it == node->children.constEnd() || it->name != pathComponents.at(i))
|
||||
break; // node not found
|
||||
|
||||
|
@ -66,6 +66,8 @@
|
||||
|
||||
#include "qdbusthreaddebug_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef QT_NO_DBUS
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -459,7 +461,7 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root,
|
||||
QStringRef pathComponent(&fullpath, start, end - start);
|
||||
|
||||
QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it =
|
||||
qLowerBound(node->children.constBegin(), node->children.constEnd(), pathComponent);
|
||||
std::lower_bound(node->children.constBegin(), node->children.constEnd(), pathComponent);
|
||||
if (it != node->children.constEnd() && it->name == pathComponent)
|
||||
// match
|
||||
node = it;
|
||||
@ -1419,8 +1421,8 @@ void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMes
|
||||
} else {
|
||||
// check if we have an interface matching the name that was asked:
|
||||
QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
|
||||
it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
|
||||
msg.interface());
|
||||
it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
|
||||
msg.interface());
|
||||
if (it != connector->adaptors.constEnd() && msg.interface() == QLatin1String(it->interface)) {
|
||||
if (!activateCall(it->adaptor, newflags, msg))
|
||||
sendError(msg, QDBusError::UnknownMethod);
|
||||
|
@ -58,6 +58,8 @@
|
||||
#include "qdbusutil_p.h"
|
||||
#include "qdbusvirtualobject.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef QT_NO_DBUS
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -245,8 +247,8 @@ QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node
|
||||
}
|
||||
} else {
|
||||
QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
|
||||
it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
|
||||
interface_name);
|
||||
it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
|
||||
interface_name);
|
||||
if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) {
|
||||
interfaceFound = true;
|
||||
value = it->adaptor->property(property_name);
|
||||
@ -398,8 +400,8 @@ QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node
|
||||
}
|
||||
} else {
|
||||
QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
|
||||
it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
|
||||
interface_name);
|
||||
it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
|
||||
interface_name);
|
||||
if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) {
|
||||
return propertyWriteReply(msg, interface_name, property_name,
|
||||
writeProperty(it->adaptor, property_name, value));
|
||||
@ -496,8 +498,8 @@ QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &n
|
||||
} else {
|
||||
// find the class that implements interface_name
|
||||
QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
|
||||
it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
|
||||
interface_name);
|
||||
it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
|
||||
interface_name);
|
||||
if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) {
|
||||
interfaceFound = true;
|
||||
result = readAllProperties(it->adaptor, QDBusConnection::ExportAllProperties);
|
||||
|
@ -48,6 +48,8 @@
|
||||
#include "qcoreapplication.h"
|
||||
#include <private/qkeymapper_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -419,7 +421,7 @@ bool QShortcutMap::hasShortcutForKeySequence(const QKeySequence &seq) const
|
||||
Q_D(const QShortcutMap);
|
||||
QShortcutEntry entry(seq); // needed for searching
|
||||
QList<QShortcutEntry>::ConstIterator itEnd = d->sequences.constEnd();
|
||||
QList<QShortcutEntry>::ConstIterator it = qLowerBound(d->sequences.constBegin(), itEnd, entry);
|
||||
QList<QShortcutEntry>::ConstIterator it = std::lower_bound(d->sequences.constBegin(), itEnd, entry);
|
||||
|
||||
for (;it != itEnd; ++it) {
|
||||
if (matches(entry.keyseq, (*it).keyseq) == QKeySequence::ExactMatch && (*it).correctContext() && (*it).enabled) {
|
||||
@ -467,7 +469,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e)
|
||||
QShortcutEntry entry(d->newEntries.at(i)); // needed for searching
|
||||
QList<QShortcutEntry>::ConstIterator itEnd = d->sequences.constEnd();
|
||||
QList<QShortcutEntry>::ConstIterator it =
|
||||
qLowerBound(d->sequences.constBegin(), itEnd, entry);
|
||||
std::lower_bound(d->sequences.constBegin(), itEnd, entry);
|
||||
|
||||
int oneKSResult = QKeySequence::NoMatch;
|
||||
int tempRes = QKeySequence::NoMatch;
|
||||
|
@ -61,6 +61,8 @@
|
||||
#include <qbasictimer.h>
|
||||
#include "private/qfunctions_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// #define LAYOUT_DEBUG
|
||||
|
||||
#ifdef LAYOUT_DEBUG
|
||||
@ -534,7 +536,7 @@ QTextFrame::Iterator QTextDocumentLayoutPrivate::frameIteratorForYPosition(QFixe
|
||||
|| y < 0 || y > data(rootFrame)->size.height)
|
||||
return rootFrame->begin();
|
||||
|
||||
QVector<QCheckPoint>::ConstIterator checkPoint = qLowerBound(checkPoints.begin(), checkPoints.end(), y);
|
||||
QVector<QCheckPoint>::ConstIterator checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), y);
|
||||
if (checkPoint == checkPoints.end())
|
||||
return rootFrame->begin();
|
||||
|
||||
@ -706,14 +708,14 @@ QTextDocumentLayoutPrivate::hitTest(QTextTable *table, const QFixedPoint &point,
|
||||
{
|
||||
QTextTableData *td = static_cast<QTextTableData *>(data(table));
|
||||
|
||||
QVector<QFixed>::ConstIterator rowIt = qLowerBound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), point.y);
|
||||
QVector<QFixed>::ConstIterator rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), point.y);
|
||||
if (rowIt == td->rowPositions.constEnd()) {
|
||||
rowIt = td->rowPositions.constEnd() - 1;
|
||||
} else if (rowIt != td->rowPositions.constBegin()) {
|
||||
--rowIt;
|
||||
}
|
||||
|
||||
QVector<QFixed>::ConstIterator colIt = qLowerBound(td->columnPositions.constBegin(), td->columnPositions.constEnd(), point.x);
|
||||
QVector<QFixed>::ConstIterator colIt = std::lower_bound(td->columnPositions.constBegin(), td->columnPositions.constEnd(), point.x);
|
||||
if (colIt == td->columnPositions.constEnd()) {
|
||||
colIt = td->columnPositions.constEnd() - 1;
|
||||
} else if (colIt != td->columnPositions.constBegin()) {
|
||||
@ -1014,7 +1016,7 @@ void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *pain
|
||||
int lastRow = rows;
|
||||
|
||||
if (context.clip.isValid()) {
|
||||
QVector<QFixed>::ConstIterator rowIt = qLowerBound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.top() - off.y()));
|
||||
QVector<QFixed>::ConstIterator rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.top() - off.y()));
|
||||
if (rowIt != td->rowPositions.constEnd() && rowIt != td->rowPositions.constBegin()) {
|
||||
--rowIt;
|
||||
firstRow = rowIt - td->rowPositions.constBegin();
|
||||
@ -1177,7 +1179,7 @@ void QTextDocumentLayoutPrivate::drawFlow(const QPointF &offset, QPainter *paint
|
||||
|
||||
QVector<QCheckPoint>::ConstIterator lastVisibleCheckPoint = checkPoints.end();
|
||||
if (inRootFrame && context.clip.isValid()) {
|
||||
lastVisibleCheckPoint = qLowerBound(checkPoints.begin(), checkPoints.end(), QFixed::fromReal(context.clip.bottom()));
|
||||
lastVisibleCheckPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), QFixed::fromReal(context.clip.bottom()));
|
||||
}
|
||||
|
||||
QTextBlock previousBlock;
|
||||
@ -2190,7 +2192,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
|
||||
bool redoCheckPoints = layoutStruct->fullLayout || checkPoints.isEmpty();
|
||||
|
||||
if (!redoCheckPoints) {
|
||||
QVector<QCheckPoint>::Iterator checkPoint = qLowerBound(checkPoints.begin(), checkPoints.end(), layoutFrom);
|
||||
QVector<QCheckPoint>::Iterator checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), layoutFrom);
|
||||
if (checkPoint != checkPoints.end()) {
|
||||
if (checkPoint != checkPoints.begin())
|
||||
--checkPoint;
|
||||
|
@ -50,6 +50,8 @@
|
||||
#include "qtextengine_p.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// ### DOC: We ought to explain the CONCEPT of objectIndexes if
|
||||
@ -253,7 +255,7 @@ QTextBlockGroup::~QTextBlockGroup()
|
||||
void QTextBlockGroup::blockInserted(const QTextBlock &block)
|
||||
{
|
||||
Q_D(QTextBlockGroup);
|
||||
QTextBlockGroupPrivate::BlockList::Iterator it = qLowerBound(d->blocks.begin(), d->blocks.end(), block);
|
||||
QTextBlockGroupPrivate::BlockList::Iterator it = std::lower_bound(d->blocks.begin(), d->blocks.end(), block);
|
||||
d->blocks.insert(it, block);
|
||||
d->markBlocksDirty();
|
||||
}
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "qvarlengtharray.h"
|
||||
#include "private/qfunctions_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -407,7 +408,7 @@ void QTextTablePrivate::fragmentAdded(QChar type, uint fragment)
|
||||
Q_ASSERT(cells.indexOf(fragment) == -1);
|
||||
const uint pos = pieceTable->fragmentMap().position(fragment);
|
||||
QFragmentFindHelper helper(pos, pieceTable->fragmentMap());
|
||||
QList<int>::Iterator it = qLowerBound(cells.begin(), cells.end(), helper);
|
||||
QList<int>::Iterator it = std::lower_bound(cells.begin(), cells.end(), helper);
|
||||
cells.insert(it, fragment);
|
||||
if (!fragment_start || pos < pieceTable->fragmentMap().position(fragment_start))
|
||||
fragment_start = fragment;
|
||||
@ -617,7 +618,7 @@ QTextTableCell QTextTable::cellAt(int position) const
|
||||
return QTextTableCell();
|
||||
|
||||
QFragmentFindHelper helper(position, map);
|
||||
QList<int>::ConstIterator it = qLowerBound(d->cells.begin(), d->cells.end(), helper);
|
||||
QList<int>::ConstIterator it = std::lower_bound(d->cells.begin(), d->cells.end(), helper);
|
||||
if (it != d->cells.begin())
|
||||
--it;
|
||||
|
||||
|
@ -49,6 +49,8 @@
|
||||
#include "QtCore/QMutexLocker"
|
||||
#include "QtNetwork/qauthenticator.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
@ -67,7 +69,7 @@ public:
|
||||
|
||||
QNetworkAuthenticationCredential *findClosestMatch(const QString &domain)
|
||||
{
|
||||
iterator it = qLowerBound(begin(), end(), domain);
|
||||
iterator it = std::lower_bound(begin(), end(), domain);
|
||||
if (it == end() && !isEmpty())
|
||||
--it;
|
||||
if (it == end() || !domain.startsWith(it->domain))
|
||||
|
@ -47,6 +47,8 @@
|
||||
#include <private/qwidgetitemdata_p.h>
|
||||
#include <private/qlistwidget_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// workaround for VC++ 6.0 linker bug (?)
|
||||
@ -401,8 +403,8 @@ QList<QListWidgetItem*>::iterator QListModel::sortedInsertionIterator(
|
||||
Qt::SortOrder order, QListWidgetItem *item)
|
||||
{
|
||||
if (order == Qt::AscendingOrder)
|
||||
return qLowerBound(begin, end, item, QListModelLessThan());
|
||||
return qLowerBound(begin, end, item, QListModelGreaterThan());
|
||||
return std::lower_bound(begin, end, item, QListModelLessThan());
|
||||
return std::lower_bound(begin, end, item, QListModelGreaterThan());
|
||||
}
|
||||
|
||||
void QListModel::itemChanged(QListWidgetItem *item)
|
||||
|
@ -46,6 +46,8 @@
|
||||
#include <qpainter.h>
|
||||
#include <private/qtablewidget_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QTableModel::QTableModel(int rows, int columns, QTableWidget *parent)
|
||||
@ -671,8 +673,8 @@ QVector<QTableWidgetItem*>::iterator QTableModel::sortedInsertionIterator(
|
||||
Qt::SortOrder order, QTableWidgetItem *item)
|
||||
{
|
||||
if (order == Qt::AscendingOrder)
|
||||
return qLowerBound(begin, end, item, QTableModelLessThan());
|
||||
return qLowerBound(begin, end, item, QTableModelGreaterThan());
|
||||
return std::lower_bound(begin, end, item, QTableModelLessThan());
|
||||
return std::lower_bound(begin, end, item, QTableModelGreaterThan());
|
||||
}
|
||||
|
||||
bool QTableModel::itemLessThan(const QPair<QTableWidgetItem*,int> &left,
|
||||
|
@ -51,6 +51,8 @@
|
||||
#include <private/qwidgetitemdata_p.h>
|
||||
#include <private/qtreewidgetitemiterator_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// workaround for VC++ 6.0 linker bug (?)
|
||||
@ -709,8 +711,8 @@ QList<QTreeWidgetItem*>::iterator QTreeModel::sortedInsertionIterator(
|
||||
Qt::SortOrder order, QTreeWidgetItem *item)
|
||||
{
|
||||
if (order == Qt::AscendingOrder)
|
||||
return qLowerBound(begin, end, item, QTreeModelLessThan());
|
||||
return qLowerBound(begin, end, item, QTreeModelGreaterThan());
|
||||
return std::lower_bound(begin, end, item, QTreeModelLessThan());
|
||||
return std::lower_bound(begin, end, item, QTreeModelGreaterThan());
|
||||
}
|
||||
|
||||
QStringList QTreeModel::mimeTypes() const
|
||||
|
@ -94,6 +94,8 @@
|
||||
#define ACCEL_KEY(k) QString()
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// could go into QTextCursor...
|
||||
@ -1422,8 +1424,8 @@ static QRectF boundingRectOfFloatsInSelection(const QTextCursor &cursor)
|
||||
QTextFrame *frame = cursor.currentFrame();
|
||||
const QList<QTextFrame *> children = frame->childFrames();
|
||||
|
||||
const QList<QTextFrame *>::ConstIterator firstFrame = qLowerBound(children.constBegin(), children.constEnd(),
|
||||
cursor.selectionStart(), firstFramePosLessThanCursorPos);
|
||||
const QList<QTextFrame *>::ConstIterator firstFrame = std::lower_bound(children.constBegin(), children.constEnd(),
|
||||
cursor.selectionStart(), firstFramePosLessThanCursorPos);
|
||||
const QList<QTextFrame *>::ConstIterator lastFrame = qUpperBound(children.constBegin(), children.constEnd(),
|
||||
cursor.selectionEnd(), cursorPosLessThanLastFramePos);
|
||||
for (QList<QTextFrame *>::ConstIterator it = firstFrame; it != lastFrame; ++it) {
|
||||
|
Loading…
Reference in New Issue
Block a user