KStaticDeleter< type > Class Template Reference
Little helper class to clean up static objects that are held as pointer. More...
#include <kstaticdeleter.h>
Inheritance diagram for KStaticDeleter< type >:

Public Methods | |
KDE_DEPRECATED type * | setObject (type *obj, bool isArray=false) |
type * | setObject (type *&globalRef, type *obj, bool isArray=false) |
virtual void | destructObject () |
Detailed Description
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.
A typical use is
static KStaticDeleter<MyClass> sd; MyClass &MyClass::self() { if (!_self) { sd.setObject(_self, new MyClass()); } return *_self; }
Definition at line 66 of file kstaticdeleter.h.
Member Function Documentation
|
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.
Definition at line 77 of file kstaticdeleter.h. References KGlobal::registerStaticDeleter(), and KGlobal::unregisterStaticDeleter(). Referenced by KCmdLineArgs::init(), and KCmdLineArgs::loadAppArgs(). |
|
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.
Definition at line 96 of file kstaticdeleter.h. References KGlobal::registerStaticDeleter(), and KGlobal::unregisterStaticDeleter(). |
|
Destructs the object. This has the same effect as deleting the KStaticDeleter. Reimplemented from KStaticDeleterBase. Definition at line 112 of file kstaticdeleter.h. |
The documentation for this class was generated from the following file: