source: trunk/doc/html/qobjectcleanuphandler.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 5.2 KB
RevLine 
[190]1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qobjectcleanuphandler.cpp:39 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QObjectCleanupHandler Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QObjectCleanupHandler Class Reference</h1>
33
34<p>The QObjectCleanupHandler class watches the lifetime of multiple QObjects.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qobjectcleanuphandler-h.html">qobjectcleanuphandler.h</a>&gt;</tt>
37<p>Inherits <a href="qobject.html">QObject</a>.
38<p><a href="qobjectcleanuphandler-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn><a href="#QObjectCleanupHandler"><b>QObjectCleanupHandler</b></a> ()</li>
42<li class=fn><a href="#~QObjectCleanupHandler"><b>~QObjectCleanupHandler</b></a> ()</li>
43<li class=fn>QObject * <a href="#add"><b>add</b></a> ( QObject&nbsp;*&nbsp;object )</li>
44<li class=fn>void <a href="#remove"><b>remove</b></a> ( QObject&nbsp;*&nbsp;object )</li>
45<li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
46<li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
47</ul>
48<hr><a name="details"></a><h2>Detailed Description</h2>
49
50
51The QObjectCleanupHandler class watches the lifetime of multiple QObjects.
52<p>
53<p> A QObjectCleanupHandler is useful whenever you need to know when a
54number of <a href="qobject.html">QObject</a>s that are owned by someone else have been
55deleted. This is important, for example, when referencing memory
56in an application that has been allocated in a shared library.
57<p> Example:
58<p> <pre>
59 class FactoryComponent : public FactoryInterface, public QLibraryInterface
60 {
61 public:
62 ...
63
64 <a href="qobject.html">QObject</a> *createObject();
65
66 bool init();
67 void cleanup();
68 bool canUnload() const;
69
70 private:
71 QObjectCleanupHandler objects;
72 };
73
74 // allocate a new object, and add it to the cleanup handler
75 QObject *FactoryComponent::createObject()
76 {
77 return objects.<a href="#add">add</a>( new <a href="qobject.html">QObject</a>() );
78 }
79
80 // QLibraryInterface implementation
81 bool FactoryComponent::init()
82 {
83 return TRUE;
84 }
85
86 void FactoryComponent::cleanup()
87 {
88 }
89
90 // it is only safe to unload the library when all QObject's have been destroyed
91 bool FactoryComponent::canUnload() const
92 {
93 return objects.<a href="#isEmpty">isEmpty</a>();
94 }
95 </pre>
96
97<p>See also <a href="objectmodel.html">Object Model</a>.
98
99<hr><h2>Member Function Documentation</h2>
100<h3 class=fn><a name="QObjectCleanupHandler"></a>QObjectCleanupHandler::QObjectCleanupHandler ()
101</h3>
102Constructs an empty QObjectCleanupHandler.
103
104<h3 class=fn><a name="~QObjectCleanupHandler"></a>QObjectCleanupHandler::~QObjectCleanupHandler ()
105</h3>
106Destroys the cleanup handler. All objects in this cleanup handler
107will be deleted.
108
109<h3 class=fn><a href="qobject.html">QObject</a>&nbsp;* <a name="add"></a>QObjectCleanupHandler::add ( <a href="qobject.html">QObject</a>&nbsp;*&nbsp;object )
110</h3>
111Adds <em>object</em> to this cleanup handler and returns the pointer to
112the object.
113
114<h3 class=fn>void <a name="clear"></a>QObjectCleanupHandler::clear ()
115</h3>
116Deletes all objects in this cleanup handler. The cleanup handler
117becomes empty.
118
119<h3 class=fn>bool <a name="isEmpty"></a>QObjectCleanupHandler::isEmpty () const
120</h3>
121Returns TRUE if this cleanup handler is empty or if all objects in
122this cleanup handler have been destroyed; otherwise return FALSE.
123
124<h3 class=fn>void <a name="remove"></a>QObjectCleanupHandler::remove ( <a href="qobject.html">QObject</a>&nbsp;*&nbsp;object )
125</h3>
126Removes the <em>object</em> from this cleanup handler. The object will
127not be destroyed.
128
129<!-- eof -->
130<hr><p>
131This file is part of the <a href="index.html">Qt toolkit</a>.
132Copyright &copy; 1995-2007
133<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
134<table width=100% cellspacing=0 border=0><tr>
135<td>Copyright &copy; 2007
136<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
137<td align=right><div align=right>Qt 3.3.8</div>
138</table></div></address></body>
139</html>
Note: See TracBrowser for help on using the repository browser.