diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qarraydata.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.h | 20 | ||||
-rw-r--r-- | src/corelib/tools/qbytearraylist.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qcollator.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qeasingcurve.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qeasingcurve.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qhash.h | 8 | ||||
-rw-r--r-- | src/corelib/tools/qlinkedlist.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qlist.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.h | 32 | ||||
-rw-r--r-- | src/corelib/tools/qmap.h | 46 | ||||
-rw-r--r-- | src/corelib/tools/qringbuffer_p.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qscopedpointer.h | 12 | ||||
-rw-r--r-- | src/corelib/tools/qshareddata.h | 12 | ||||
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 38 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 6 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 48 | ||||
-rw-r--r-- | src/corelib/tools/qtextboundaryfinder.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qtimeline.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qversionnumber.h | 2 |
21 files changed, 126 insertions, 126 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index 88f0cfb0ea..f0cc56e899 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -139,7 +139,7 @@ struct QTypedArrayData typedef T *pointer; typedef T &reference; - inline iterator() : i(Q_NULLPTR) {} + inline iterator() : i(nullptr) {} inline iterator(T *n) : i(n) {} inline iterator(const iterator &o): i(o.i){} // #### Qt 6: remove, the implicit version is fine inline T &operator*() const { return *i; } @@ -173,7 +173,7 @@ struct QTypedArrayData typedef const T *pointer; typedef const T &reference; - inline const_iterator() : i(Q_NULLPTR) {} + inline const_iterator() : i(nullptr) {} inline const_iterator(const T *n) : i(n) {} inline const_iterator(const const_iterator &o): i(o.i) {} // #### Qt 6: remove, the default version is fine inline explicit const_iterator(const iterator &o): i(o.i) {} diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 9a600ca366..38c1820685 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -340,16 +340,16 @@ public: inline QT_ASCII_CAST_WARN bool operator>=(const QString &s2) const; #endif - short toShort(bool *ok = Q_NULLPTR, int base = 10) const; - ushort toUShort(bool *ok = Q_NULLPTR, int base = 10) const; - int toInt(bool *ok = Q_NULLPTR, int base = 10) const; - uint toUInt(bool *ok = Q_NULLPTR, int base = 10) const; - long toLong(bool *ok = Q_NULLPTR, int base = 10) const; - ulong toULong(bool *ok = Q_NULLPTR, int base = 10) const; - qlonglong toLongLong(bool *ok = Q_NULLPTR, int base = 10) const; - qulonglong toULongLong(bool *ok = Q_NULLPTR, int base = 10) const; - float toFloat(bool *ok = Q_NULLPTR) const; - double toDouble(bool *ok = Q_NULLPTR) const; + short toShort(bool *ok = nullptr, int base = 10) const; + ushort toUShort(bool *ok = nullptr, int base = 10) const; + int toInt(bool *ok = nullptr, int base = 10) const; + uint toUInt(bool *ok = nullptr, int base = 10) const; + long toLong(bool *ok = nullptr, int base = 10) const; + ulong toULong(bool *ok = nullptr, int base = 10) const; + qlonglong toLongLong(bool *ok = nullptr, int base = 10) const; + qulonglong toULongLong(bool *ok = nullptr, int base = 10) const; + float toFloat(bool *ok = nullptr) const; + double toDouble(bool *ok = nullptr) const; QByteArray toBase64(Base64Options options) const; QByteArray toBase64() const; // ### Qt6 merge with previous QByteArray toHex() const; diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h index 501bb2e0d5..ed014dd157 100644 --- a/src/corelib/tools/qbytearraylist.h +++ b/src/corelib/tools/qbytearraylist.h @@ -70,7 +70,7 @@ protected: #endif public: inline QByteArray join() const - { return QtPrivate::QByteArrayList_join(self(), Q_NULLPTR, 0); } + { return QtPrivate::QByteArrayList_join(self(), nullptr, 0); } inline QByteArray join(const QByteArray &sep) const { return QtPrivate::QByteArrayList_join(self(), sep.constData(), sep.size()); } inline QByteArray join(char sep) const diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index d81c7c85e3..6fa199cb0f 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -89,7 +89,7 @@ public: QCollator &operator=(const QCollator &); #ifdef Q_COMPILER_RVALUE_REFS QCollator(QCollator &&other) Q_DECL_NOTHROW - : d(other.d) { other.d = Q_NULLPTR; } + : d(other.d) { other.d = nullptr; } QCollator &operator=(QCollator &&other) Q_DECL_NOTHROW { swap(other); return *this; } #endif diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index adab47fc1f..a390bce95f 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -79,7 +79,7 @@ public: int dayOfYear() const; int daysInMonth() const; int daysInYear() const; - int weekNumber(int *yearNum = Q_NULLPTR) const; + int weekNumber(int *yearNum = nullptr) const; #if QT_DEPRECATED_SINCE(5, 11) && !defined QT_NO_TEXTDATE QT_DEPRECATED_X("Use QLocale::monthName or QLocale::standaloneMonthName") diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 1098d7e24c..0b8fa4ca74 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1488,7 +1488,7 @@ QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) bool hasConfig; stream >> hasConfig; delete easing.d_ptr->config; - easing.d_ptr->config = Q_NULLPTR; + easing.d_ptr->config = nullptr; if (hasConfig) { QEasingCurveFunction *config = curveToFunctionObject(type); stream >> config->_p; diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h index ba06de8f9e..74bde5825a 100644 --- a/src/corelib/tools/qeasingcurve.h +++ b/src/corelib/tools/qeasingcurve.h @@ -81,7 +81,7 @@ public: QEasingCurve &operator=(const QEasingCurve &other) { if ( this != &other ) { QEasingCurve copy(other); swap(copy); } return *this; } #ifdef Q_COMPILER_RVALUE_REFS - QEasingCurve(QEasingCurve &&other) Q_DECL_NOTHROW : d_ptr(other.d_ptr) { other.d_ptr = Q_NULLPTR; } + QEasingCurve(QEasingCurve &&other) Q_DECL_NOTHROW : d_ptr(other.d_ptr) { other.d_ptr = nullptr; } QEasingCurve &operator=(QEasingCurve &&other) Q_DECL_NOTHROW { qSwap(d_ptr, other.d_ptr); return *this; } #endif diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 715acc77ce..e7ce4b658f 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -315,7 +315,7 @@ public: typedef T *pointer; typedef T &reference; - inline iterator() : i(Q_NULLPTR) { } + inline iterator() : i(nullptr) { } explicit inline iterator(void *node) : i(reinterpret_cast<QHashData::Node *>(node)) { } inline const Key &key() const { return concrete(i)->key; } @@ -373,7 +373,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) { } explicit inline const_iterator(void *node) : i(reinterpret_cast<QHashData::Node *>(node)) { } #ifdef QT_STRICT_ITERATORS @@ -502,7 +502,7 @@ public: private: void detach_helper(); void freeData(QHashData *d); - Node **findNode(const Key &key, uint *hp = Q_NULLPTR) const; + Node **findNode(const Key &key, uint *hp = nullptr) const; Node **findNode(const Key &key, uint h) const; Node *createNode(uint h, const Key &key, const T &value, Node **nextNode); void deleteNode(Node *node); @@ -550,7 +550,7 @@ template <class Key, class T> Q_INLINE_TEMPLATE void QHash<Key, T>::duplicateNode(QHashData::Node *node, void *newNode) { Node *concreteNode = concrete(node); - new (newNode) Node(concreteNode->key, concreteNode->value, concreteNode->h, Q_NULLPTR); + new (newNode) Node(concreteNode->key, concreteNode->value, concreteNode->h, nullptr); } template <class Key, class T> diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index 9f54ba7825..c8f3f4c8c3 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -134,7 +134,7 @@ public: typedef T *pointer; typedef T &reference; Node *i; - inline iterator() : i(Q_NULLPTR) {} + inline iterator() : i(nullptr) {} inline iterator(Node *n) : i(n) {} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) iterator(const iterator &other) Q_DECL_NOTHROW : i(other.i) {} @@ -171,7 +171,7 @@ public: typedef const T *pointer; typedef const T &reference; Node *i; - inline const_iterator() : i(Q_NULLPTR) {} + inline const_iterator() : i(nullptr) {} inline const_iterator(Node *n) : i(n) {} inline const_iterator(iterator ci) : i(ci.i){} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 1042c29460..af7659e995 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -231,7 +231,7 @@ public: typedef T *pointer; typedef T &reference; - inline iterator() Q_DECL_NOTHROW : i(Q_NULLPTR) {} + inline iterator() Q_DECL_NOTHROW : i(nullptr) {} inline iterator(Node *n) Q_DECL_NOTHROW : i(n) {} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) // can't remove it in Qt 5, since doing so would make the type trivial, @@ -283,7 +283,7 @@ public: typedef const T *pointer; typedef const T &reference; - inline const_iterator() Q_DECL_NOTHROW : i(Q_NULLPTR) {} + inline const_iterator() Q_DECL_NOTHROW : i(nullptr) {} inline const_iterator(Node *n) Q_DECL_NOTHROW : i(n) {} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) // can't remove it in Qt 5, since doing so would make the type trivial, diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index 54b1a32946..ef7a26ea79 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -949,23 +949,23 @@ public: QString nativeCountryName() const; #if QT_STRINGVIEW_LEVEL < 2 - short toShort(const QString &s, bool *ok = Q_NULLPTR) const; - ushort toUShort(const QString &s, bool *ok = Q_NULLPTR) const; - int toInt(const QString &s, bool *ok = Q_NULLPTR) const; - uint toUInt(const QString &s, bool *ok = Q_NULLPTR) const; - qlonglong toLongLong(const QString &s, bool *ok = Q_NULLPTR) const; - qulonglong toULongLong(const QString &s, bool *ok = Q_NULLPTR) const; - float toFloat(const QString &s, bool *ok = Q_NULLPTR) const; - double toDouble(const QString &s, bool *ok = Q_NULLPTR) const; + short toShort(const QString &s, bool *ok = nullptr) const; + ushort toUShort(const QString &s, bool *ok = nullptr) const; + int toInt(const QString &s, bool *ok = nullptr) const; + uint toUInt(const QString &s, bool *ok = nullptr) const; + qlonglong toLongLong(const QString &s, bool *ok = nullptr) const; + qulonglong toULongLong(const QString &s, bool *ok = nullptr) const; + float toFloat(const QString &s, bool *ok = nullptr) const; + double toDouble(const QString &s, bool *ok = nullptr) const; - short toShort(const QStringRef &s, bool *ok = Q_NULLPTR) const; - ushort toUShort(const QStringRef &s, bool *ok = Q_NULLPTR) const; - int toInt(const QStringRef &s, bool *ok = Q_NULLPTR) const; - uint toUInt(const QStringRef &s, bool *ok = Q_NULLPTR) const; - qlonglong toLongLong(const QStringRef &s, bool *ok = Q_NULLPTR) const; - qulonglong toULongLong(const QStringRef &s, bool *ok = Q_NULLPTR) const; - float toFloat(const QStringRef &s, bool *ok = Q_NULLPTR) const; - double toDouble(const QStringRef &s, bool *ok = Q_NULLPTR) const; + short toShort(const QStringRef &s, bool *ok = nullptr) const; + ushort toUShort(const QStringRef &s, bool *ok = nullptr) const; + int toInt(const QStringRef &s, bool *ok = nullptr) const; + uint toUInt(const QStringRef &s, bool *ok = nullptr) const; + qlonglong toLongLong(const QStringRef &s, bool *ok = nullptr) const; + qulonglong toULongLong(const QStringRef &s, bool *ok = nullptr) const; + float toFloat(const QStringRef &s, bool *ok = nullptr) const; + double toDouble(const QStringRef &s, bool *ok = nullptr) const; #endif short toShort(QStringView s, bool *ok = nullptr) const; 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); diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index 558a456515..1f3f2d3fb0 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -80,7 +80,7 @@ public: } inline const char *readPointer() const { - return bufferSize == 0 ? Q_NULLPTR : (buffers.first().constData() + head); + return bufferSize == 0 ? nullptr : (buffers.first().constData() + head); } Q_CORE_EXPORT const char *readPointerAtPosition(qint64 pos, qint64 &length) const; diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index eeed3afd83..2a4083466b 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -97,7 +97,7 @@ class QScopedPointer { typedef T *QScopedPointer:: *RestrictedBool; public: - explicit QScopedPointer(T *p = Q_NULLPTR) Q_DECL_NOTHROW : d(p) + explicit QScopedPointer(T *p = nullptr) Q_DECL_NOTHROW : d(p) { } @@ -126,12 +126,12 @@ public: #if defined(Q_QDOC) inline operator bool() const { - return isNull() ? Q_NULLPTR : &QScopedPointer::d; + return isNull() ? nullptr : &QScopedPointer::d; } #else operator RestrictedBool() const Q_DECL_NOTHROW { - return isNull() ? Q_NULLPTR : &QScopedPointer::d; + return isNull() ? nullptr : &QScopedPointer::d; } #endif @@ -150,7 +150,7 @@ public: return !d; } - void reset(T *other = Q_NULLPTR) Q_DECL_NOEXCEPT_EXPR(noexcept(Cleanup::cleanup(std::declval<T *>()))) + void reset(T *other = nullptr) Q_DECL_NOEXCEPT_EXPR(noexcept(Cleanup::cleanup(std::declval<T *>()))) { if (d == other) return; @@ -162,7 +162,7 @@ public: T *take() Q_DECL_NOTHROW { T *oldD = d; - d = Q_NULLPTR; + d = nullptr; return oldD; } @@ -226,7 +226,7 @@ class QScopedArrayPointer : public QScopedPointer<T, Cleanup> template <typename Ptr> using if_same_type = typename std::enable_if<std::is_same<typename std::remove_cv<T>::type, Ptr>::value, bool>::type; public: - inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(Q_NULLPTR) {} + inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(nullptr) {} template <typename D, if_same_type<D> = true> explicit QScopedArrayPointer(D *p) diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index 13b0032605..dbf0907a0f 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -85,7 +85,7 @@ public: inline bool operator==(const QSharedDataPointer<T> &other) const { return d == other.d; } inline bool operator!=(const QSharedDataPointer<T> &other) const { return d != other.d; } - inline QSharedDataPointer() { d = Q_NULLPTR; } + inline QSharedDataPointer() { d = nullptr; } inline ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; } explicit QSharedDataPointer(T *data) Q_DECL_NOTHROW; @@ -113,7 +113,7 @@ public: return *this; } #ifdef Q_COMPILER_RVALUE_REFS - QSharedDataPointer(QSharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = Q_NULLPTR; } + QSharedDataPointer(QSharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = nullptr; } inline QSharedDataPointer<T> &operator=(QSharedDataPointer<T> &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif @@ -151,17 +151,17 @@ public: if(d && !d->ref.deref()) delete d; - d = Q_NULLPTR; + d = nullptr; } - inline operator bool () const { return d != Q_NULLPTR; } + inline operator bool () const { return d != nullptr; } inline bool operator==(const QExplicitlySharedDataPointer<T> &other) const { return d == other.d; } inline bool operator!=(const QExplicitlySharedDataPointer<T> &other) const { return d != other.d; } inline bool operator==(const T *ptr) const { return d == ptr; } inline bool operator!=(const T *ptr) const { return d != ptr; } - inline QExplicitlySharedDataPointer() { d = Q_NULLPTR; } + inline QExplicitlySharedDataPointer() { d = nullptr; } inline ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; } explicit QExplicitlySharedDataPointer(T *data) Q_DECL_NOTHROW; @@ -202,7 +202,7 @@ public: return *this; } #ifdef Q_COMPILER_RVALUE_REFS - inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = Q_NULLPTR; } + inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = nullptr; } inline QExplicitlySharedDataPointer<T> &operator=(QExplicitlySharedDataPointer<T> &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 9e1a5c7c62..736049b722 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -305,7 +305,7 @@ public: T *data() const Q_DECL_NOTHROW { return value; } T *get() const Q_DECL_NOTHROW { return value; } bool isNull() const Q_DECL_NOTHROW { return !data(); } - operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? Q_NULLPTR : &QSharedPointer::value; } + operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? nullptr : &QSharedPointer::value; } bool operator !() const Q_DECL_NOTHROW { return isNull(); } T &operator*() const { return *data(); } T *operator->() const Q_DECL_NOTHROW { return data(); } @@ -338,8 +338,8 @@ public: QSharedPointer(QSharedPointer &&other) Q_DECL_NOTHROW : value(other.value), d(other.d) { - other.d = Q_NULLPTR; - other.value = Q_NULLPTR; + other.d = nullptr; + other.value = nullptr; } QSharedPointer &operator=(QSharedPointer &&other) Q_DECL_NOTHROW { @@ -352,8 +352,8 @@ public: QSharedPointer(QSharedPointer<X> &&other) Q_DECL_NOTHROW : value(other.value), d(other.d) { - other.d = Q_NULLPTR; - other.value = Q_NULLPTR; + other.d = nullptr; + other.value = nullptr; } template <class X> @@ -379,7 +379,7 @@ public: } template <class X> - inline QSharedPointer(const QWeakPointer<X> &other) : value(Q_NULLPTR), d(Q_NULLPTR) + inline QSharedPointer(const QWeakPointer<X> &other) : value(nullptr), d(nullptr) { *this = other; } template <class X> @@ -477,7 +477,7 @@ private: inline void internalConstruct(X *ptr, Deleter deleter) { if (!ptr) { - d = Q_NULLPTR; + d = nullptr; return; } @@ -528,14 +528,14 @@ public: o->weakref.ref(); } else { o->checkQObjectShared(actual); - o = Q_NULLPTR; + o = nullptr; } } qSwap(d, o); qSwap(this->value, actual); if (!d || d->strongref.load() == 0) - this->value = Q_NULLPTR; + this->value = nullptr; // dereference saved data deref(o); @@ -560,19 +560,19 @@ public: typedef const value_type &const_reference; typedef qptrdiff difference_type; - bool isNull() const Q_DECL_NOTHROW { return d == Q_NULLPTR || d->strongref.load() == 0 || value == Q_NULLPTR; } - operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? Q_NULLPTR : &QWeakPointer::value; } + bool isNull() const Q_DECL_NOTHROW { return d == nullptr || d->strongref.load() == 0 || value == nullptr; } + operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? nullptr : &QWeakPointer::value; } bool operator !() const Q_DECL_NOTHROW { return isNull(); } - T *data() const Q_DECL_NOTHROW { return d == Q_NULLPTR || d->strongref.load() == 0 ? Q_NULLPTR : value; } + T *data() const Q_DECL_NOTHROW { return d == nullptr || d->strongref.load() == 0 ? nullptr : value; } - inline QWeakPointer() Q_DECL_NOTHROW : d(Q_NULLPTR), value(Q_NULLPTR) { } + inline QWeakPointer() Q_DECL_NOTHROW : d(nullptr), value(nullptr) { } inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; } #ifndef QT_NO_QOBJECT // special constructor that is enabled only if X derives from QObject #if QT_DEPRECATED_SINCE(5, 0) template <class X> - QT_DEPRECATED inline QWeakPointer(X *ptr) : d(ptr ? Data::getAndRef(ptr) : Q_NULLPTR), value(ptr) + QT_DEPRECATED inline QWeakPointer(X *ptr) : d(ptr ? Data::getAndRef(ptr) : nullptr), value(ptr) { } #endif #endif @@ -589,8 +589,8 @@ public: QWeakPointer(QWeakPointer &&other) Q_DECL_NOTHROW : d(other.d), value(other.value) { - other.d = Q_NULLPTR; - other.value = Q_NULLPTR; + other.d = nullptr; + other.value = nullptr; } QWeakPointer &operator=(QWeakPointer &&other) Q_DECL_NOTHROW { QWeakPointer moved(std::move(other)); swap(moved); return *this; } @@ -617,7 +617,7 @@ public: } template <class X> - inline QWeakPointer(const QWeakPointer<X> &o) : d(Q_NULLPTR), value(Q_NULLPTR) + inline QWeakPointer(const QWeakPointer<X> &o) : d(nullptr), value(nullptr) { *this = o; } template <class X> @@ -638,7 +638,7 @@ public: { return !(*this == o); } template <class X> - inline QWeakPointer(const QSharedPointer<X> &o) : d(Q_NULLPTR), value(Q_NULLPTR) + inline QWeakPointer(const QSharedPointer<X> &o) : d(nullptr), value(nullptr) { *this = o; } template <class X> @@ -682,7 +682,7 @@ public: #ifndef QT_NO_QOBJECT template <class X> - inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : Q_NULLPTR), value(ptr) + inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : nullptr), value(ptr) { } #endif diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 3826d7531a..ea157a23d0 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -4007,7 +4007,7 @@ int QString::count(const QRegExp& rx) const */ int QString::indexOf(const QRegularExpression& re, int from) const { - return indexOf(re, from, Q_NULLPTR); + return indexOf(re, from, nullptr); } /*! @@ -4058,7 +4058,7 @@ int QString::indexOf(const QRegularExpression &re, int from, QRegularExpressionM */ int QString::lastIndexOf(const QRegularExpression &re, int from) const { - return lastIndexOf(re, from, Q_NULLPTR); + return lastIndexOf(re, from, nullptr); } /*! @@ -4110,7 +4110,7 @@ int QString::lastIndexOf(const QRegularExpression &re, int from, QRegularExpress */ bool QString::contains(const QRegularExpression &re) const { - return contains(re, Q_NULLPTR); + return contains(re, nullptr); } /*! diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 16472ff6b9..1eca773c3e 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -91,7 +91,7 @@ template <typename T> class QVector; class QLatin1String { public: - Q_DECL_CONSTEXPR inline QLatin1String() Q_DECL_NOTHROW : m_size(0), m_data(Q_NULLPTR) {} + Q_DECL_CONSTEXPR inline QLatin1String() Q_DECL_NOTHROW : m_size(0), m_data(nullptr) {} Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s) Q_DECL_NOTHROW : m_size(s ? int(strlen(s)) : 0), m_data(s) {} Q_DECL_CONSTEXPR explicit QLatin1String(const char *f, const char *l) : QLatin1String(f, int(l - f)) {} @@ -624,16 +624,16 @@ public: static int localeAwareCompare(const QString& s1, const QStringRef& s2); // ### Qt6: make inline except for the long long versions - short toShort(bool *ok=Q_NULLPTR, int base=10) const; - ushort toUShort(bool *ok=Q_NULLPTR, int base=10) const; - int toInt(bool *ok=Q_NULLPTR, int base=10) const; - uint toUInt(bool *ok=Q_NULLPTR, int base=10) const; - long toLong(bool *ok=Q_NULLPTR, int base=10) const; - ulong toULong(bool *ok=Q_NULLPTR, int base=10) const; - qlonglong toLongLong(bool *ok=Q_NULLPTR, int base=10) const; - qulonglong toULongLong(bool *ok=Q_NULLPTR, int base=10) const; - float toFloat(bool *ok=Q_NULLPTR) const; - double toDouble(bool *ok=Q_NULLPTR) const; + short toShort(bool *ok=nullptr, int base=10) const; + ushort toUShort(bool *ok=nullptr, int base=10) const; + int toInt(bool *ok=nullptr, int base=10) const; + uint toUInt(bool *ok=nullptr, int base=10) const; + long toLong(bool *ok=nullptr, int base=10) const; + ulong toULong(bool *ok=nullptr, int base=10) const; + qlonglong toLongLong(bool *ok=nullptr, int base=10) const; + qulonglong toULongLong(bool *ok=nullptr, int base=10) const; + float toFloat(bool *ok=nullptr) const; + double toDouble(bool *ok=nullptr) const; QString &setNum(short, int base=10); QString &setNum(ushort, int base=10); @@ -1417,7 +1417,7 @@ public: typedef QString::const_reference const_reference; // ### Qt 6: make this constructor constexpr, after the destructor is made trivial - inline QStringRef() : m_string(Q_NULLPTR), m_position(0), m_size(0) {} + inline QStringRef() : m_string(nullptr), m_position(0), m_size(0) {} inline QStringRef(const QString *string, int position, int size); inline QStringRef(const QString *string); @@ -1533,10 +1533,10 @@ public: Q_REQUIRED_RESULT QByteArray toLocal8Bit() const; Q_REQUIRED_RESULT QVector<uint> toUcs4() const; - inline void clear() { m_string = Q_NULLPTR; m_position = m_size = 0; } + inline void clear() { m_string = nullptr; m_position = m_size = 0; } QString toString() const; inline bool isEmpty() const { return m_size == 0; } - inline bool isNull() const { return m_string == Q_NULLPTR || m_string->isNull(); } + inline bool isNull() const { return m_string == nullptr || m_string->isNull(); } QStringRef appendTo(QString *string) const; @@ -1576,16 +1576,16 @@ public: static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2); Q_REQUIRED_RESULT QStringRef trimmed() const; - short toShort(bool *ok = Q_NULLPTR, int base = 10) const; - ushort toUShort(bool *ok = Q_NULLPTR, int base = 10) const; - int toInt(bool *ok = Q_NULLPTR, int base = 10) const; - uint toUInt(bool *ok = Q_NULLPTR, int base = 10) const; - long toLong(bool *ok = Q_NULLPTR, int base = 10) const; - ulong toULong(bool *ok = Q_NULLPTR, int base = 10) const; - qlonglong toLongLong(bool *ok = Q_NULLPTR, int base = 10) const; - qulonglong toULongLong(bool *ok = Q_NULLPTR, int base = 10) const; - float toFloat(bool *ok = Q_NULLPTR) const; - double toDouble(bool *ok = Q_NULLPTR) const; + short toShort(bool *ok = nullptr, int base = 10) const; + ushort toUShort(bool *ok = nullptr, int base = 10) const; + int toInt(bool *ok = nullptr, int base = 10) const; + uint toUInt(bool *ok = nullptr, int base = 10) const; + long toLong(bool *ok = nullptr, int base = 10) const; + ulong toULong(bool *ok = nullptr, int base = 10) const; + qlonglong toLongLong(bool *ok = nullptr, int base = 10) const; + qulonglong toULongLong(bool *ok = nullptr, int base = 10) const; + float toFloat(bool *ok = nullptr) const; + double toDouble(bool *ok = nullptr) const; }; Q_DECLARE_TYPEINFO(QStringRef, Q_PRIMITIVE_TYPE); diff --git a/src/corelib/tools/qtextboundaryfinder.h b/src/corelib/tools/qtextboundaryfinder.h index d021df3f2c..b1e5008f54 100644 --- a/src/corelib/tools/qtextboundaryfinder.h +++ b/src/corelib/tools/qtextboundaryfinder.h @@ -74,7 +74,7 @@ public: Q_DECLARE_FLAGS( BoundaryReasons, BoundaryReason ) QTextBoundaryFinder(BoundaryType type, const QString &string); - QTextBoundaryFinder(BoundaryType type, const QChar *chars, int length, unsigned char *buffer = Q_NULLPTR, int bufferSize = 0); + QTextBoundaryFinder(BoundaryType type, const QChar *chars, int length, unsigned char *buffer = nullptr, int bufferSize = 0); inline bool isValid() const { return d; } diff --git a/src/corelib/tools/qtimeline.h b/src/corelib/tools/qtimeline.h index 4cba49e185..d9982bdb58 100644 --- a/src/corelib/tools/qtimeline.h +++ b/src/corelib/tools/qtimeline.h @@ -76,7 +76,7 @@ public: CosineCurve }; - explicit QTimeLine(int duration = 1000, QObject *parent = Q_NULLPTR); + explicit QTimeLine(int duration = 1000, QObject *parent = nullptr); virtual ~QTimeLine(); State state() const; diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h index 3836bc2119..1bfb4aab39 100644 --- a/src/corelib/tools/qversionnumber.h +++ b/src/corelib/tools/qversionnumber.h @@ -281,7 +281,7 @@ public: Q_REQUIRED_RESULT Q_CORE_EXPORT QString toString() const; #if QT_STRINGVIEW_LEVEL < 2 - Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = Q_NULLPTR); + Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = nullptr); #endif Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QLatin1String string, int *suffixIndex = nullptr); Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QStringView string, int *suffixIndex = nullptr); |