\section{KStatic\-Deleter$<$ type $>$ Class Template Reference}
\label{classKStaticDeleter}\index{KStaticDeleter@{KStaticDeleter}}
Little helper class to clean up static objects that are held as pointer.  


{\tt \#include $<$kstaticdeleter.h$>$}

Inheritance diagram for KStatic\-Deleter$<$ type $>$:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=79pt]{classKStaticDeleter__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KStatic\-Deleter$<$ type $>$:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=79pt]{classKStaticDeleter__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
type $\ast$ {\bf set\-Object} (type $\ast$obj, bool is\-Array=false)
\begin{CompactList}\small\item\em Sets the object to delete and registers the object to be deleted to {\bf KGlobal}{\rm (p.\,\pageref{classKGlobal})}. \item\end{CompactList}\item 
type $\ast$ {\bf set\-Object} (type $\ast$\&global\-Ref, type $\ast$obj, bool is\-Array=false)
\begin{CompactList}\small\item\em Sets the object to delete and registers the object to be deleted to {\bf KGlobal}{\rm (p.\,\pageref{classKGlobal})}. \item\end{CompactList}\item 
virtual void {\bf destruct\-Object} ()
\begin{CompactList}\small\item\em Destructs the object. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$class type$>$ class KStatic\-Deleter$<$ 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 \small\begin{alltt}
 static KStaticDeleter<MyClass> sd;\end{alltt}\normalsize 


\small\begin{alltt} MyClass::self() \{
   if (!\_self) \{ sd.setObject(\_self, new MyClass()); \}
 \}
 \end{alltt}\normalsize 
 



Definition at line 65 of file kstaticdeleter.h.

\subsection{Member Function Documentation}
\index{KStaticDeleter@{KStatic\-Deleter}!setObject@{setObject}}
\index{setObject@{setObject}!KStaticDeleter@{KStatic\-Deleter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class type$>$ type$\ast$ {\bf KStatic\-Deleter}$<$ type $>$::set\-Object (type $\ast$ {\em obj}, bool {\em is\-Array} = false)\hspace{0.3cm}{\tt  [inline]}}\label{classKStaticDeleter_a1}


Sets the object to delete and registers the object to be deleted to {\bf KGlobal}{\rm (p.\,\pageref{classKGlobal})}. 

If the given object is 0, the former registration is unregistered. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em is\-Array}]tells the destructor to delete an array instead of an object {\bf This class or method is obsolete, it is provided for compatibility only.} See the other set\-Object variant. \end{description}
\end{Desc}


Definition at line 75 of file kstaticdeleter.h.

References KGlobal::register\-Static\-Deleter(), and KGlobal::unregister\-Static\-Deleter().\index{KStaticDeleter@{KStatic\-Deleter}!setObject@{setObject}}
\index{setObject@{setObject}!KStaticDeleter@{KStatic\-Deleter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class type$>$ type$\ast$ {\bf KStatic\-Deleter}$<$ type $>$::set\-Object (type $\ast$\& {\em global\-Ref}, type $\ast$ {\em obj}, bool {\em is\-Array} = false)\hspace{0.3cm}{\tt  [inline]}}\label{classKStaticDeleter_a2}


Sets the object to delete and registers the object to be deleted to {\bf KGlobal}{\rm (p.\,\pageref{classKGlobal})}. 

If the given object is 0, the former registration is unregistered. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em global\-Ref}]the static pointer where this object is stored This pointer will be reset to 0 after deletion of the object. \item[{\em is\-Array}]tells the destructor to delete an array instead of an object \end{description}
\end{Desc}


Definition at line 93 of file kstaticdeleter.h.

References KGlobal::register\-Static\-Deleter(), and KGlobal::unregister\-Static\-Deleter().\index{KStaticDeleter@{KStatic\-Deleter}!destructObject@{destructObject}}
\index{destructObject@{destructObject}!KStaticDeleter@{KStatic\-Deleter}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class type$>$ virtual void {\bf KStatic\-Deleter}$<$ type $>$::destruct\-Object ()\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKStaticDeleter_a3}


Destructs the object. 

This has the same effect as deleting the KStatic\-Deleter. 

Reimplemented from {\bf KStatic\-Deleter\-Base} {\rm (p.\,\pageref{classKStaticDeleterBase_a1})}.

Definition at line 109 of file kstaticdeleter.h.

The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
kstaticdeleter.h\end{CompactItemize}
