QObjectCleanupHandler(3qt)

NAME
QObjectCleanupHandler - Watches the lifetime of multiple QObjects

SYNOPSIS
#include <ntqobjectcleanuphandler.h>

Inherits TQObject.

  Public Members
QObjectCleanupHandler ()
~QObjectCleanupHandler ()
TQObject * add ( TQObject * object )
void remove ( TQObject * object )
bool isEmpty () const
void clear ()

DESCRIPTION
The QObjectCleanupHandler class watches the lifetime of multiple QObjects.

A QObjectCleanupHandler is useful whenever you need to know when a number of QObjects 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.

Example:

    class FactoryComponent : public FactoryInterface, public QLibraryInterface
    {
    public:
        ...
        TQObject *createObject();
        bool init();
        void cleanup();
        bool canUnload() const;
    private:
        QObjectCleanupHandler objects;
    };
    // allocate a new object, and add it to the cleanup handler
    TQObject *FactoryComponent::createObject()
    {
        return objects.add( new TQObject() );
    }
    // QLibraryInterface implementation
    bool FactoryComponent::init()
    {
        return true;
    }
    void FactoryComponent::cleanup()
    {
    }
    // it is only safe to unload the library when all TQObject's have been destroyed
    bool FactoryComponent::canUnload() const
    {
        return objects.isEmpty();
    }

See also Object Model.

MEMBER FUNCTION DOCUMENTATION

QObjectCleanupHandler::QObjectCleanupHandler ()
Constructs an empty QObjectCleanupHandler.

QObjectCleanupHandler::~QObjectCleanupHandler ()
Destroys the cleanup handler. All objects in this cleanup handler will be deleted.

TQObject * QObjectCleanupHandler::add ( TQObject * object )
Adds object to this cleanup handler and returns the pointer to the object.

void QObjectCleanupHandler::clear ()
Deletes all objects in this cleanup handler. The cleanup handler becomes empty.

bool QObjectCleanupHandler::isEmpty () const
Returns true if this cleanup handler is empty or if all objects in this cleanup handler have been destroyed; otherwise return false.

void QObjectCleanupHandler::remove ( TQObject * object )
Removes the object from this cleanup handler. The object will not be destroyed.

SEE ALSO
http://doc.trolltech.com/ntqobjectcleanuphandler.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you.

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.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (tqobjectcleanuphandler.3qt) and the Qt version (3.3.8).