From 343528841e72adf36a37d9afd7260e260a9342eb Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 30 Apr 2019 12:51:36 +0200 Subject: Prefix textstream operators with Qt:: As the non prefixed variants are deprecated Change-Id: I2ba09d71b9cea5203b54297a3f2332e6d44fedcf Reviewed-by: Allan Sandfeld Jensen --- src/corelib/doc/snippets/code/doc_src_qset.cpp | 4 +-- .../snippets/code/src_corelib_io_qtextstream.cpp | 4 +-- .../snippets/code/src_corelib_thread_qfuture.cpp | 2 +- .../snippets/code/src_corelib_tools_qbytearray.cpp | 6 ++--- .../doc/snippets/code/src_corelib_tools_qhash.cpp | 28 ++++++++++---------- .../code/src_corelib_tools_qlinkedlist.cpp | 8 +++--- .../snippets/code/src_corelib_tools_qlistdata.cpp | 8 +++--- .../doc/snippets/code/src_corelib_tools_qmap.cpp | 30 +++++++++++----------- .../doc/snippets/code/src_corelib_tools_qqueue.cpp | 2 +- .../code/src_corelib_tools_qstringiterator.cpp | 6 ++--- .../snippets/code/src_corelib_tools_qvector.cpp | 4 +-- src/corelib/doc/snippets/qstack/main.cpp | 2 +- src/corelib/doc/snippets/qstringlist/main.cpp | 6 ++--- 13 files changed, 55 insertions(+), 55 deletions(-) (limited to 'src/corelib/doc/snippets') diff --git a/src/corelib/doc/snippets/code/doc_src_qset.cpp b/src/corelib/doc/snippets/code/doc_src_qset.cpp index 4cd84d7330..7f7cec8b45 100644 --- a/src/corelib/doc/snippets/code/doc_src_qset.cpp +++ b/src/corelib/doc/snippets/code/doc_src_qset.cpp @@ -133,7 +133,7 @@ QSet set; ... QSet::iterator it = qFind(set.begin(), set.end(), "Jeanette"); if (it != set.end()) - cout << "Found Jeanette" << endl; + cout << "Found Jeanette" << Qt::endl; //! [10] @@ -152,7 +152,7 @@ QSet set; ... QSet::iterator it = qFind(set.begin(), set.end(), "Jeanette"); if (it != set.constEnd()) - cout << "Found Jeanette" << endl; + cout << "Found Jeanette" << Qt::endl; //! [12] diff --git a/src/corelib/doc/snippets/code/src_corelib_io_qtextstream.cpp b/src/corelib/doc/snippets/code/src_corelib_io_qtextstream.cpp index 625c1cf9bc..c30f13df5a 100644 --- a/src/corelib/doc/snippets/code/src_corelib_io_qtextstream.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_io_qtextstream.cpp @@ -124,12 +124,12 @@ in >> ch1 >> ch2 >> ch3; //! [8] QTextStream out(stdout); -out << "Qt rocks!" << endl; +out << "Qt rocks!" << Qt::endl; //! [8] //! [9] -stream << '\n' << flush; +stream << '\n' << Qt::flush; //! [9] diff --git a/src/corelib/doc/snippets/code/src_corelib_thread_qfuture.cpp b/src/corelib/doc/snippets/code/src_corelib_thread_qfuture.cpp index 382b08fdb7..dfa9b670e7 100644 --- a/src/corelib/doc/snippets/code/src_corelib_thread_qfuture.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_thread_qfuture.cpp @@ -53,7 +53,7 @@ QFuture future = ...; QFuture::const_iterator i; for (i = future.constBegin(); i != future.constEnd(); ++i) - cout << *i << endl; + cout << *i << Qt::endl; //! [0] diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp index 32fccbefbf..ec63e64fe9 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp @@ -71,7 +71,7 @@ ba[4] = 0xca; //! [2] for (int i = 0; i < ba.size(); ++i) { if (ba.at(i) >= 'a' && ba.at(i) <= 'f') - cout << "Found character in range [a-f]" << endl; + cout << "Found character in range [a-f]" << Qt::endl; } //! [2] @@ -88,7 +88,7 @@ x.replace(5, 3, "&"); // x == "rock & roll" QByteArray ba("We must be bold, very bold"); int j = 0; while ((j = ba.indexOf("", j)) != -1) { - cout << "Found tag at index position " << j << endl; + cout << "Found tag at index position " << j << Qt::endl; ++j; } //! [4] @@ -126,7 +126,7 @@ QByteArray("abc").isEmpty(); // returns false QByteArray ba("Hello world"); char *data = ba.data(); while (*data) { - cout << "[" << *data << "]" << endl; + cout << "[" << *data << "]" << Qt::endl; ++data; } //! [8] diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp index a3d2dd7f9e..9813cc98d5 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp @@ -89,7 +89,7 @@ QHash hash; ... for (int i = 0; i < 1000; ++i) { if (hash[i] == okButton) - cout << "Found button at index " << i << endl; + cout << "Found button at index " << i << Qt::endl; } //! [6] @@ -98,7 +98,7 @@ for (int i = 0; i < 1000; ++i) { QHashIterator i(hash); while (i.hasNext()) { i.next(); - cout << i.key() << ": " << i.value() << endl; + cout << i.key() << ": " << i.value() << Qt::endl; } //! [7] @@ -106,7 +106,7 @@ while (i.hasNext()) { //! [8] QHash::const_iterator i = hash.constBegin(); while (i != hash.constEnd()) { - cout << i.key() << ": " << i.value() << endl; + cout << i.key() << ": " << i.value() << Qt::endl; ++i; } //! [8] @@ -122,14 +122,14 @@ hash.insert("plenty", 2000); //! [10] QList values = hash.values("plenty"); for (int i = 0; i < values.size(); ++i) - cout << values.at(i) << endl; + cout << values.at(i) << Qt::endl; //! [10] //! [11] QHash::iterator i = hash.find("plenty"); while (i != hash.end() && i.key() == "plenty") { - cout << i.value() << endl; + cout << i.value() << Qt::endl; ++i; } //! [11] @@ -139,7 +139,7 @@ while (i != hash.end() && i.key() == "plenty") { QHash hash; ... foreach (int value, hash) - cout << value << endl; + cout << value << Qt::endl; //! [12] @@ -201,7 +201,7 @@ QHash hash; ... QHash::const_iterator i = hash.find("HDR"); while (i != hash.end() && i.key() == "HDR") { - cout << i.value() << endl; + cout << i.value() << Qt::endl; ++i; } //! [16] @@ -216,7 +216,7 @@ hash.insert("December", 12); QHash::iterator i; for (i = hash.begin(); i != hash.end(); ++i) - cout << i.key() << ": " << i.value() << endl; + cout << i.key() << ": " << i.value() << Qt::endl; //! [17] @@ -274,7 +274,7 @@ hash.insert("December", 12); QHash::const_iterator i; for (i = hash.constBegin(); i != hash.constEnd(); ++i) - cout << i.key() << ": " << i.value() << endl; + cout << i.key() << ": " << i.value() << Qt::endl; //! [23] @@ -296,23 +296,23 @@ hash3 = hash1 + hash2; //! [25] QList values = hash.values("plenty"); for (int i = 0; i < values.size(); ++i) - cout << values.at(i) << endl; + cout << values.at(i) << Qt::endl; //! [25] //! [26] QMultiHash::iterator i = hash.find("plenty"); while (i != hash.end() && i.key() == "plenty") { - cout << i.value() << endl; + cout << i.value() << Qt::endl; ++i; } //! [26] //! [27] for (QHash::const_iterator it = hash.cbegin(), end = hash.cend(); it != end; ++it) { - cout << "The key: " << it.key() << endl - cout << "The value: " << it.value() << endl; - cout << "Also the value: " << (*it) << endl; + cout << "The key: " << it.key() << Qt::endl + cout << "The value: " << it.value() << Qt::endl; + cout << "Also the value: " << (*it) << Qt::endl; } //! [27] diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp index 7f743bbd25..e0d3c71dc5 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp @@ -112,7 +112,7 @@ list.append("December"); QLinkedList::iterator i; for (i = list.begin(); i != list.end(); ++i) - cout << *i << endl; + cout << *i << Qt::endl; //! [7] @@ -122,7 +122,7 @@ QLinkedList list; QLinkedList::iterator it = qFind(list.begin(), list.end(), "Joel"); if (it != list.end()) - cout << "Found Joel" << endl; + cout << "Found Joel" << Qt::endl; //! [8] @@ -182,7 +182,7 @@ list.append("December"); QLinkedList::const_iterator i; for (i = list.constBegin(); i != list.constEnd(); ++i) - cout << *i << endl; + cout << *i << Qt::endl; //! [14] @@ -192,7 +192,7 @@ QLinkedList list; QLinkedList::iterator it = qFind(list.constBegin(), list.constEnd(), "Joel"); if (it != list.constEnd()) - cout << "Found Joel" << endl; + cout << "Found Joel" << Qt::endl; //! [15] diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp index 0e746cd6e6..a24e599f2f 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qlistdata.cpp @@ -73,7 +73,7 @@ if (list[0] == "Bob") //! [3] for (int i = 0; i < list.size(); ++i) { if (list.at(i) == "Jane") - cout << "Found Jane at position " << i << endl; + cout << "Found Jane at position " << i << Qt::endl; } //! [3] @@ -89,7 +89,7 @@ while (!list.isEmpty()) //! [5] int i = list.indexOf("Jane"); if (i != -1) - cout << "First occurrence of Jane is at position " << i << endl; + cout << "First occurrence of Jane is at position " << i << Qt::endl; //! [5] @@ -180,7 +180,7 @@ list.append("December"); QList::iterator i; for (i = list.begin(); i != list.end(); ++i) - cout << *i << endl; + cout << *i << Qt::endl; //! [15] @@ -213,7 +213,7 @@ list.append("December"); QList::const_iterator i; for (i = list.constBegin(); i != list.constEnd(); ++i) - cout << *i << endl; + cout << *i << Qt::endl; //! [19] diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp index bd59758f71..506022f082 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp @@ -89,7 +89,7 @@ QMap map; ... for (int i = 0; i < 1000; ++i) { if (map[i] == okButton) - cout << "Found button at index " << i << endl; + cout << "Found button at index " << i << Qt::endl; } //! [6] @@ -98,7 +98,7 @@ for (int i = 0; i < 1000; ++i) { QMapIterator i(map); while (i.hasNext()) { i.next(); - cout << i.key() << ": " << i.value() << endl; + cout << i.key() << ": " << i.value() << Qt::endl; } //! [7] @@ -106,7 +106,7 @@ while (i.hasNext()) { //! [8] QMap::const_iterator i = map.constBegin(); while (i != map.constEnd()) { - cout << i.key() << ": " << i.value() << endl; + cout << i.key() << ": " << i.value() << Qt::endl; ++i; } //! [8] @@ -122,14 +122,14 @@ map.insert("plenty", 2000); //! [10] QList values = map.values("plenty"); for (int i = 0; i < values.size(); ++i) - cout << values.at(i) << endl; + cout << values.at(i) << Qt::endl; //! [10] //! [11] QMap::iterator i = map.find("plenty"); while (i != map.end() && i.key() == "plenty") { - cout << i.value() << endl; + cout << i.value() << Qt::endl; ++i; } //! [11] @@ -139,7 +139,7 @@ while (i != map.end() && i.key() == "plenty") { QMap map; ... foreach (int value, map) - cout << value << endl; + cout << value << Qt::endl; //! [12] @@ -175,7 +175,7 @@ QMap map; ... QMap::const_iterator i = map.find("HDR"); while (i != map.end() && i.key() == "HDR") { - cout << i.value() << endl; + cout << i.value() << Qt::endl; ++i; } //! [14] @@ -201,7 +201,7 @@ QMap map; QMap::const_iterator i = map.lowerBound("HDR"); QMap::const_iterator upperBound = map.upperBound("HDR"); while (i != upperBound) { - cout << i.value() << endl; + cout << i.value() << Qt::endl; ++i; } //! [16] @@ -230,7 +230,7 @@ map.insert("December", 12); QMap::iterator i; for (i = map.begin(); i != map.end(); ++i) - cout << i.key() << ": " << i.value() << endl; + cout << i.key() << ": " << i.value() << Qt::endl; //! [18] @@ -288,7 +288,7 @@ map.insert("December", 12); QMap::const_iterator i; for (i = map.constBegin(); i != map.constEnd(); ++i) - cout << i.key() << ": " << i.value() << endl; + cout << i.key() << ": " << i.value() << Qt::endl; //! [24] @@ -310,23 +310,23 @@ map3 = map1 + map2; //! [26] QList values = map.values("plenty"); for (int i = 0; i < values.size(); ++i) - cout << values.at(i) << endl; + cout << values.at(i) << Qt::endl; //! [26] //! [27] QMultiMap::iterator i = map.find("plenty"); while (i != map.end() && i.key() == "plenty") { - cout << i.value() << endl; + cout << i.value() << Qt::endl; ++i; } //! [27] //! [keyiterator1] for (QMap::const_iterator it = map.cbegin(), end = map.cend(); it != end; ++it) { - cout << "The key: " << it.key() << endl - cout << "The value: " << it.value() << endl; - cout << "Also the value: " << (*it) << endl; + cout << "The key: " << it.key() << Qt::endl + cout << "The value: " << it.value() << Qt::endl; + cout << "Also the value: " << (*it) << Qt::endl; } //! [keyiterator1] diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qqueue.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qqueue.cpp index b74ac31933..6046c73b0f 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qqueue.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qqueue.cpp @@ -54,5 +54,5 @@ queue.enqueue(1); queue.enqueue(2); queue.enqueue(3); while (!queue.isEmpty()) - cout << queue.dequeue() << endl; + cout << queue.dequeue() << Qt::endl; //! [0] diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp index 7a2b4812ef..eb09fb99e2 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qstringiterator.cpp @@ -72,9 +72,9 @@ while (i.hasNext()) { //! [2] QStringIterator i(u"𝄞 is the G clef"); -qDebug() << hex << i.next(); // will print 1d11e (U+1D11E, MUSICAL SYMBOL G CLEF) -qDebug() << hex << i.next(); // will print 20 (U+0020, SPACE) -qDebug() << hex << i.next(); // will print 69 (U+0069, LATIN SMALL LETTER I) +qDebug() << Qt::hex << i.next(); // will print 1d11e (U+1D11E, MUSICAL SYMBOL G CLEF) +qDebug() << Qt::hex << i.next(); // will print 20 (U+0020, SPACE) +qDebug() << Qt::hex << i.next(); // will print 69 (U+0069, LATIN SMALL LETTER I) //! [2] } diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qvector.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qvector.cpp index 1f2af4a408..a05233049f 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qvector.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qvector.cpp @@ -73,7 +73,7 @@ if (vector[0] == "Liz") //! [4] for (int i = 0; i < vector.size(); ++i) { if (vector.at(i) == "Alfonso") - cout << "Found Alfonso at position " << i << endl; + cout << "Found Alfonso at position " << i << Qt::endl; } //! [4] @@ -81,7 +81,7 @@ for (int i = 0; i < vector.size(); ++i) { //! [5] int i = vector.indexOf("Harumi"); if (i != -1) - cout << "First occurrence of Harumi is at position " << i << endl; + cout << "First occurrence of Harumi is at position " << i << Qt::endl; //! [5] diff --git a/src/corelib/doc/snippets/qstack/main.cpp b/src/corelib/doc/snippets/qstack/main.cpp index af6b960e57..66823bcb59 100644 --- a/src/corelib/doc/snippets/qstack/main.cpp +++ b/src/corelib/doc/snippets/qstack/main.cpp @@ -60,6 +60,6 @@ int main(int argc, char *argv[]) stack.push(2); stack.push(3); while (!stack.isEmpty()) - cout << stack.pop() << endl; + cout << stack.pop() << Qt::endl; //! [0] } diff --git a/src/corelib/doc/snippets/qstringlist/main.cpp b/src/corelib/doc/snippets/qstringlist/main.cpp index 55c60650fe..80788ccd76 100644 --- a/src/corelib/doc/snippets/qstringlist/main.cpp +++ b/src/corelib/doc/snippets/qstringlist/main.cpp @@ -71,20 +71,20 @@ Widget::Widget(QWidget *parent) //! [1] for (int i = 0; i < fonts.size(); ++i) - cout << fonts.at(i).toLocal8Bit().constData() << endl; + cout << fonts.at(i).toLocal8Bit().constData() << Qt::endl; //! [1] //! [2] QStringListIterator javaStyleIterator(fonts); while (javaStyleIterator.hasNext()) - cout << javaStyleIterator.next().toLocal8Bit().constData() << endl; + cout << javaStyleIterator.next().toLocal8Bit().constData() << Qt::endl; //! [2] //! [3] QStringList::const_iterator constIterator; for (constIterator = fonts.constBegin(); constIterator != fonts.constEnd(); ++constIterator) - cout << (*constIterator).toLocal8Bit().constData() << endl; + cout << (*constIterator).toLocal8Bit().constData() << Qt::endl; //! [3] //! [4] -- cgit v1.2.3