class KStaticDeleter

# class KStaticDeleter | Little helper class to clean up static objects that are held as pointer. More...
Definition | `#include <kstaticdeleter.h>`
Template form | KStaticDeleter<class type>
Inherits | KStaticDeleterBase [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KStaticDeleter ()
- type * setObject ( type *obj, bool isArray = false)
- type * setObject ( type* & globalRef, type *obj, bool isArray = false)
- virtual void destructObject ()
- virtual ~KStaticDeleter ()

## Detailed Description

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 unregistered.

Parameters:

isArray | tells the destructor to delete an array instead of an object

type * 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 unregistered.

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]

Destructs the object. This has the same effect as deleting the KStaticDeleter.

Reimplemented from KStaticDeleterBase.

~KStaticDeleter () | ### ~KStaticDeleter

[virtual]

Generated by: root on macppc.ports.openbsd.org on Sat Sep 6 10:36:15 2003, using kdoc 2.0a54.