.TH "KSharedPtr" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KSharedPtr \- Can be used to control the lifetime of an object that has derived \fBKShared\fP.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <ksharedptr.h>\fP
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKSharedPtr\fP ()"
.br
.ti -1c
.RI "\fBKSharedPtr\fP (T *t)"
.br
.ti -1c
.RI "\fBKSharedPtr\fP (const \fBKSharedPtr\fP &p)"
.br
.ti -1c
.RI "\fB~KSharedPtr\fP ()"
.br
.ti -1c
.RI "\fBKSharedPtr\fP< T > & \fBoperator=\fP (const \fBKSharedPtr\fP< T > &p)"
.br
.ti -1c
.RI "\fBKSharedPtr\fP< T > & \fBoperator=\fP (T *p)"
.br
.ti -1c
.RI "bool \fBoperator==\fP (const \fBKSharedPtr\fP< T > &p) const "
.br
.ti -1c
.RI "bool \fBoperator!=\fP (const \fBKSharedPtr\fP< T > &p) const "
.br
.ti -1c
.RI "bool \fBoperator==\fP (const T *p) const "
.br
.ti -1c
.RI "bool \fBoperator!=\fP (const T *p) const "
.br
.ti -1c
.RI "bool \fBoperator!\fP () const "
.br
.ti -1c
.RI "\fBoperator T *\fP () const "
.br
.ti -1c
.RI "T * \fBdata\fP ()"
.br
.ti -1c
.RI "const T * \fBdata\fP () const "
.br
.ti -1c
.RI "const T & \fBoperator *\fP () const "
.br
.ti -1c
.RI "T & \fBoperator *\fP ()"
.br
.ti -1c
.RI "const T * \fBoperator->\fP () const "
.br
.ti -1c
.RI "T * \fBoperator->\fP ()"
.br
.ti -1c
.RI "int \fBcount\fP () const "
.br
.in -1c
.SH "Detailed Description"
.PP 

.SS "template<class T> class KSharedPtr< T >"
Can be used to control the lifetime of an object that has derived \fBKShared\fP. 

As long a someone holds a KSharedPtr on some \fBKShared\fP object it won't become deleted but is deleted once its reference count is 0. This struct emulates C++ pointers virtually perfectly. So just use it like a simple C++ pointer.
.PP
\fBKShared\fP and KSharedPtr are preferred over QShared / QSharedPtr since they are more safe.
.PP
WARNING: Please note that this class template provides an implicit conversion to T*. Do *not* change this pointer or the pointee (don't call delete on it, for instance) behind KSharedPtr's back.
.PP
\fBAuthor:\fP
.RS 4
Waldo Bastian <bastian@kde.org> 
.RE
.PP

.PP
Definition at line 100 of file ksharedptr.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "template<class T> \fBKSharedPtr\fP< T >::\fBKSharedPtr\fP ()\fC [inline]\fP"
.PP
Creates a null pointer. 
.PP
Definition at line 106 of file ksharedptr.h.
.SS "template<class T> \fBKSharedPtr\fP< T >::\fBKSharedPtr\fP (T * t)\fC [inline]\fP"
.PP
Creates a new pointer. 
.PP
\fBParameters:\fP
.RS 4
\fIt\fP the pointer 
.RE
.PP

.PP
Definition at line 112 of file ksharedptr.h.
.SS "template<class T> \fBKSharedPtr\fP< T >::\fBKSharedPtr\fP (const \fBKSharedPtr\fP< T > & p)\fC [inline]\fP"
.PP
Copies a pointer. 
.PP
\fBParameters:\fP
.RS 4
\fIp\fP the pointer to copy 
.RE
.PP

.PP
Definition at line 119 of file ksharedptr.h.
.SS "template<class T> \fBKSharedPtr\fP< T >::~\fBKSharedPtr\fP ()\fC [inline]\fP"
.PP
Unreferences the object that this pointer points to. 
.PP
If it was the last reference, the object will be deleted. 
.PP
Definition at line 126 of file ksharedptr.h.
.SH "Member Function Documentation"
.PP 
.SS "template<class T> T* \fBKSharedPtr\fP< T >::data ()\fC [inline]\fP"
.PP
Returns the pointer. 
.PP
\fBReturns:\fP
.RS 4
the pointer 
.RE
.PP

.PP
Definition at line 153 of file ksharedptr.h.
.SS "template<class T> const T* \fBKSharedPtr\fP< T >::data () const\fC [inline]\fP"
.PP
Returns the pointer. 
.PP
\fBReturns:\fP
.RS 4
the pointer 
.RE
.PP

.PP
Definition at line 159 of file ksharedptr.h.
.SS "template<class T> int \fBKSharedPtr\fP< T >::count () const\fC [inline]\fP"
.PP
Returns the number of references. 
.PP
\fBReturns:\fP
.RS 4
the number of references 
.RE
.PP

.PP
Definition at line 170 of file ksharedptr.h.

.SH "Author"
.PP 
Generated automatically by Doxygen for kdecore Library from the source code.
