KDECore
Go to the documentation of this file.
30#include <QtCore/QExplicitlySharedDataPointer>
31#include <QtCore/QAtomicPointer>
77 :
d(p) {
if(
d)
d->ref.ref(); }
84 :
d(o.
d) {
if(
d)
d->ref.ref(); }
106 inline operator bool()
const {
return (
d != 0 ); }
116 inline const T*
data()
const {
return d; }
144 inline int count()
const {
return d ?
static_cast<int>(
d->ref) : 0; }
151 inline bool isNull()
const {
return (
d == 0); }
213 if (d && !d->ref.deref())
222 attach(
static_cast<T*
>(0));
Can be used to control the lifetime of an object that has derived QSharedData.
KSharedPtr()
Creates a null pointer.
const T * constData() const
KSharedPtr(const KSharedPtr &o)
Copies a pointer.
const T & operator*() const
void clear()
Clear the pointer, i.e.
static KSharedPtr< T > staticCast(const KSharedPtr< U > &o)
Convert KSharedPtr to KSharedPtr<T>, using a static_cast.
KSharedPtr(T *p)
Creates a new pointer.
static KSharedPtr< T > dynamicCast(const KSharedPtr< U > &o)
Convert KSharedPtr to KSharedPtr<T>, using a dynamic_cast.
const T * operator->() const
bool isNull() const
Test if the shared pointer is null.
~KSharedPtr()
Unreferences the object that this pointer points to.
void attach(T *p)
Attach the given pointer to the current KSharedPtr.
int count() const
Returns the number of references.
bool operator==(const KEntry &k1, const KEntry &k2)
bool operator<(const KEntryKey &k1, const KEntryKey &k2)
Compares two KEntryKeys (needed for QMap).
bool operator!=(const KEntry &k1, const KEntry &k2)
Q_INLINE_TEMPLATE bool operator==(const T *p, const KSharedPtr< T > &o)
Q_INLINE_TEMPLATE bool operator!=(const T *p, const KSharedPtr< T > &o)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by
doxygen 1.9.6 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.