summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qscopedpointer.h
diff options
context:
space:
mode:
authorHarald Fernengel <harald.fernengel@nokia.com>2009-11-09 17:52:57 +0100
committerHarald Fernengel <harald.fernengel@nokia.com>2009-11-09 17:52:57 +0100
commit19f8781c17019048693ec32833af49ce00be4c72 (patch)
tree15110b5f6238382b899e52f70d61721560982d2b /src/corelib/tools/qscopedpointer.h
parentaf0c43f19218996bab844da4dd6f298d405ebcee (diff)
Move QCustomScopedPointer to a private header
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 <joao@abecasis.name>
Diffstat (limited to 'src/corelib/tools/qscopedpointer.h')
-rw-r--r--src/corelib/tools/qscopedpointer.h84
1 files changed, 0 insertions, 84 deletions
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 <typename T, typename Cleanup = QScopedPointerDeleter<T> >
-class QCustomScopedPointer : public QScopedPointer<T, Cleanup>
-{
-public:
- explicit inline QCustomScopedPointer(T *p = 0)
- : QScopedPointer<T, Cleanup>(p)
- {
- }
-
- inline T *&data_ptr()
- {
- return this->d;
- }
-
- inline bool operator==(const QCustomScopedPointer<T, Cleanup> &other) const
- {
- return this->d == other.d;
- }
-
- inline bool operator!=(const QCustomScopedPointer<T, Cleanup> &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 <typename T>
-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 <typename T>
-class QScopedSharedPointer : public QCustomScopedPointer<T, QScopedPointerSharedDeleter<T> >
-{
-public:
- explicit inline QScopedSharedPointer(T *p = 0)
- : QCustomScopedPointer<T, QScopedPointerSharedDeleter<T> >(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<T>::cleanup(oldD);
- }
-
- inline bool operator==(const QScopedSharedPointer<T> &other) const
- {
- return this->d == other.d;
- }
-
- inline bool operator!=(const QScopedSharedPointer<T> &other) const
- {
- return this->d != other.d;
- }
-
-private:
- Q_DISABLE_COPY(QScopedSharedPointer)
-};
-
QT_END_NAMESPACE
QT_END_HEADER