From 58c14c4a7edcecdd9d58b682a9360c83e2274ec5 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Mon, 18 Sep 2017 11:49:52 +0200 Subject: Replace Q_NULLPTR with nullptr where possible Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen Reviewed-by: Lars Knoll Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qsharedpointer_impl.h | 38 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/corelib/tools/qsharedpointer_impl.h') 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 &&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 @@ -379,7 +379,7 @@ public: } template - inline QSharedPointer(const QWeakPointer &other) : value(Q_NULLPTR), d(Q_NULLPTR) + inline QSharedPointer(const QWeakPointer &other) : value(nullptr), d(nullptr) { *this = other; } template @@ -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 - 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 - inline QWeakPointer(const QWeakPointer &o) : d(Q_NULLPTR), value(Q_NULLPTR) + inline QWeakPointer(const QWeakPointer &o) : d(nullptr), value(nullptr) { *this = o; } template @@ -638,7 +638,7 @@ public: { return !(*this == o); } template - inline QWeakPointer(const QSharedPointer &o) : d(Q_NULLPTR), value(Q_NULLPTR) + inline QWeakPointer(const QSharedPointer &o) : d(nullptr), value(nullptr) { *this = o; } template @@ -682,7 +682,7 @@ public: #ifndef QT_NO_QOBJECT template - 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 -- cgit v1.2.3