class KStaticDeleter
|
little helper class to clean up static objects that are
held as pointer. More... |
|
|
Public Methods
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.
A typical use is
static KStaticDeleter sd;
MyClass::self() {
if (!_self) { sd.setObject(_self, new MyClass()); }
}
KStaticDeleter ()
| KStaticDeleter |
type * setObject ( type *obj, bool isArray = false)
| setObject |
sets the object to delete and registers the object to be
deleted to KGlobal. if the given object is 0, the former
registration is unregistred
Parameters:
isArray | tells the destructor to delete an array instead of an object
|
void setObject ( type* & globalRef, type *obj, bool isArray = false)
| setObject |
sets the object to delete and registers the object to be
deleted to KGlobal. if the given object is 0, the former
registration is unregistred
Parameters:
globalRef | the static pointer where this object is stored
This pointer will be reset to 0 after deletion of the object.
|
isArray | tells the destructor to delete an array instead of an object
|
void destructObject ()
| destructObject |
[virtual]
Reimplemented from KStaticDeleterBase.
~KStaticDeleter ()
| ~KStaticDeleter |
[virtual]
Generated by: dfaure on kde.faure.org on Thu Jan 17 22:15:01 2002, using kdoc 2.0a53. |