CopperSpice API
1.9.2
|
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object. More...
Public Typedefs | |
using | pointer = T * |
using | Type = T |
Public Methods | |
QExplicitlySharedDataPointer () | |
QExplicitlySharedDataPointer (const QExplicitlySharedDataPointer< T > &other) | |
template<class X > | |
QExplicitlySharedDataPointer (const QExplicitlySharedDataPointer< X > &other) | |
QExplicitlySharedDataPointer (QExplicitlySharedDataPointer &&other) | |
QExplicitlySharedDataPointer (T *data) | |
~QExplicitlySharedDataPointer () | |
const T * | constData () const |
T * | data () const |
void | detach () |
operator bool () const | |
bool | operator! () const |
bool | operator!= (const QExplicitlySharedDataPointer< T > &other) const |
bool | operator!= (const T *ptr) const |
T & | operator* () const |
T * | operator-> () |
T * | operator-> () const |
QExplicitlySharedDataPointer< T > & | operator= (const QExplicitlySharedDataPointer< T > &other) |
QExplicitlySharedDataPointer< T > & | operator= (QExplicitlySharedDataPointer< T > &&other) |
QExplicitlySharedDataPointer & | operator= (T *other) |
bool | operator== (const QExplicitlySharedDataPointer< T > &other) const |
bool | operator== (const T *ptr) const |
void | reset () |
void | swap (QExplicitlySharedDataPointer &other) |
Protected Methods | |
T * | clone () |
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object.
This class makes writing your own explicitly shared classes easy. QExplicitlySharedDataPointer implements thread-safe reference counting, ensuring that adding QExplicitlySharedDataPointers to your classes will not make them stop being conditionally thread safe.
Except for one major difference, QExplicitlySharedDataPointer is very similar to QSharedDataPointer. The methods in QExplicitlySharedDataPointer do not provide automatic copy on write operations. There is a detach() method available which you will need to call in your code. If you use this class and calling detach() frequently, consider using QSharedDataPointer instead.
QExplicitlySharedDataPointer< T >::pointer |
Equivalent to T *.
QExplicitlySharedDataPointer< T >::Type |
Equivalent to T.
|
inline |
Constructs a QExplicitlySharedDataPointer initialized to a nullptr.
|
inlineexplicit |
Constructs a QExplicitlySharedDataPointer which points to the given data and increments the reference count.
|
inline |
Copy constructs a new QExplicitlySharedDataPointer from other. The reference count of the data is incremented.
|
inline |
Copy constructs a new QExplicitlySharedDataPointer by statically casting other. The reference count of the data is incremented.
|
inline |
Move constructs a new QExplicitlySharedDataPointer from other.
|
inline |
Decrements the reference count of data. If the reference count becomes 0 the data is deleted.
|
inlineprotected |
Creates and returns a deep copy of the current data. This method is called by detach() when the reference count is greater than 1 in order to create the new copy.
|
inline |
Returns a const pointer to the shared data object.
|
inline |
Returns a pointer to the shared data object.
|
inline |
If the data reference count is greater than 1, this method creates a deep copy of the shared data and sets the current QExplicitlySharedDataPointer to point to the copy.
|
inline |
Returns true if data is not a nullptr.
|
inline |
Returns true if data is a nullptr.
|
inline |
Returns true if other and this do not point to the same data.
|
inline |
Returns true if this does not point to the given ptr.
|
inline |
Provides access to the data.
|
inline |
Provides access to the data.
|
inline |
Provides read only access to the data.
|
inline |
Assigns other to the current QSharedDataPointer and increments the reference count. The reference count of the old shared data object is decremented. If the reference count of the old shared data object becomes 0, the old shared data object is deleted.
|
inline |
Move assigns from other and returns a reference to this object.
|
inline |
Sets the current QExplicitlySharedDataPointer to other and increments the reference count. The reference count of the old shared data is decremented. If the reference count of the old shared data object becomes 0, the old shared data object is deleted.
|
inline |
Returns true if this object points to the same object as other.
|
inline |
Returns true if this object points to the same object as ptr.
|
inline |
Resets the current QExplicitlySharedDataPointer to a nullptr. If the reference count becomes 0 the data will be destroyed.
|
inline |
Swap this instance's explicitly shared data pointer with the explicitly shared data pointer in other.