diff options
Diffstat (limited to 'src/declarative/qml/qintrusivelist_p.h')
-rw-r--r-- | src/declarative/qml/qintrusivelist_p.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/declarative/qml/qintrusivelist_p.h b/src/declarative/qml/qintrusivelist_p.h index c1ea80a767..717b11c344 100644 --- a/src/declarative/qml/qintrusivelist_p.h +++ b/src/declarative/qml/qintrusivelist_p.h @@ -68,6 +68,7 @@ public: inline bool isEmpty() const; inline void insert(N *n); inline void remove(N *n); + inline bool contains(N *) const; class iterator { public: @@ -202,6 +203,18 @@ void QIntrusiveList<N, member>::remove(N *n) } template<class N, QIntrusiveListNode N::*member> +bool QIntrusiveList<N, member>::contains(N *n) const +{ + QIntrusiveListNode *nnode = __first; + while (nnode) { + if (nodeToN(nnode) == n) + return true; + nnode = nnode->_next; + } + return false; +} + +template<class N, QIntrusiveListNode N::*member> N *QIntrusiveList<N, member>::first() const { return __first?nodeToN(__first):0; |