diff options
Diffstat (limited to 'src/corelib/tools/qmap.h')
-rw-r--r-- | src/corelib/tools/qmap.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 16442014ff..fc72c6e32c 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -150,7 +150,7 @@ template <class Key, class T> inline QMapNode<Key, T> *QMapNode<Key, T>::lowerBound(const Key &akey) { QMapNode<Key, T> *n = this; - QMapNode<Key, T> *lastNode = Q_NULLPTR; + QMapNode<Key, T> *lastNode = nullptr; while (n) { if (!qMapLessThanKey(n->key, akey)) { lastNode = n; @@ -166,7 +166,7 @@ template <class Key, class T> inline QMapNode<Key, T> *QMapNode<Key, T>::upperBound(const Key &akey) { QMapNode<Key, T> *n = this; - QMapNode<Key, T> *lastNode = Q_NULLPTR; + QMapNode<Key, T> *lastNode = nullptr; while (n) { if (qMapLessThanKey(akey, n->key)) { lastNode = n; @@ -220,7 +220,7 @@ struct QMapData : public QMapDataBase Node *findNode(const Key &akey) const; void nodeRange(const Key &akey, Node **firstNode, Node **lastNode); - Node *createNode(const Key &k, const T &v, Node *parent = Q_NULLPTR, bool left = false) + Node *createNode(const Key &k, const T &v, Node *parent = nullptr, bool left = false) { Node *n = static_cast<Node *>(QMapDataBase::createNode(sizeof(Node), Q_ALIGNOF(Node), parent, left)); @@ -261,13 +261,13 @@ QMapNode<Key, T> *QMapNode<Key, T>::copy(QMapData<Key, T> *d) const n->left = leftNode()->copy(d); n->left->setParent(n); } else { - n->left = Q_NULLPTR; + n->left = nullptr; } if (right) { n->right = rightNode()->copy(d); n->right->setParent(n); } else { - n->right = Q_NULLPTR; + n->right = nullptr; } return n; } @@ -288,7 +288,7 @@ QMapNode<Key, T> *QMapData<Key, T>::findNode(const Key &akey) const if (lb && !qMapLessThanKey(akey, lb->key)) return lb; } - return Q_NULLPTR; + return nullptr; } @@ -304,10 +304,10 @@ void QMapData<Key, T>::nodeRange(const Key &akey, QMapNode<Key, T> **firstNode, } else if (qMapLessThanKey(n->key, akey)) { n = n->rightNode(); } else { - *firstNode = n->leftNode() ? n->leftNode()->lowerBound(akey) : Q_NULLPTR; + *firstNode = n->leftNode() ? n->leftNode()->lowerBound(akey) : nullptr; if (!*firstNode) *firstNode = n; - *lastNode = n->rightNode() ? n->rightNode()->upperBound(akey) : Q_NULLPTR; + *lastNode = n->rightNode() ? n->rightNode()->upperBound(akey) : nullptr; if (!*lastNode) *lastNode = l; return; @@ -416,7 +416,7 @@ public: typedef T *pointer; typedef T &reference; - inline iterator() : i(Q_NULLPTR) { } + inline iterator() : i(nullptr) { } inline iterator(Node *node) : i(node) { } inline const Key &key() const { return i->key; } @@ -473,7 +473,7 @@ public: typedef const T *pointer; typedef const T &reference; - Q_DECL_CONSTEXPR inline const_iterator() : i(Q_NULLPTR) { } + Q_DECL_CONSTEXPR inline const_iterator() : i(nullptr) { } inline const_iterator(const Node *node) : i(node) { } #ifdef QT_STRICT_ITERATORS explicit inline const_iterator(const iterator &o) @@ -695,7 +695,7 @@ Q_INLINE_TEMPLATE int QMap<Key, T>::count(const Key &akey) const template <class Key, class T> Q_INLINE_TEMPLATE bool QMap<Key, T>::contains(const Key &akey) const { - return d->findNode(akey) != Q_NULLPTR; + return d->findNode(akey) != nullptr; } template <class Key, class T> @@ -704,7 +704,7 @@ Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insert(const Key detach(); Node *n = d->root(); Node *y = d->end(); - Node *lastNode = Q_NULLPTR; + Node *lastNode = nullptr; bool left = true; while (n) { y = n; @@ -779,15 +779,15 @@ typename QMap<Key, T>::iterator QMap<Key, T>::insert(const_iterator pos, const K } // we need to insert (not overwrite) - if (prev->right == Q_NULLPTR) { + if (prev->right == nullptr) { Node *z = d->createNode(akey, avalue, prev, false); return iterator(z); } - if (next->left == Q_NULLPTR) { + if (next->left == nullptr) { Node *z = d->createNode(akey, avalue, next, true); return iterator(z); } - Q_ASSERT(false); // We should have prev->right == Q_NULLPTR or next->left == Q_NULLPTR. + Q_ASSERT(false); // We should have prev->right == nullptr or next->left == nullptr. return this->insert(akey, avalue); } } @@ -801,7 +801,7 @@ Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(cons Node* y = d->end(); Node* x = static_cast<Node *>(d->root()); bool left = true; - while (x != Q_NULLPTR) { + while (x != nullptr) { left = !qMapLessThanKey(x->key, akey); y = x; x = left ? x->leftNode() : x->rightNode(); @@ -848,15 +848,15 @@ typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const_iterator pos, co return this->insertMulti(akey, avalue); // ignore hint // Hint is ok - do insert - if (prev->right == Q_NULLPTR) { + if (prev->right == nullptr) { Node *z = d->createNode(akey, avalue, prev, false); return iterator(z); } - if (next->left == Q_NULLPTR) { + if (next->left == nullptr) { Node *z = d->createNode(akey, avalue, next, true); return iterator(z); } - Q_ASSERT(false); // We should have prev->right == Q_NULLPTR or next->left == Q_NULLPTR. + Q_ASSERT(false); // We should have prev->right == nullptr or next->left == nullptr. return this->insertMulti(akey, avalue); } } @@ -1102,7 +1102,7 @@ Q_OUTOFLINE_TEMPLATE QList<T> QMap<Key, T>::values(const Key &akey) const template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::lowerBound(const Key &akey) const { - Node *lb = d->root() ? d->root()->lowerBound(akey) : Q_NULLPTR; + Node *lb = d->root() ? d->root()->lowerBound(akey) : nullptr; if (!lb) lb = d->end(); return const_iterator(lb); @@ -1112,7 +1112,7 @@ template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::lowerBound(const Key &akey) { detach(); - Node *lb = d->root() ? d->root()->lowerBound(akey) : Q_NULLPTR; + Node *lb = d->root() ? d->root()->lowerBound(akey) : nullptr; if (!lb) lb = d->end(); return iterator(lb); @@ -1122,7 +1122,7 @@ template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::upperBound(const Key &akey) const { - Node *ub = d->root() ? d->root()->upperBound(akey) : Q_NULLPTR; + Node *ub = d->root() ? d->root()->upperBound(akey) : nullptr; if (!ub) ub = d->end(); return const_iterator(ub); @@ -1132,7 +1132,7 @@ template <class Key, class T> Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::upperBound(const Key &akey) { detach(); - Node *ub = d->root() ? d->root()->upperBound(akey) : Q_NULLPTR; + Node *ub = d->root() ? d->root()->upperBound(akey) : nullptr; if (!ub) ub = d->end(); return iterator(ub); |