diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index 819ab005849e5261ff6f7be3b06e0bd20aeb277b..8d478f81f9e90a3359d1522e9c1e5b3233f77af9 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -91,7 +91,7 @@ class QScopedPointer { typedef T *QScopedPointer:: *RestrictedBool; public: - explicit inline QScopedPointer(T *p = 0) : d(p) + explicit inline QScopedPointer(T *p = Q_NULLPTR) : d(p) { } @@ -121,12 +121,12 @@ public: #if defined(Q_QDOC) inline operator bool() const { - return isNull() ? 0 : &QScopedPointer::d; + return isNull() ? Q_NULLPTR : &QScopedPointer::d; } #else inline operator RestrictedBool() const { - return isNull() ? 0 : &QScopedPointer::d; + return isNull() ? Q_NULLPTR : &QScopedPointer::d; } #endif @@ -140,7 +140,7 @@ public: return !d; } - inline void reset(T *other = 0) + inline void reset(T *other = Q_NULLPTR) { if (d == other) return; @@ -152,7 +152,7 @@ public: inline T *take() { T *oldD = d; - d = 0; + d = Q_NULLPTR; return oldD; } @@ -206,10 +206,10 @@ template <typename T, typename Cleanup = QScopedPointerArrayDeleter<T> > class QScopedArrayPointer : public QScopedPointer<T, Cleanup> { public: - inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(0) {} + inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(Q_NULLPTR) {} template <typename D> - explicit inline QScopedArrayPointer(D *p, typename QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = 0) + explicit inline QScopedArrayPointer(D *p, typename QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = Q_NULLPTR) : QScopedPointer<T, Cleanup>(p) { } diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index a9f71c7b57f968b8e4a0d855c8fbd8ce111a863d..6a0900cf3f08177d0bcbf4125a5643760366c771 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -79,7 +79,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 = 0; } + inline QSharedDataPointer() { d = Q_NULLPTR; } inline ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; } explicit QSharedDataPointer(T *data) Q_DECL_NOTHROW; @@ -145,17 +145,17 @@ public: if(d && !d->ref.deref()) delete d; - d = 0; + d = Q_NULLPTR; } - inline operator bool () const { return d != 0; } + inline operator bool () const { return d != Q_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 = 0; } + inline QExplicitlySharedDataPointer() { d = Q_NULLPTR; } inline ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; } explicit QExplicitlySharedDataPointer(T *data) Q_DECL_NOTHROW; diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 3be10d9d878e3ff3bfbbfbfc423998f62d1b4707..ea9036e223d8c050d2dd31c33254e3c7ff5e5a16 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -300,12 +300,12 @@ public: inline T *data() const { return value; } inline bool isNull() const { return !data(); } - inline operator RestrictedBool() const { return isNull() ? 0 : &QSharedPointer::value; } + inline operator RestrictedBool() const { return isNull() ? Q_NULLPTR : &QSharedPointer::value; } inline bool operator !() const { return isNull(); } inline T &operator*() const { return *data(); } inline T *operator->() const { return data(); } - QSharedPointer() : value(0), d(0) { } + QSharedPointer() : value(Q_NULLPTR), d(Q_NULLPTR) { } ~QSharedPointer() { deref(); } inline explicit QSharedPointer(T *ptr) : value(ptr) // noexcept @@ -327,8 +327,8 @@ public: inline QSharedPointer(QSharedPointer &&other) : value(other.value), d(other.d) { - other.d = 0; - other.value = 0; + other.d = Q_NULLPTR; + other.value = Q_NULLPTR; } inline QSharedPointer &operator=(QSharedPointer &&other) { @@ -351,7 +351,7 @@ public: } template <class X> - inline QSharedPointer(const QWeakPointer<X> &other) : value(0), d(0) + inline QSharedPointer(const QWeakPointer<X> &other) : value(Q_NULLPTR), d(Q_NULLPTR) { *this = other; } template <class X> @@ -491,7 +491,7 @@ private: inline void internalConstruct(T *ptr, Deleter deleter) { if (!ptr) { - d = 0; + d = Q_NULLPTR; return; } @@ -554,14 +554,14 @@ public: o->weakref.ref(); } else { o->checkQObjectShared(actual); - o = 0; + o = Q_NULLPTR; } } qSwap(d, o); qSwap(this->value, actual); if (!d || d->strongref.load() == 0) - this->value = 0; + this->value = Q_NULLPTR; // dereference saved data deref(o); @@ -586,19 +586,19 @@ public: typedef const value_type &const_reference; typedef qptrdiff difference_type; - inline bool isNull() const { return d == 0 || d->strongref.load() == 0 || value == 0; } - inline operator RestrictedBool() const { return isNull() ? 0 : &QWeakPointer::value; } + inline bool isNull() const { return d == Q_NULLPTR || d->strongref.load() == 0 || value == Q_NULLPTR; } + inline operator RestrictedBool() const { return isNull() ? Q_NULLPTR : &QWeakPointer::value; } inline bool operator !() const { return isNull(); } - inline T *data() const { return d == 0 || d->strongref.load() == 0 ? 0 : value; } + inline T *data() const { return d == Q_NULLPTR || d->strongref.load() == 0 ? Q_NULLPTR : value; } - inline QWeakPointer() : d(0), value(0) { } + inline QWeakPointer() : d(Q_NULLPTR), value(Q_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) : 0), value(ptr) + QT_DEPRECATED inline QWeakPointer(X *ptr) : d(ptr ? Data::getAndRef(ptr) : Q_NULLPTR), value(ptr) { } #endif #endif @@ -632,7 +632,7 @@ public: } template <class X> - inline QWeakPointer(const QWeakPointer<X> &o) : d(0), value(0) + inline QWeakPointer(const QWeakPointer<X> &o) : d(Q_NULLPTR), value(Q_NULLPTR) { *this = o; } template <class X> @@ -653,7 +653,7 @@ public: { return !(*this == o); } template <class X> - inline QWeakPointer(const QSharedPointer<X> &o) : d(0), value(0) + inline QWeakPointer(const QSharedPointer<X> &o) : d(Q_NULLPTR), value(Q_NULLPTR) { *this = o; } template <class X> @@ -697,7 +697,7 @@ public: #ifndef QT_NO_QOBJECT template <class X> - inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : 0), value(ptr) + inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : Q_NULLPTR), value(ptr) { } #endif