45 #include <QtCore/qglobal.h> 46 #include <QtCore/qatomic.h> 66 QSharedData &operator=(
const QSharedData &);
80 inline operator T *() {
detach();
return d; }
81 inline operator const T *()
const {
return d; }
83 inline const T *
data()
const {
return d; }
100 if (old && !old->ref.deref())
111 if (old && !old->ref.deref())
116 #ifdef Q_COMPILER_RVALUE_REFS 119 {
qSwap(
d, other.d);
return *
this; }
145 inline T *
data()
const {
return d; }
152 if(
d && !
d->ref.deref())
158 inline operator bool ()
const {
return d != 0; }
184 if (old && !old->ref.deref())
195 if (old && !old->ref.deref())
200 #ifdef Q_COMPILER_RVALUE_REFS 203 {
qSwap(
d, other.d);
return *
this; }
222 {
if (
d)
d->ref.ref(); }
258 {
if (
d)
d->ref.ref(); }
286 #endif // QSHAREDDATA_H
QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer< X > &o)
This copy constructor is different in that it allows other to be a different type of explicitly share...
QSharedData()
Constructs a QSharedData object with a reference count of 0.
bool operator!=(const T *ptr) const
Returns true if the d pointer of this is not ptr.
QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer< T > &o)
This standard copy constructor sets the {d pointer} of this to the {d pointer} in other and increment...
#define QT_END_NAMESPACE
This macro expands to.
const T & operator*() const
Provides const access to the shared data object's members.
QSharedDataPointer< T > & operator=(const QSharedDataPointer< T > &o)
Sets the d pointer of this to the d pointer of other and increments the reference count of the shared...
The QAtomicInt class provides platform-independent atomic operations on integers. ...
const T * constData() const
Returns a const pointer to the shared data object.
T Type
This is the type of the shared data object.
void detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
T * data()
Returns a pointer to the shared data object.
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object...
bool operator==(const T *ptr) const
Returns true if the d pointer of this is ptr.
bool operator==(const QExplicitlySharedDataPointer< T > &other) const
Returns true if other and this have the same d pointer.
QExplicitlySharedDataPointer & operator=(T *o)
Sets the d pointer of this to sharedData and increments {sharedData}'s reference count.
const T * data() const
Returns a pointer to the shared data object.
T * operator->() const
Provides const access to the shared data object's members.
QSharedDataPointer(const QSharedDataPointer< T > &o)
Sets the d pointer of this to the d pointer in other and increments the reference count of the shared...
T * data() const
Returns a pointer to the shared data object.
#define QT_BEGIN_NAMESPACE
This macro expands to.
~QSharedDataPointer()
Decrements the reference count of the shared data object.
#define QT_PREPEND_NAMESPACE(name)
This macro qualifies identifier with the full namespace.
bool operator!=(const QExplicitlySharedDataPointer< T > &other) const
Returns true if other and this do not have the same d pointer.
const T * constData() const
Returns a const pointer to the shared data object.
#define Q_INLINE_TEMPLATE
T & operator*()
Provides access to the shared data object's members.
const T * ptr(const T &t)
QExplicitlySharedDataPointer()
Constructs a QExplicitlySharedDataPointer initialized with a null d pointer.
Q_INLINE_TEMPLATE void qSwap(QSharedDataPointer< T > &p1, QSharedDataPointer< T > &p2)
void swap(QExplicitlySharedDataPointer &other)
Swap this instance's explicitly shared data pointer with the explicitly shared data pointer in other...
QExplicitlySharedDataPointer< T > & operator=(const QExplicitlySharedDataPointer< T > &o)
Sets the d pointer of this to the d pointer of other and increments the reference count of the shared...
bool operator==(const QSharedDataPointer< T > &other) const
Returns true if other and this have the same d pointer.
void swap(QSharedDataPointer &other)
Swap this instance's shared data pointer with the shared data pointer in other.
QSharedData(const QSharedData &)
Constructs a QSharedData object with reference count 0.
T * operator->()
Provides access to the shared data object's members.
The QSharedData class is a base class for shared data objects.
bool operator!() const
Returns true if the d pointer of this is null.
QSharedDataPointer()
Constructs a QSharedDataPointer initialized with a null d pointer.
void detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
void reset()
Resets this to be null.
bool operator!=(const QSharedDataPointer< T > &other) const
Returns true if other and this do not have the same d pointer.
~QExplicitlySharedDataPointer()
Decrements the reference count of the shared data object.
T & operator*() const
Provides access to the shared data object's members.
#define Q_OUTOFLINE_TEMPLATE
bool operator!() const
Returns true if the d pointer of this is null.
The QSharedDataPointer class represents a pointer to an implicitly shared object. ...
QSharedDataPointer & operator=(T *o)
Sets the d pointer og this to sharedData and increments {sharedData}'s reference count.
T * operator->()
Provides access to the shared data object's members.
const T * operator->() const
Provides const access to the shared data object's members.
T Type
This is the type of the shared data object.