aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/ftw/qfieldlist_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/ftw/qfieldlist_p.h')
-rw-r--r--src/declarative/qml/ftw/qfieldlist_p.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/declarative/qml/ftw/qfieldlist_p.h b/src/declarative/qml/ftw/qfieldlist_p.h
index ff6b89b96f..f0efd16a20 100644
--- a/src/declarative/qml/ftw/qfieldlist_p.h
+++ b/src/declarative/qml/ftw/qfieldlist_p.h
@@ -61,6 +61,8 @@ class QFieldList
public:
inline QFieldList();
inline N *first() const;
+ inline N *takeFirst();
+
inline void append(N *);
inline void prepend(N *);
@@ -73,6 +75,8 @@ public:
inline void prepend(QFieldList<N, nextMember> &);
inline void insertAfter(N *, QFieldList<N, nextMember> &);
+ inline void copyAndClear(QFieldList<N, nextMember> &);
+
static inline N *next(N *v);
private:
@@ -94,6 +98,21 @@ N *QFieldList<N, nextMember>::first() const
}
template<class N, N *N::*nextMember>
+N *QFieldList<N, nextMember>::takeFirst()
+{
+ N *value = _first;
+ if (value) {
+ _first = next(value);
+ if (_last == value) {
+ Q_ASSERT(_first == 0);
+ _last = 0;
+ }
+ --_count;
+ }
+ return value;
+}
+
+template<class N, N *N::*nextMember>
void QFieldList<N, nextMember>::append(N *v)
{
Q_ASSERT(v->*nextMember == 0);
@@ -207,4 +226,14 @@ void QFieldList<N, nextMember>::insertAfter(N *after, QFieldList<N, nextMember>
}
}
+template<class N, N *N::*nextMember>
+void QFieldList<N, nextMember>::copyAndClear(QFieldList<N, nextMember> &o)
+{
+ _first = o._first;
+ _last = o._last;
+ _count = o._count;
+ o._first = o._last = 0;
+ o._count = 0;
+}
+
#endif // QFIELDLIST_P_H