Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtCore module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | /*! |
41 | \class QQueue |
42 | \inmodule QtCore |
43 | \brief The QQueue class is a generic container that provides a queue. |
44 | |
45 | \ingroup tools |
46 | \ingroup shared |
47 | |
48 | \reentrant |
49 | |
50 | QQueue\<T\> is one of Qt's generic \l{container classes}. It |
51 | implements a queue data structure for items of a same type. |
52 | |
53 | A queue is a first in, first out (FIFO) structure. Items are |
54 | added to the tail of the queue using enqueue() and retrieved from |
55 | the head using dequeue(). The head() function provides access to |
56 | the head item without removing it. |
57 | |
58 | Example: |
59 | \snippet code/src_corelib_tools_qqueue.cpp 0 |
60 | |
61 | The example will output 1, 2, 3 in that order. |
62 | |
63 | QQueue inherits from QList. All of QList's functionality also |
64 | applies to QQueue. For example, you can use isEmpty() to test |
65 | whether the queue is empty, and you can traverse a QQueue using |
66 | QList's iterator classes (for example, QListIterator). But in |
67 | addition, QQueue provides three convenience functions that make |
68 | it easy to implement FIFO semantics: enqueue(), dequeue(), and |
69 | head(). |
70 | |
71 | QQueue's value type must be an \l{assignable data type}. This |
72 | covers most data types that are commonly used, but the compiler |
73 | won't let you, for example, store a QWidget as a value. Use |
74 | QWidget* instead. |
75 | |
76 | \sa QList, QStack |
77 | */ |
78 | |
79 | /*! |
80 | \fn template <class T> void QQueue<T>::swap(QQueue<T> &other) |
81 | \since 4.8 |
82 | |
83 | Swaps queue \a other with this queue. This operation is very |
84 | fast and never fails. |
85 | */ |
86 | |
87 | /*! |
88 | \fn template <class T> void QQueue<T>::enqueue(const T& t) |
89 | |
90 | Adds value \a t to the tail of the queue. |
91 | |
92 | This is the same as QList::append(). |
93 | |
94 | \sa dequeue(), head() |
95 | */ |
96 | |
97 | /*! |
98 | \fn template <class T> T &QQueue<T>::head() |
99 | |
100 | Returns a reference to the queue's head item. This function |
101 | assumes that the queue isn't empty. |
102 | |
103 | This is the same as QList::first(). |
104 | |
105 | \sa dequeue(), enqueue(), isEmpty() |
106 | */ |
107 | |
108 | /*! |
109 | \fn template <class T> const T &QQueue<T>::head() const |
110 | |
111 | \overload |
112 | */ |
113 | |
114 | /*! |
115 | \fn template <class T> T QQueue<T>::dequeue() |
116 | |
117 | Removes the head item in the queue and returns it. This function |
118 | assumes that the queue isn't empty. |
119 | |
120 | This is the same as QList::takeFirst(). |
121 | |
122 | \sa head(), enqueue(), isEmpty() |
123 | */ |
124 |
Warning: That file was not part of the compilation database. It may have many parsing errors.