Qt 4.8
|
A template class that reference counts a value. More...
#include <qreferencecountedvalue_p.h>
Public Types | |
typedef QExplicitlySharedDataPointer< ReferenceCountedValue< T > > | Ptr |
Public Functions | |
ReferenceCountedValue (T *const v) | |
~ReferenceCountedValue () | |
Public Functions inherited from QSharedData | |
QSharedData () | |
Constructs a QSharedData object with a reference count of 0. More... | |
QSharedData (const QSharedData &) | |
Constructs a QSharedData object with reference count 0. More... | |
Public Variables | |
T *const | value |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
Private Functions | |
ReferenceCountedValue () | |
Disabled, no implementation provided. More... | |
A template class that reference counts a value.
This class is useful when an instance needs to have ownership semantics as if it was value based. A typical examples is a QObject pointer, which doesn't have a single owner.
This is achieved through storing a copy of the object as a member inside ReferenceCountedValue, which never is copied. It will stay in scope until the last reference to the ReferenceCountedValue instance is removed, and subsequently ReferenceCountedValue is deleted and hence also the contained value. One should use ReferenceCountedValue by passing around copies of Ptr, which is a typedef for the QExplicitlySharedDataPointer smart pointer.
Definition at line 82 of file qreferencecountedvalue_p.h.
typedef QExplicitlySharedDataPointer<ReferenceCountedValue<T> > QPatternist::ReferenceCountedValue< T >::Ptr |
Definition at line 85 of file qreferencecountedvalue_p.h.
|
inline |
Definition at line 87 of file qreferencecountedvalue_p.h.
|
inline |
Definition at line 91 of file qreferencecountedvalue_p.h.
|
inlineprivate |
Disabled, no implementation provided.
T* const QPatternist::ReferenceCountedValue< T >::value |
Definition at line 96 of file qreferencecountedvalue_p.h.
Referenced by QXmlSchemaValidator::messageHandler(), QXmlSchemaPrivate::messageHandler(), QXmlSchemaValidator::networkAccessManager(), QXmlSchemaPrivate::networkAccessManager(), QXmlQueryPrivate::ownerObject(), and QPatternist::ReferenceCountedValue< QNetworkAccessManager >::~ReferenceCountedValue().