5#ifndef QSSGINVASIVELINKEDLIST_H
6#define QSSGINVASIVELINKEDLIST_H
19#include <QtQuick3DUtils/private/qtquick3dutilsglobal_p.h>
24#define QSSG_VERIFY_NODE(X) if (!(X)) qCritical("Node links are not null!");
26#define QSSG_VERIFY_NODE(X) Q_UNUSED((X));
34 static void set(T &, T *) {}
35 static T *
get(
const T &) {
return nullptr; }
38template <
typename T, T *T::*n>
41 static inline T *
get(T &
o) {
return o.*
n; }
42 static inline const T *
get(
const T &
o) {
return o.*
n; }
46template <
typename T, T *T::*p>
49 static inline T *
get(T &
o) {
return o.*
p; }
50 static inline const T *
get(
const T &
o) {
return o.*
p; }
51 static inline void set(T &
o, T *prev) {
o.*
p = prev; }
55template<
typename T,
typename HeadOp,
typename TailOp>
58 inline T *
tail(T *inObj) {
return inObj ? TailOp::get(inObj) :
nullptr; }
59 inline T *
head(T *inObj) {
return inObj ? HeadOp::get(inObj) :
nullptr; }
60 inline const T *
tail(
const T *inObj) {
return inObj ? TailOp::get(inObj) :
nullptr; }
61 inline const T *
head(
const T *inObj) {
return inObj ? HeadOp::get(inObj) :
nullptr; }
65 T *theHead = HeadOp::get(inObj);
66 T *theTail = TailOp::get(inObj);
68 TailOp::set(*theHead, theTail);
70 HeadOp::set(*theTail, theHead);
71 HeadOp::set(inObj,
nullptr);
72 TailOp::set(inObj,
nullptr);
77 T *theHead = &inPosition;
78 T *theTail = TailOp::get(inPosition);
84 T *theHead = HeadOp::get(inPosition);
85 T *theTail = &inPosition;
97 TailOp::set(*inHead, &inObj);
99 HeadOp::set(*inTail, &inObj);
100 HeadOp::set(inObj, inHead);
101 TailOp::set(inObj, inTail);
105template<
typename T,
typename TailOp>
108 using Iterator = QSSGLinkedListIterator<T, TailOp>;
133template<
typename T, T *T::*Next>
136 using TailOp = QSSGListAccessorNext<T, Next>;
137 using List = QSSGInvasiveSingleLinkedList<T, Next>;
139 using iterator = QSSGLinkedListIterator<T, TailOp>;
148 BaseList::insert_before(*
m_head, inObj);
163 T *lastObj =
nullptr;
169 TailOp::set(*lastObj, &inObj);
171 TailOp::set(inObj,
nullptr);
177 m_head = TailOp::get(inObj);
178 BaseList::remove(inObj);
189 T *oldTail = TailOp::get(inObj);
190 TailOp::set(inObj,
nullptr);
191 TailOp::set(*
head, oldTail);
222template<
typename T, T *T::*Previous, T *T::*Next>
225 using HeadOp = QSSGListAccessorPrevious<T, Previous>;
226 using TailOp = QSSGListAccessorNext<T, Next>;
227 using List = QSSGInvasiveLinkedList<T, Previous, Next>;
228 using BaseList = QSSGInvasiveLinkListBase<T, HeadOp, TailOp>;
229 using iterator = QSSGLinkedListIterator<T, TailOp>;
259 BaseList::insert_before(*
m_head, inObj);
261 HeadOp::set(inObj,
nullptr);
278 BaseList::insert_after(*
m_tail, inObj);
280 TailOp::set(inObj,
nullptr);
291 m_head = TailOp::get(inObj);
293 m_tail = HeadOp::get(inObj);
295 BaseList::remove(inObj);
QSet< QString >::iterator it
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter * iter
#define QSSG_VERIFY_NODE(X)
void insert_before(T &inPosition, T &inObj)
const T * head(const T *inObj)
const T * tail(const T *inObj)
void insert_after(T &inPosition, T &inObj)
void insert_unsafe(T *inHead, T *inTail, T &inObj)
QSSGLinkedListIterator< T, HeadOp > reverse_iterator
const_reverse_iterator rbegin() const
const_iterator begin() const
QSSGListAccessorNext< T, Next > TailOp
void push_front(T &inObj)
const_iterator end() const
void clear()
clear will set the head and tail of the list to null.
void removeAll()
removeAll removes all nodes and re-sets their head and tail to null.
QSSGInvasiveLinkListBase< T, HeadOp, TailOp > BaseList
QSSGListAccessorPrevious< T, Previous > HeadOp
QSSGInvasiveLinkedList< T, Previous, Next > List
reverse_iterator const_reverse_iterator
reverse_iterator rbegin()
const_reverse_iterator rend() const
QSSGLinkedListIterator< T, TailOp > iterator
void push_front(T &inObj)
void clear()
clear will set the head of the list to null.
QSSGLinkedListIterator< T, TailOp > iterator
const_iterator begin() const
const_iterator end() const
QSSGListAccessorNext< T, Next > TailOp
QSSGInvasiveLinkListBase< T, QSSGNullOp< T >, TailOp > BaseList
void removeAll()
removeAll removes all nodes and re-sets their tail to null.
QSSGInvasiveSingleLinkedList< T, Next > List
bool operator==(const Iterator &inIter) const
QSSGLinkedListIterator(T *inObj=nullptr)
bool operator!=(const Iterator &inIter) const
QSSGLinkedListIterator< T, TailOp > Iterator
static void set(T &o, T *next)
static const T * get(const T &o)
static const T * get(const T &o)
static void set(T &o, T *prev)
static void set(T &, T *)
static T * get(const T &)