.TH "KStaticDeleter" 3 "28 Jan 2004" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KStaticDeleter \- Little helper class to clean up static objects that are held as pointer.  

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

.in +1c
.ti -1c
.RI "type * \fBsetObject\fP (type *obj, bool isArray=false)"
.br
.RI "\fISets the object to delete and registers the object to be deleted to \fBKGlobal\fP. \fP"
.ti -1c
.RI "type * \fBsetObject\fP (type *&globalRef, type *obj, bool isArray=false)"
.br
.RI "\fISets the object to delete and registers the object to be deleted to \fBKGlobal\fP. \fP"
.ti -1c
.RI "virtual void \fBdestructObject\fP ()"
.br
.RI "\fIDestructs the object. \fP"
.in -1c
.SH "Detailed Description"
.PP 

.SS "template<class type> class KStaticDeleter< type >"
Little helper class to clean up static objects that are held as pointer. 

When the library is unloaded, or the app terminated, all static deleters are destroyed, which in turn destroys those static objects properly.
.PP
A typical use is 
.PP
.nf

 static KStaticDeleter<MyClass> sd;
.PP
.PP
.PP
.nf
 MyClass::self() {
   if (!_self) { sd.setObject(_self, new MyClass()); }
 }
 
.PP
 
.PP
Definition at line 65 of file kstaticdeleter.h.
.SH "Member Function Documentation"
.PP 
.SS "template<class type> type* \fBKStaticDeleter\fP< type >::setObject (type * obj, bool isArray = false)\fC [inline]\fP"
.PP
Sets the object to delete and registers the object to be deleted to \fBKGlobal\fP. If the given object is 0, the former registration is unregistered. 
.PP
\fBParameters:\fP
.RS 4
\fIisArray\fP tells the destructor to delete an array instead of an object \fBThis class or method is obsolete, it is provided for compatibility only.\fP See the other setObject variant. 
.RE
.PP
Definition at line 75 of file kstaticdeleter.h.
.PP
References KGlobal::registerStaticDeleter(), and KGlobal::unregisterStaticDeleter().
.SS "template<class type> type* \fBKStaticDeleter\fP< type >::setObject (type *& globalRef, type * obj, bool isArray = false)\fC [inline]\fP"
.PP
Sets the object to delete and registers the object to be deleted to \fBKGlobal\fP. If the given object is 0, the former registration is unregistered. 
.PP
\fBParameters:\fP
.RS 4
\fIglobalRef\fP the static pointer where this object is stored This pointer will be reset to 0 after deletion of the object. 
.br
\fIisArray\fP tells the destructor to delete an array instead of an object 
.RE
.PP
Definition at line 93 of file kstaticdeleter.h.
.PP
References KGlobal::registerStaticDeleter(), and KGlobal::unregisterStaticDeleter().
.SS "template<class type> virtual void \fBKStaticDeleter\fP< type >::destructObject ()\fC [inline, virtual]\fP"
.PP
Destructs the object. This has the same effect as deleting the KStaticDeleter. Reimplemented from \fBKStaticDeleterBase\fP.
.PP
Definition at line 109 of file kstaticdeleter.h.

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