QUrl: Add QUrl::fromEncoded(QByteArrayView) overload
Copy \note about backwards compatibility from QMessageAuthenticationCode (with minor changes). [ChangeLog][QtCore][QByteArray] Added QUrl::fromEncoded(QByteArrayView) overload. Change-Id: I8a190db2d50467e6191caf0abfe975b8fc656eb4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
533a0d5e54
commit
aa481854a9
@ -615,3 +615,18 @@ QStringView QXmlStreamAttributes::value(QLatin1StringView qualifiedName) const
|
||||
// order sections alphabetically to reduce chances of merge conflicts
|
||||
|
||||
#endif // QT_CORE_REMOVED_SINCE(6, 6)
|
||||
|
||||
#if QT_CORE_REMOVED_SINCE(6, 7)
|
||||
|
||||
#include "qurl.h"
|
||||
|
||||
QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode)
|
||||
{
|
||||
return QUrl::fromEncoded(QByteArrayView(input), mode);
|
||||
}
|
||||
|
||||
// #include "qotherheader.h"
|
||||
// // implement removed functions from qotherheader.h
|
||||
// order sections alphabetically to reduce chances of merge conflicts
|
||||
|
||||
#endif // QT_CORE_REMOVED_SINCE(6, 7)
|
||||
|
@ -2968,19 +2968,23 @@ QByteArray QUrl::toEncoded(FormattingOptions options) const
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode parsingMode)
|
||||
|
||||
Parses \a input and returns the corresponding QUrl. \a input is
|
||||
assumed to be in encoded form, containing only ASCII characters.
|
||||
|
||||
Parses the URL using \a parsingMode. See setUrl() for more information on
|
||||
this parameter. QUrl::DecodedMode is not permitted in this context.
|
||||
|
||||
\note In Qt versions prior to 6.7, this function took a QByteArray, not
|
||||
QByteArrayView. If you experience compile errors, it's because your code
|
||||
is passing objects that are implicitly convertible to QByteArray, but not
|
||||
QByteArrayView. Wrap the corresponding argument in \c{QByteArray{~~~}} to
|
||||
make the cast explicit. This is backwards-compatible with old Qt versions.
|
||||
|
||||
\sa toEncoded(), setUrl()
|
||||
*/
|
||||
QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode)
|
||||
QUrl QUrl::fromEncoded(QByteArrayView input, ParsingMode mode)
|
||||
{
|
||||
return QUrl(QString::fromUtf8(input.constData(), input.size()), mode);
|
||||
return QUrl(QString::fromUtf8(input), mode);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -165,7 +165,10 @@ public:
|
||||
[[nodiscard]] QUrl adjusted(FormattingOptions options) const;
|
||||
|
||||
QByteArray toEncoded(FormattingOptions options = FullyEncoded) const;
|
||||
#if QT_CORE_REMOVED_SINCE(6, 7)
|
||||
static QUrl fromEncoded(const QByteArray &url, ParsingMode mode = TolerantMode);
|
||||
#endif
|
||||
static QUrl fromEncoded(QByteArrayView input, ParsingMode mode = TolerantMode);
|
||||
|
||||
enum UserInputResolutionOption {
|
||||
DefaultResolution,
|
||||
|
Loading…
x
Reference in New Issue
Block a user