1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: http://www.qt-project.org/
7 ** This file is part of the QtScript module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL-ONLY$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser
12 ** General Public License version 2.1 as published by the Free Software
13 ** Foundation and appearing in the file LICENSE.LGPL included in the
14 ** packaging of this file. Please review the following information to
15 ** ensure the GNU Lesser General Public License version 2.1 requirements
16 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** If you have questions regarding the use of this file, please contact
19 ** us via http://www.qt-project.org/.
22 ****************************************************************************/
28 // This file is not part of the Qt API. It exists purely as an
29 // implementation detail. This header file may change from version to
30 // version without notice, or even be removed.
36 #ifndef QSCRIPTTOOLS_P_H
37 #define QSCRIPTTOOLS_P_H
39 #include <private/qintrusivelist_p.h>
43 template<class N, QIntrusiveListNode N::*member>
44 class QScriptIntrusiveList : public QIntrusiveList<N, member>
47 inline void insert(N *n);
48 inline void remove(N *n);
51 template<class N, QIntrusiveListNode N::*member>
52 void QScriptIntrusiveList<N, member>::insert(N *n)
54 Q_ASSERT_X(!this->contains(n), Q_FUNC_INFO, "Can't insert a value which is in the list already");
55 Q_ASSERT_X(!(n->*member).isInList(), Q_FUNC_INFO, "Can't insert a value which is in another list");
56 QIntrusiveList<N, member>::insert(n);
59 template<class N, QIntrusiveListNode N::*member>
60 void QScriptIntrusiveList<N, member>::remove(N *n)
62 Q_ASSERT_X(this->contains(n), Q_FUNC_INFO, "Can't remove a value which is not in the list");
63 QIntrusiveList<N, member>::remove(n);
68 #endif //QSCRIPTTOOLS_P_H