Qtopia Home - Classes - Hierachy - Annotated - Functions - Licenses - Reference |
|
The QCollection class is the base class of all Qt collections. More...
#include <qcollection.h>
Inherited by QGVector, QGList, QGCache, and QGDict.
The QCollection class is an abstract base class for the Qt collection classes QDict, QList etc. via QGDict, QGList etc.
A QCollection knows only about the number of objects in the collection and the deletion strategy (see setAutoDelete()).
A collection is implemented using the Item (generic collection item) type, which is a void*. The template classes that create the real collections cast the Item to the required type.
See also Collection Classes.
This type is the generic "item" in a QCollection.
Constructs a collection. The constructor is protected because QCollection is an abstract class.
Constructs a copy of source with autoDelete() set to FALSE. The constructor is protected because QCollection is an abstract class.
Note that if source has autoDelete turned on, copying it is a good way to get memory leaks, reading freed memory, or both.
See also setAutoDelete().
See also setAutoDelete().
The default implementation deletes d pointer if and only if auto-delete has been enabled.
This function is always reimplemented in the collection template classes.
Warning: If you reimplement this function you must also reimplement the destructor and call the virtual function clear() from your destructor. This is due to the way virtual functions and destructors work in C++: virtual functions in derived classes cannot be called from a destructor. If you do not do this your deleteItem() function will not be called when the container is destructed.
See also newItem() and setAutoDelete().
The default implementation returns the d pointer, i.e. no copy is made.
This function is seldom reimplemented in the collection template classes. It is not common practice to make a copy of something that is being inserted.
See also deleteItem().
Sets the auto-delete option of the collection.
Enabling auto-delete (enable is TRUE) will delete objects that are removed from the collection. This can be useful if the collection has the only reference to the objects. (Note that the object can still be copied using the copy constructor - copying such objects is a good way to get memory leaks, reading freed memory or both.)
Disabling auto-delete (enable is FALSE) will not delete objects that are removed from the collection. This is useful if the objects are part of many collections.
The default setting is FALSE.
See also autoDelete().
This file is part of the Qtopia platform, copyright © 1995-2005 Trolltech, all rights reserved.
| Copyright © 2005 Trolltech | Trademarks | Qtopia version 2.2.0
|