![]() |
Qt 6.x
The Qt SDK
|
The QIntrusiveList class is a template class that provides a list of objects using static storage. More...
#include <qintrusivelist_p.h>
Classes | |
class | iterator |
Public Types | |
typedef iterator | Iterator |
Public Member Functions | |
QIntrusiveList () | |
Construct an empty list. | |
~QIntrusiveList () | |
Destroy the list. | |
bool | isEmpty () const |
void | insert (N *n) |
Insert object into the list. | |
void | remove (N *n) |
Remove object from the list. | |
bool | contains (N *) const |
Returns true if the list contains object; otherwise returns false. | |
N * | first () const |
Returns the first entry in this list, or null if the list is empty. | |
iterator | begin () |
Returns an STL-style interator pointing to the first item in the list. | |
iterator | end () |
Returns an STL-style iterator pointing to the imaginary item after the last item in the list. | |
Static Public Member Functions | |
static N * | next (N *current) |
Returns the next object after current, or null if current is the last object. | |
The QIntrusiveList class is a template class that provides a list of objects using static storage.
QIntrusiveList creates a linked list of objects. Adding and removing objects from the QIntrusiveList is a constant time operation and is very quick. The list performs no memory allocations, but does require the objects being added to the list to contain a QIntrusiveListNode instance for the list's use. Even so, for small lists QIntrusiveList uses less memory than Qt's other list classes.
As QIntrusiveList uses storage inside the objects in the list, each object can only be in one list at a time. Objects are inserted by the insert() method. If the object is already in a list (including the one it is being inserted into) it is first removed, and then inserted at the head of the list. QIntrusiveList is a last-in-first-out list. That is, following an insert() the inserted object becomes the list's first() object.
Definition at line 24 of file qintrusivelist_p.h.
typedef iterator QIntrusiveList< N, member >::Iterator |
Definition at line 51 of file qintrusivelist_p.h.
|
inline |
Construct an empty list.
Definition at line 131 of file qintrusivelist_p.h.
|
inline |
Destroy the list.
All entries are removed.
Definition at line 137 of file qintrusivelist_p.h.
References QIntrusiveListNode::remove().
|
inline |
Returns an STL-style interator pointing to the first item in the list.
Definition at line 194 of file qintrusivelist_p.h.
Referenced by QQuickDragGrabber::begin(), QQmlDelegateModelGroupPrivate::createdPackage(), QQmlDelegateModelGroupPrivate::destroyingPackage(), QQmlDelegateModelGroupPrivate::emitModelUpdated(), QQmlDelegateModelGroupPrivate::initPackage(), QSGDistanceFieldGlyphCache::setGlyphsPosition(), and QSGDistanceFieldGlyphCache::setGlyphsTexture().
|
inline |
Returns true if the list contains object; otherwise returns false.
Definition at line 168 of file qintrusivelist_p.h.
References QIntrusiveListNode::_next.
|
inline |
Returns an STL-style iterator pointing to the imaginary item after the last item in the list.
Definition at line 200 of file qintrusivelist_p.h.
Referenced by QQmlDelegateModelGroupPrivate::createdPackage(), QQmlDelegateModelGroupPrivate::destroyingPackage(), QQmlDelegateModelGroupPrivate::emitModelUpdated(), QQuickDragGrabber::end(), QQmlDelegateModelGroupPrivate::initPackage(), QSGDistanceFieldGlyphCache::setGlyphsPosition(), and QSGDistanceFieldGlyphCache::setGlyphsTexture().
|
inline |
Returns the first entry in this list, or null if the list is empty.
Definition at line 180 of file qintrusivelist_p.h.
Referenced by QQuickDragGrabber::~QQuickDragGrabber(), QQuickPixmapData::~QQuickPixmapData(), QQmlIncubatorPrivate::clear(), QQmlIncubatorPrivate::forceCompletion(), and QQuickDragGrabber::target().
|
inline |
Insert object into the list.
If object is a member of this, or another list, it will be removed and inserted at the head of this list.
Definition at line 149 of file qintrusivelist_p.h.
References QIntrusiveListNode::_next, QIntrusiveListNode::_prev, and QIntrusiveListNode::remove().
Referenced by QQmlPartsModel::QQmlPartsModel(), QQuickPixmapData::QQuickPixmapData(), QQuickPixmapData::QQuickPixmapData(), QQuickPixmapData::QQuickPixmapData(), QQuickPixmapData::QQuickPixmapData(), QQuickDragGrabber::grab(), QQmlDelegateModelPrivate::init(), QQuickPixmap::load(), QQuickPixmap::loadImageFromDevice(), QQuickPixmap::setPixmap(), QQmlDelegateModelPrivate::updateFilterGroup(), QQmlPartsModel::updateFilterGroup(), and QQmlPartsModel::updateFilterGroup().
|
inline |
Definition at line 143 of file qintrusivelist_p.h.
Referenced by QQuickDragGrabber::~QQuickDragGrabber(), QQuickPixmapData::~QQuickPixmapData(), QQmlIncubatorPrivate::calculateStatus(), QQmlIncubator::clear(), QQmlIncubatorPrivate::forceCompletion(), QQmlIncubatorPrivate::incubate(), QQuickDragGrabber::isEmpty(), and QQuickDragGrabber::target().
|
inlinestatic |
Returns the next object after current, or null if current is the last object.
current cannot be null.
Definition at line 186 of file qintrusivelist_p.h.
Referenced by QIntrusiveList< N, member >::iterator::erase(), and QIntrusiveList< N, member >::iterator::operator++().
|
inline |
Remove object from the list.
object must not be null.
Definition at line 161 of file qintrusivelist_p.h.
References QIntrusiveListNode::remove().
Referenced by QIntrusiveListNode::~QIntrusiveListNode(), QQuickPixmap::~QQuickPixmap(), QQuickPixmapData::~QQuickPixmapData(), QQuickPixmap::clear(), QQuickPixmap::clear(), QIntrusiveList< N, member >::iterator::erase(), and QQuickPixmap::load().