From 19f8781c17019048693ec32833af49ce00be4c72 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Mon, 9 Nov 2009 17:52:57 +0100 Subject: Move QCustomScopedPointer to a private header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API is internal, so it should live in its private header. The class was introduced during the lifetime of 4.6 (not in 4.5), so the move is binary compatible. Task-number: QTBUG-5617 Reviewed-by: João Abecasis --- src/corelib/tools/qscopedpointer.h | 84 -------------------------------------- 1 file changed, 84 deletions(-) (limited to 'src/corelib/tools/qscopedpointer.h') diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index 7cbdb6c38d..2dedcc5a03 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -217,90 +217,6 @@ private: Q_DISABLE_COPY(QScopedArrayPointer) }; -/* Internal helper class - exposes the data through data_ptr (legacy from QShared). - Required for some internal Qt classes, do not use otherwise. */ -template > -class QCustomScopedPointer : public QScopedPointer -{ -public: - explicit inline QCustomScopedPointer(T *p = 0) - : QScopedPointer(p) - { - } - - inline T *&data_ptr() - { - return this->d; - } - - inline bool operator==(const QCustomScopedPointer &other) const - { - return this->d == other.d; - } - - inline bool operator!=(const QCustomScopedPointer &other) const - { - return this->d != other.d; - } - -private: - Q_DISABLE_COPY(QCustomScopedPointer) -}; - -/* Internal helper class - a handler for QShared* classes, to be used in QCustomScopedPointer */ -template -class QScopedPointerSharedDeleter -{ -public: - static inline void cleanup(T *d) - { - if (d && !d->ref.deref()) - delete d; - } -}; - -/* Internal. - This class is basically a scoped pointer pointing to a ref-counted object - */ -template -class QScopedSharedPointer : public QCustomScopedPointer > -{ -public: - explicit inline QScopedSharedPointer(T *p = 0) - : QCustomScopedPointer >(p) - { - } - - inline void detach() - { - qAtomicDetach(this->d); - } - - inline void assign(T *other) - { - if (this->d == other) - return; - if (other) - other->ref.ref(); - T *oldD = this->d; - this->d = other; - QScopedPointerSharedDeleter::cleanup(oldD); - } - - inline bool operator==(const QScopedSharedPointer &other) const - { - return this->d == other.d; - } - - inline bool operator!=(const QScopedSharedPointer &other) const - { - return this->d != other.d; - } - -private: - Q_DISABLE_COPY(QScopedSharedPointer) -}; - QT_END_NAMESPACE QT_END_HEADER -- cgit v1.2.3