.TH "KSharedPtr" 3 "28 Jan 2004" "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
.RI "\fICreates a null pointer. \fP"
.ti -1c
.RI "\fBKSharedPtr\fP (T *t)"
.br
.RI "\fICreates a new pointer. \fP"
.ti -1c
.RI "\fBKSharedPtr\fP (const  \fBKSharedPtr\fP &p)"
.br
.RI "\fICopies a pointer. \fP"
.ti -1c
.RI "\fB~KSharedPtr\fP ()"
.br
.RI "\fIUnreferences the object that this pointer points to. \fP"
.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
.RI "\fIReturns the pointer. \fP"
.ti -1c
.RI "const  T * \fBdata\fP () const "
.br
.RI "\fIReturns the pointer. \fP"
.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
.RI "\fIReturns the number of references. \fP"
.in -1c
.SH "Detailed Description"
.PP 

.SS "template<class T> struct 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 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
\fBAuthor:\fP
.RS 4
Waldo Bastian <bastian@kde.org> 
.RE
.PP
\fBVersion:\fP
.RS 4
\fBId\fP.RS 4
\fBksharedptr.h\fP,v 1.20 2002/09/08 14:55:42 tjansen Exp 
.RE
.PP
.RE
.PP

.PP
Definition at line 96 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. Definition at line 102 of file ksharedptr.h.
.SS "template<class T> \fBKSharedPtr\fP< T >::\fBKSharedPtr\fP (T * t)\fC [inline]\fP"
.PP
Creates a new pointer. \fBParameters:\fP
.RS 4
\fIthe\fP pointer 
.RE
.PP
Definition at line 108 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. \fBParameters:\fP
.RS 4
\fIthe\fP pointer to copy 
.RE
.PP
Definition at line 115 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. If it was the last reference, the object will be deleted. Definition at line 122 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. \fBReturns:\fP
.RS 4
the pointer 
.RE
.PP
Definition at line 149 of file ksharedptr.h.
.SS "template<class T> const T* \fBKSharedPtr\fP< T >::data () const\fC [inline]\fP"
.PP
Returns the pointer. \fBReturns:\fP
.RS 4
the pointer 
.RE
.PP
Definition at line 155 of file ksharedptr.h.
.SS "template<class T> int \fBKSharedPtr\fP< T >::count () const\fC [inline]\fP"
.PP
Returns the number of references. \fBReturns:\fP
.RS 4
the number of references 
.RE
.PP
Definition at line 166 of file ksharedptr.h.

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