diff options
Diffstat (limited to 'src/corelib/doc')
-rw-r--r-- | src/corelib/doc/snippets/code/doc_src_containers.cpp | 16 | ||||
-rw-r--r-- | src/corelib/doc/snippets/code/doc_src_qiterator.cpp | 71 | ||||
-rw-r--r-- | src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp | 8 | ||||
-rw-r--r-- | src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp | 214 | ||||
-rw-r--r-- | src/corelib/doc/src/containers.qdoc | 37 | ||||
-rw-r--r-- | src/corelib/doc/src/datastreamformat.qdoc | 1 | ||||
-rw-r--r-- | src/corelib/doc/src/dontdocument.qdoc | 2 |
7 files changed, 25 insertions, 324 deletions
diff --git a/src/corelib/doc/snippets/code/doc_src_containers.cpp b/src/corelib/doc/snippets/code/doc_src_containers.cpp index 84935580c9..9b23a9056c 100644 --- a/src/corelib/doc/snippets/code/doc_src_containers.cpp +++ b/src/corelib/doc/snippets/code/doc_src_containers.cpp @@ -205,35 +205,35 @@ for (i = splitter->sizes().begin(); //! [15] -QLinkedList<QString> list; +QVector<QString> values; ... QString str; -foreach (str, list) +foreach (str, values) qDebug() << str; //! [15] //! [16] -QLinkedList<QString> list; +QVector<QString> values; ... -QLinkedListIterator<QString> i(list); +QVectorIterator<QString> i(values); while (i.hasNext()) qDebug() << i.next(); //! [16] //! [17] -QLinkedList<QString> list; +QVector<QString> values; ... -foreach (const QString &str, list) +foreach (const QString &str, values) qDebug() << str; //! [17] //! [18] -QLinkedList<QString> list; +QVector<QString> values; ... -foreach (const QString &str, list) { +foreach (const QString &str, values) { if (str.isEmpty()) break; qDebug() << str; diff --git a/src/corelib/doc/snippets/code/doc_src_qiterator.cpp b/src/corelib/doc/snippets/code/doc_src_qiterator.cpp index 58f4166c3e..0d0b864a83 100644 --- a/src/corelib/doc/snippets/code/doc_src_qiterator.cpp +++ b/src/corelib/doc/snippets/code/doc_src_qiterator.cpp @@ -64,24 +64,6 @@ while (i.hasPrevious()) qDebug() << i.previous(); //! [1] - -//! [2] -QLinkedList<float> list; -... -QLinkedListIterator<float> i(list); -while (i.hasNext()) - qDebug() << i.next(); -//! [2] - - -//! [3] -QLinkedListIterator<float> i(list); -i.toBack(); -while (i.hasPrevious()) - qDebug() << i.previous(); -//! [3] - - //! [4] QVector<float> vector; ... @@ -145,37 +127,6 @@ while (i.hasNext()) { } //! [10] - -//! [11] -QLinkedList<float> list; -... -QMutableLinkedListIterator<float> i(list); -while (i.hasNext()) - qDebug() << i.next(); -//! [11] - - -//! [12] -QMutableLinkedListIterator<float> i(list); -i.toBack(); -while (i.hasPrevious()) - qDebug() << i.previous(); -//! [12] - - -//! [13] -QMutableLinkedListIterator<int> i(list); -while (i.hasNext()) { - int val = i.next(); - if (val < 0) { - i.setValue(-val); - } else if (val == 0) { - i.remove(); - } -} -//! [13] - - //! [14] QVector<float> vector; ... @@ -184,7 +135,6 @@ while (i.hasNext()) qDebug() << i.next(); //! [14] - //! [15] QMutableVectorIterator<float> i(vector); i.toBack(); @@ -232,17 +182,6 @@ while (i.hasNext()) { } //! [19] - -//! [20] -QMutableLinkedListIterator<int> i(list); -while (i.hasNext()) { - int val = i.next(); - if (val < -32768 || val > 32767) - i.remove(); -} -//! [20] - - //! [21] QMutableVectorIterator<int> i(vector); while (i.hasNext()) { @@ -271,16 +210,6 @@ while (i.hasNext()) { } //! [23] - -//! [24] -QMutableLinkedListIterator<double> i(list); -while (i.hasNext()) { - double val = i.next(); - i.setValue(std::sqrt(val)); -} -//! [24] - - //! [25] QMutableVectorIterator<double> i(list); while (i.hasNext()) { diff --git a/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp b/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp index 6ddb5a9365..973ae75847 100644 --- a/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp @@ -208,10 +208,10 @@ //! [19] //! [20] - void appendList(QCborStreamWriter &writer, const QLinkedList<QString> &list) + void appendList(QCborStreamWriter &writer, const QVector<QString> &values) { writer.startArray(); - for (const QString &s : list) + for (const QString &s : values) writer.append(s); writer.endArray(); } @@ -228,10 +228,10 @@ //! [21] //! [22] - void appendMap(QCborStreamWriter &writer, const QLinkedList<QPair<int, QString>> &list) + void appendMap(QCborStreamWriter &writer, const QVector<QPair<int, QString>> &values) { writer.startMap(); - for (const auto pair : list) { + for (const auto pair : values) { writer.append(pair.first) writer.append(pair.second); } diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp deleted file mode 100644 index e8754a5f34..0000000000 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QLinkedList<int> integerList; -QLinkedList<QTime> timeList; -//! [0] - - -//! [1] -QLinkedList<QString> list; -list << "one" << "two" << "three"; -// list: ["one", "two", "three"] -//! [1] - - -//! [2] -QLinkedList<QWidget *> list; -... -while (!list.isEmpty()) - delete list.takeFirst(); -//! [2] - - -//! [3] -QLinkedList<QString> list; -list.append("one"); -list.append("two"); -list.append("three"); -// list: ["one", "two", "three"] -//! [3] - - -//! [4] -QLinkedList<QString> list; -list.prepend("one"); -list.prepend("two"); -list.prepend("three"); -// list: ["three", "two", "one"] -//! [4] - - -//! [5] -QList<QString> list; -list << "sun" << "cloud" << "sun" << "rain"; -list.removeAll("sun"); -// list: ["cloud", "rain"] -//! [5] - - -//! [6] -QList<QString> list; -list << "sun" << "cloud" << "sun" << "rain"; -list.removeOne("sun"); -// list: ["cloud", "sun", "rain"] -//! [6] - - -//! [7] -QLinkedList<QString> list; -list.append("January"); -list.append("February"); -... -list.append("December"); - -QLinkedList<QString>::iterator i; -for (i = list.begin(); i != list.end(); ++i) - cout << *i << Qt::endl; -//! [7] - - -//! [8] -QLinkedList<QString> list; -... -QLinkedList<QString>::iterator it = std::find(list.begin(), - list.end(), "Joel"); -if (it != list.end()) - cout << "Found Joel" << Qt::endl; -//! [8] - - -//! [9] -QLinkedList<int>::iterator i; -for (i = list.begin(); i != list.end(); ++i) - *i += 2; -//! [9] - - -//! [10] -QLinkedList<QString> list; -... -QLinkedList<QString>::iterator i = list.begin(); -while (i != list.end()) { - if ((*i).startsWith('_')) - i = list.erase(i); - else - ++i; -} -//! [10] - - -//! [11] -QLinkedList<QString>::iterator i = list.begin(); -while (i != list.end()) { - QLinkedList<QString>::iterator previous = i; - ++i; - if ((*previous).startsWith('_')) - list.erase(previous); -} -//! [11] - - -//! [12] -// WRONG -while (i != list.end()) { - if ((*i).startsWith('_')) - list.erase(i); - ++i; -} -//! [12] - - -//! [13] -if (*it == "Hello") - *it = "Bonjour"; -//! [13] - - -//! [14] -QLinkedList<QString> list; -list.append("January"); -list.append("February"); -... -list.append("December"); - -QLinkedList<QString>::const_iterator i; -for (i = list.constBegin(); i != list.constEnd(); ++i) - cout << *i << Qt::endl; -//! [14] - - -//! [15] -QLinkedList<QString> list; -... -QLinkedList<QString>::const_iterator it = std::find(list.constBegin(), - list.constEnd(), "Joel"); -if (it != list.constEnd()) - cout << "Found Joel" << Qt::endl; -//! [15] - - -//! [16] -std::list<double> stdlist; -list.push_back(1.2); -list.push_back(0.5); -list.push_back(3.14); - -QLinkedList<double> list = QLinkedList<double>::fromStdList(stdlist); -//! [16] - - -//! [17] -QLinkedList<double> list; -list << 1.2 << 0.5 << 3.14; - -std::list<double> stdlist = list.toStdList(); -//! [17] diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc index 8373ad4b4e..61bce214be 100644 --- a/src/corelib/doc/src/containers.qdoc +++ b/src/corelib/doc/src/containers.qdoc @@ -75,9 +75,9 @@ \section1 The Container Classes Qt provides the following sequential containers: QVector, - QLinkedList, QStack, and QQueue. For most + QStack, and QQueue. For most applications, QVector is the best type to use. It provides very fast - appends. If you really need a linked-list, use QLinkedList. + appends. If you really need a linked-list, use std::list. QStack and QQueue are convenience classes that provide LIFO and FIFO semantics. @@ -93,14 +93,6 @@ \table \header \li Class \li Summary - \row \li \l{QLinkedList}<T> - \li This class implements a doubly linked list. It - provides better performance than QVector when inserting in the - middle of a huge list, and it has nicer iterator semantics. - (Iterators pointing to an item in a QLinkedList remain valid as - long as the item exists, whereas iterators to a QVector can become - invalid after any insertion or removal.) - \row \li \l{QVector}<T> \li This is by far the most commonly used container class. It stores a list of values of a given type (T) that can be accessed @@ -155,7 +147,7 @@ QString and the value type QVector<int>. The containers are defined in individual header files with the - same name as the container (e.g., \c <QLinkedList>). For + same name as the container (e.g., \c <QVector>). For convenience, the containers are forward declared in \c <QtContainerFwd>. @@ -248,8 +240,6 @@ \header \li Containers \li Read-only iterator \li Read-write iterator \li QMutableListIterator<T> - \row \li QLinkedList<T> \li QLinkedListIterator<T> - \li QMutableLinkedListIterator<T> \row \li QVector<T>, QStack<T>, QQueue<T> \li QVectorIterator<T> \li QMutableVectorIterator<T> \row \li QSet<T> \li QSetIterator<T> @@ -261,7 +251,7 @@ \endtable In this discussion, we will concentrate on QVector and QMap. The - iterator types for QLinkedList, QVector, and QSet have exactly + iterator types for QSet have exactly the same interface as QVector's iterators; similarly, the iterator types for QHash have the same interface as QMap's iterators. @@ -362,7 +352,7 @@ \snippet code/doc_src_containers.cpp 6 - As mentioned above, QLinkedList's, QVector's, and QSet's iterator + As mentioned above QSet's iterator classes have exactly the same API as QVector's. We will now turn to QMapIterator, which is somewhat different because it iterates on (key, value) pairs. @@ -415,8 +405,6 @@ \table \header \li Containers \li Read-only iterator \li Read-write iterator - \row \li QLinkedList<T> \li QLinkedList<T>::const_iterator - \li QLinkedList<T>::iterator \row \li QVector<T>, QStack<T>, QQueue<T> \li QVector<T>::const_iterator \li QVector<T>::iterator \row \li QSet<T> \li QSet<T>::const_iterator @@ -437,7 +425,7 @@ just a typedef for \c{const T *}. In this discussion, we will concentrate on QVector and QMap. The - iterator types for QLinkedList, QVector, and QSet have exactly + iterator types for QSet have exactly the same interface as QVector's iterators; similarly, the iterator types for QHash have the same interface as QMap's iterators. @@ -542,7 +530,7 @@ Its syntax is: \c foreach (\e variable, \e container) \e statement. For example, here's how to use \c foreach to iterate - over a QLinkedList<QString>: + over a QVector<QString>: \snippet code/doc_src_containers.cpp 15 @@ -631,9 +619,9 @@ Algorithmic complexity is concerned about how fast (or slow) each function is as the number of items in the container grow. For - example, inserting an item in the middle of a QLinkedList is an + example, inserting an item in the middle of a std::list is an extremely fast operation, irrespective of the number of items - stored in the QLinkedList. On the other hand, inserting an item + stored in the list. On the other hand, inserting an item in the middle of a QVector is potentially very expensive if the QVector contains many items, since half of the items must be moved one position in memory. @@ -651,7 +639,7 @@ \li \b{Constant time:} O(1). A function is said to run in constant time if it requires the same amount of time no matter how many items are present in the container. One example is - QLinkedList::insert(). + QVector::push_back(). \li \b{Logarithmic time:} O(log \e n). A function that runs in logarithmic time is a function whose running time is @@ -673,12 +661,11 @@ number of items stored in the container. \endlist - The following table summarizes the algorithmic complexity of Qt's - sequential container classes: + The following table summarizes the algorithmic complexity of the sequential + container QVector<T>: \table \header \li \li Index lookup \li Insertion \li Prepending \li Appending - \row \li QLinkedList<T> \li O(\e n) \li O(1) \li O(1) \li O(1) \row \li QVector<T> \li O(1) \li O(n) \li O(n) \li Amort. O(1) \endtable diff --git a/src/corelib/doc/src/datastreamformat.qdoc b/src/corelib/doc/src/datastreamformat.qdoc index def9021350..b813612eec 100644 --- a/src/corelib/doc/src/datastreamformat.qdoc +++ b/src/corelib/doc/src/datastreamformat.qdoc @@ -66,7 +66,6 @@ \li QIcon \li QImage \li QKeySequence - \li QLinkedList<T> \li QMap<Key, T> \li QMargins \li QMatrix4x4 diff --git a/src/corelib/doc/src/dontdocument.qdoc b/src/corelib/doc/src/dontdocument.qdoc index 5fe05997cc..b1af82fbe2 100644 --- a/src/corelib/doc/src/dontdocument.qdoc +++ b/src/corelib/doc/src/dontdocument.qdoc @@ -36,6 +36,6 @@ QContiguousCacheData QContiguousCacheTypedData QNoDebug QUrlTwoFlags QCborValueRef qfloat16 QDeferredDeleteEvent QSpecialInteger QLittleEndianStorageType QBigEndianStorageType QFactoryInterface QFutureWatcherBase QJsonValuePtr - QJsonValueRefPtr QLinkedListNode QAbstractConcatenable QStringBuilderCommon + QJsonValueRefPtr QAbstractConcatenable QStringBuilderCommon QTextCodec::ConverterState QThreadStorageData QTextStreamManipulator) */ |