You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/man/man3/tqobjectcleanuphandler.3qt

153 lines
3.9 KiB

'\" t
.TH TQObjectCleanupHandler 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
TQObjectCleanupHandler \- Watches the lifetime of multiple TQObjects
.SH SYNOPSIS
\fC#include <tqobjectcleanuphandler.h>\fR
.PP
Inherits TQObject.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQObjectCleanupHandler\fR ()"
.br
.ti -1c
.BI "\fB~TQObjectCleanupHandler\fR ()"
.br
.ti -1c
.BI "TQObject * \fBadd\fR ( TQObject * object )"
.br
.ti -1c
.BI "void \fBremove\fR ( TQObject * object )"
.br
.ti -1c
.BI "bool \fBisEmpty\fR () const"
.br
.ti -1c
.BI "void \fBclear\fR ()"
.br
.in -1c
.SH DESCRIPTION
The TQObjectCleanupHandler class watches the lifetime of multiple TQObjects.
.PP
A TQObjectCleanupHandler is useful whenever you need to know when a number of TQObjects that are owned by someone else have been deleted. This is important, for example, when referencing memory in an application that has been allocated in a shared library.
.PP
Example:
.PP
.nf
.br
class FactoryComponent : public FactoryInterface, public QLibraryInterface
.br
{
.br
public:
.br
...
.br
.br
TQObject *createObject();
.br
.br
bool init();
.br
void cleanup();
.br
bool canUnload() const;
.br
.br
private:
.br
TQObjectCleanupHandler objects;
.br
};
.br
.br
// allocate a new object, and add it to the cleanup handler
.br
TQObject *FactoryComponent::createObject()
.br
{
.br
return objects.add( new TQObject() );
.br
}
.br
.br
// QLibraryInterface implementation
.br
bool FactoryComponent::init()
.br
{
.br
return TRUE;
.br
}
.br
.br
void FactoryComponent::cleanup()
.br
{
.br
}
.br
.br
// it is only safe to unload the library when all TQObject's have been destroyed
.br
bool FactoryComponent::canUnload() const
.br
{
.br
return objects.isEmpty();
.br
}
.br
.fi
.PP
See also Object Model.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "TQObjectCleanupHandler::TQObjectCleanupHandler ()"
Constructs an empty TQObjectCleanupHandler.
.SH "TQObjectCleanupHandler::~TQObjectCleanupHandler ()"
Destroys the cleanup handler. All objects in this cleanup handler will be deleted.
.SH "TQObject * TQObjectCleanupHandler::add ( TQObject * object )"
Adds \fIobject\fR to this cleanup handler and returns the pointer to the object.
.SH "void TQObjectCleanupHandler::clear ()"
Deletes all objects in this cleanup handler. The cleanup handler becomes empty.
.SH "bool TQObjectCleanupHandler::isEmpty () const"
Returns TRUE if this cleanup handler is empty or if all objects in this cleanup handler have been destroyed; otherwise return FALSE.
.SH "void TQObjectCleanupHandler::remove ( TQObject * object )"
Removes the \fIobject\fR from this cleanup handler. The object will
not be destroyed.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/tqobjectcleanuphandler.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqobjectcleanuphandler.3qt) and the Qt
version (3.3.8).