summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-02 16:20:28 +0200
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-06-03 04:27:22 +0000
commit21674735ccd029c17dc8b36211e9b5bc3595ba34 (patch)
treefa3ebdc8da62854a8072a25e681b7d038332ecc0
parenteea10943492473bae7f048f8c59e35fb1bff36ca (diff)
Rename QTextStream::readLine(QString *, qint64) into readLineInto
As discussed on the development mailing list, the new overload is ambiguous and breaks source compatibility. Therefore this function that is new in 5.5 shall be called readLineInto. Change-Id: I2aecb8441af4edb72f16d0bc6dabf10cdabf32e2 Reviewed-by: Jan KundrĂ¡t <jkt@kde.org> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/io/qtextstream.cpp4
-rw-r--r--src/corelib/io/qtextstream.h2
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp18
3 files changed, 12 insertions, 12 deletions
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 47b96d708f..2fed83b2e3 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -1591,7 +1591,7 @@ QString QTextStream::readLine(qint64 maxlen)
{
QString line;
- readLine(&line, maxlen);
+ readLineInto(&line, maxlen);
return line;
}
@@ -1620,7 +1620,7 @@ QString QTextStream::readLine(qint64 maxlen)
\sa readAll(), QIODevice::readLine()
*/
-bool QTextStream::readLine(QString *line, qint64 maxlen)
+bool QTextStream::readLineInto(QString *line, qint64 maxlen)
{
Q_D(QTextStream);
// keep in sync with CHECK_VALID_STREAM
diff --git a/src/corelib/io/qtextstream.h b/src/corelib/io/qtextstream.h
index 125502e68d..e5f429ae4d 100644
--- a/src/corelib/io/qtextstream.h
+++ b/src/corelib/io/qtextstream.h
@@ -124,7 +124,7 @@ public:
void skipWhiteSpace();
QString readLine(qint64 maxlen = 0);
- bool readLine(QString *line, qint64 maxlen = 0);
+ bool readLineInto(QString *line, qint64 maxlen = 0);
QString readAll();
QString read(qint64 maxlen);
diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
index aa7a3762ce..36da3b8770 100644
--- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
@@ -81,7 +81,7 @@ private slots:
void readLineMaxlen_data();
void readLineMaxlen();
void readLinesFromBufferCRCR();
- void readLineOverload();
+ void readLineInto();
// all
void readAllFromDevice_data();
@@ -612,22 +612,22 @@ protected:
}
};
-void tst_QTextStream::readLineOverload()
+void tst_QTextStream::readLineInto()
{
QByteArray data = "1\n2\n3";
QTextStream ts(&data);
QString line;
- ts.readLine(&line);
+ ts.readLineInto(&line);
QCOMPARE(line, QStringLiteral("1"));
- ts.readLine(Q_NULLPTR, 0); // read the second line, but don't store it
+ ts.readLineInto(Q_NULLPTR, 0); // read the second line, but don't store it
- ts.readLine(&line);
+ ts.readLineInto(&line);
QCOMPARE(line, QStringLiteral("3"));
- QVERIFY(!ts.readLine(&line));
+ QVERIFY(!ts.readLineInto(&line));
QVERIFY(line.isEmpty());
QFile file(m_rfc3261FilePath);
@@ -637,7 +637,7 @@ void tst_QTextStream::readLineOverload()
line.reserve(1);
int maxLineCapacity = line.capacity();
- while (ts.readLine(&line)) {
+ while (ts.readLineInto(&line)) {
QVERIFY(line.capacity() >= maxLineCapacity);
maxLineCapacity = line.capacity();
}
@@ -647,7 +647,7 @@ void tst_QTextStream::readLineOverload()
QVERIFY(errorDevice.open(QIODevice::ReadOnly));
ts.setDevice(&errorDevice);
- QVERIFY(!ts.readLine(&line));
+ QVERIFY(!ts.readLineInto(&line));
QVERIFY(line.isEmpty());
}
@@ -1025,7 +1025,7 @@ void tst_QTextStream::performance()
QTextStream stream2(&file3);
QString line;
- while (stream2.readLine(&line))
+ while (stream2.readLineInto(&line))
++nlines3;
elapsed[2] = stopWatch.elapsed();