All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions
Qtilities::Core::PointerList Class Reference

The PointerList class monitors the lifetime of objects attached to it. More...

#include <PointerList.h>

Inheritance diagram for Qtilities::Core::PointerList:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void append (QObject *object)
 Appends a new instance of T to the PointerList.
 PointerList (bool cleanup_when_done=false, QObject *parent=0)
 Constructs a new PointerList.
- Public Member Functions inherited from Qtilities::Core::PointerListDeleter
 PointerListDeleter ()
 Constructor.
 PointerListDeleter (const PointerListDeleter &other)
 Copy constructor.

Additional Inherited Members

- Signals inherited from Qtilities::Core::PointerListDeleter
void objectDestroyed (QObject *object)
 Signal which is emitted when an object is removed.

Detailed Description

The PointerList class monitors the lifetime of objects attached to it.

The PointerList provides monitoring and accessing of object pointers which are attached to it. Other than QObjectCleanupHandler the PointerList class provides access functions to the objects attached to it and emits signals to indicate its activity.

When creating a new PointerList object with the cleanup_when_done constructor parameter set to true, the PointerList will delete all objects attached to it when it is destructed.

For example:

QObject* test = new QObject;
QObject* test2 = new QObject;
PointerList* test_list = new PointerList(true);
test_list->addObject(test);
test_list->addObject(test2);
delete test;
delete test_list;

The above code will result in the following actions inside test_list

test_list: Adding object test.
test_list: Adding object test2.
test_list: Removing object test from the pointer list when it is destructed.
test_list: Delete object test2 during destruction of test_list. Deleting it will also result in test2 being removed from the pointer list before it is destructed.

Constructor & Destructor Documentation

Qtilities::Core::PointerList::PointerList ( bool  cleanup_when_done = false,
QObject *  parent = 0 
)

Constructs a new PointerList.

Parameters:
cleanup_when_doneWhen true, the PointerList will delete all objects attached to it when it is destructed.


Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé