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>
This commit is contained in:
parent
ae1d2c45d7
commit
35b5100302
@ -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");
|
||||
|
@ -554,22 +554,6 @@ static const quint16 crc_tbl[16] = {
|
||||
0xc60c, 0xd68d, 0xe70e, 0xf78f
|
||||
};
|
||||
|
||||
/*!
|
||||
\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
|
||||
@ -578,6 +562,7 @@ quint16 qChecksum(const char *data, uint len)
|
||||
|
||||
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.
|
||||
@ -4092,27 +4077,12 @@ float QByteArray::toFloat(bool *ok) const
|
||||
return QLocaleData::convertDoubleToFloat(toDouble(ok), ok);
|
||||
}
|
||||
|
||||
/*!
|
||||
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}.
|
||||
|
||||
@ -4513,27 +4483,8 @@ QByteArray &QByteArray::setRawData(const char *data, uint size)
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
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
|
||||
|
@ -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 = '%');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user