summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@qt.io>2019-11-06 10:30:32 +0100
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2019-11-06 17:02:37 +0100
commit35b5100302c9ff28a7ae286c6bca8de37683f270 (patch)
treee41ef6012ad37483e62f0ca25a51cf1a3f829828
parentQShortcut: Fix build with -no-feature-whatsthis (diff)
downloadqtbase-35b5100302c9ff28a7ae286c6bca8de37683f270.tar.xz
qtbase-35b5100302c9ff28a7ae286c6bca8de37683f270.zip
Remove redundant overloads in QByteArray
All of these were marked to be removed in Qt 6. Change-Id: Ifa7aa14abebafdfeda024dcbfa5ae1f7874f387f Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp10
-rw-r--r--src/corelib/text/qbytearray.cpp72
-rw-r--r--src/corelib/text/qbytearray.h14
3 files changed, 13 insertions, 83 deletions
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 11ab50687d..b1dc392140 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp
@@ -372,16 +372,13 @@ a = str.toFloat(&ok); // a == 0, ok == false
//! [39]
QByteArray text("Qt is great!");
text.toBase64(); // returns "UXQgaXMgZ3JlYXQh"
-//! [39]
-//! [39bis]
QByteArray text("<p>Hello?</p>");
text.toBase64(QByteArray::Base64Encoding | QByteArray::OmitTrailingEquals); // returns "PHA+SGVsbG8/PC9wPg"
text.toBase64(QByteArray::Base64Encoding); // returns "PHA+SGVsbG8/PC9wPg=="
text.toBase64(QByteArray::Base64UrlEncoding); // returns "PHA-SGVsbG8_PC9wPg=="
text.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals); // returns "PHA-SGVsbG8_PC9wPg"
-//! [39bis]
-
+//! [39]
//! [40]
QByteArray ba;
@@ -422,13 +419,10 @@ QDataStream in(&data, QIODevice::ReadOnly);
//! [44]
QByteArray text = QByteArray::fromBase64("UXQgaXMgZ3JlYXQh");
text.data(); // returns "Qt is great!"
-//! [44]
-//! [44bis]
QByteArray::fromBase64("PHA+SGVsbG8/PC9wPg==", QByteArray::Base64Encoding); // returns "<p>Hello?</p>"
QByteArray::fromBase64("PHA-SGVsbG8_PC9wPg==", QByteArray::Base64UrlEncoding); // returns "<p>Hello?</p>"
-//! [44bis]
-
+//! [44]
//! [45]
QByteArray text = QByteArray::fromHex("517420697320677265617421");
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index 444980e9c0..4a00c664c0 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -556,28 +556,13 @@ static const quint16 crc_tbl[16] = {
/*!
\relates QByteArray
-
- Returns the CRC-16 checksum of the first \a len bytes of \a data.
-
- The checksum is independent of the byte order (endianness) and will be
- calculated accorded to the algorithm published in ISO 3309 (Qt::ChecksumIso3309).
-
- \note This function is a 16-bit cache conserving (16 entry table)
- implementation of the CRC-16-CCITT algorithm.
-*/
-quint16 qChecksum(const char *data, uint len)
-{
- return qChecksum(data, len, Qt::ChecksumIso3309);
-}
-
-/*!
- \relates QByteArray
\since 5.9
Returns the CRC-16 checksum of the first \a len bytes of \a data.
The checksum is independent of the byte order (endianness) and will
be calculated accorded to the algorithm published in \a standard.
+ By default the algorithm published in ISO 3309 (Qt::ChecksumIso3309) is used.
\note This function is a 16-bit cache conserving (16 entry table)
implementation of the CRC-16-CCITT algorithm.
@@ -4093,26 +4078,11 @@ float QByteArray::toFloat(bool *ok) const
}
/*!
- Returns a copy of the byte array, encoded as Base64.
-
- \snippet code/src_corelib_tools_qbytearray.cpp 39
-
- The algorithm used to encode Base64-encoded data is defined in \l{RFC 4648}.
-
- \sa fromBase64()
-*/
-QByteArray QByteArray::toBase64() const
-{
- return toBase64(Base64Encoding);
-}
-
-/*!
\since 5.2
- \overload
Returns a copy of the byte array, encoded using the options \a options.
- \snippet code/src_corelib_tools_qbytearray.cpp 39bis
+ \snippet code/src_corelib_tools_qbytearray.cpp 39
The algorithm used to encode Base64-encoded data is defined in \l{RFC 4648}.
@@ -4514,26 +4484,7 @@ QByteArray &QByteArray::setRawData(const char *data, uint size)
}
/*!
- Returns a decoded copy of the Base64 array \a base64. Input is not checked
- for validity; invalid characters in the input are skipped, enabling the
- decoding process to continue with subsequent characters.
-
- For example:
-
- \snippet code/src_corelib_tools_qbytearray.cpp 44
-
- The algorithm used to decode Base64-encoded data is defined in \l{RFC 4648}.
-
- \sa toBase64()
-*/
-QByteArray QByteArray::fromBase64(const QByteArray &base64)
-{
- return fromBase64(base64, Base64Encoding);
-}
-
-/*!
\since 5.2
- \overload
Returns a decoded copy of the Base64 array \a base64, using the alphabet
defined by \a options. Input is not checked for validity; invalid
@@ -4542,7 +4493,7 @@ QByteArray QByteArray::fromBase64(const QByteArray &base64)
For example:
- \snippet code/src_corelib_tools_qbytearray.cpp 44bis
+ \snippet code/src_corelib_tools_qbytearray.cpp 44
The algorithm used to decode Base64-encoded data is defined in \l{RFC 4648}.
@@ -4627,21 +4578,7 @@ QByteArray QByteArray::fromHex(const QByteArray &hexEncoded)
return res;
}
-/*!
- Returns a hex encoded copy of the byte array. The hex encoding uses the numbers 0-9 and
- the letters a-f.
-
- \sa fromHex()
-*/
-QByteArray QByteArray::toHex() const
-{
- return toHex('\0');
-}
-
-/*! \overload
- \since 5.9
-
- Returns a hex encoded copy of the byte array. The hex encoding uses the numbers 0-9 and
+/*! Returns a hex encoded copy of the byte array. The hex encoding uses the numbers 0-9 and
the letters a-f.
If \a separator is not '\0', the separator character is inserted between the hex bytes.
@@ -4649,6 +4586,7 @@ QByteArray QByteArray::toHex() const
Example:
\snippet code/src_corelib_tools_qbytearray.cpp 50
+ \since 5.9
\sa fromHex()
*/
QByteArray QByteArray::toHex(char separator) const
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h
index 03d842e9bc..1376e26260 100644
--- a/src/corelib/text/qbytearray.h
+++ b/src/corelib/text/qbytearray.h
@@ -107,8 +107,8 @@ Q_CORE_EXPORT int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap);
Q_CORE_EXPORT int qsnprintf(char *str, size_t n, const char *fmt, ...);
// qChecksum: Internet checksum
-Q_CORE_EXPORT quint16 qChecksum(const char *s, uint len); // ### Qt 6: Remove
-Q_CORE_EXPORT quint16 qChecksum(const char *s, uint len, Qt::ChecksumType standard); // ### Qt 6: Use Qt::ChecksumType standard = Qt::ChecksumIso3309
+Q_CORE_EXPORT quint16 qChecksum(const char *s, uint len,
+ Qt::ChecksumType standard = Qt::ChecksumIso3309);
class QByteRef;
class QString;
@@ -355,10 +355,8 @@ public:
qulonglong toULongLong(bool *ok = nullptr, int base = 10) const;
float toFloat(bool *ok = nullptr) const;
double toDouble(bool *ok = nullptr) const;
- QByteArray toBase64(Base64Options options) const;
- QByteArray toBase64() const; // ### Qt6 merge with previous
- QByteArray toHex() const;
- QByteArray toHex(char separator) const; // ### Qt6 merge with previous
+ QByteArray toBase64(Base64Options options = Base64Encoding) const;
+ QByteArray toHex(char separator = '\0') const;
QByteArray toPercentEncoding(const QByteArray &exclude = QByteArray(),
const QByteArray &include = QByteArray(),
char percent = '%') const;
@@ -379,8 +377,8 @@ public:
Q_REQUIRED_RESULT static QByteArray number(qulonglong, int base = 10);
Q_REQUIRED_RESULT static QByteArray number(double, char f = 'g', int prec = 6);
Q_REQUIRED_RESULT static QByteArray fromRawData(const char *, int size);
- Q_REQUIRED_RESULT static QByteArray fromBase64(const QByteArray &base64, Base64Options options);
- Q_REQUIRED_RESULT static QByteArray fromBase64(const QByteArray &base64); // ### Qt6 merge with previous
+ Q_REQUIRED_RESULT static QByteArray fromBase64(const QByteArray &base64,
+ Base64Options options = Base64Encoding);
Q_REQUIRED_RESULT static QByteArray fromHex(const QByteArray &hexEncoded);
Q_REQUIRED_RESULT static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%');