QUrl: purge deprecated API
Since 5.0: QUrl's image of the QUrlQuery API Remove deprecation-suppression from tst_qurl.cpp, too. Change-Id: Ide826283cb4e177fb34fb4080502f5a4620bd5d7 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>bb10
parent
996a7fc6f1
commit
0a961129f0
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Intel Corporation.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
|
|
@ -279,72 +279,6 @@ public:
|
|||
NSURL *toNSURL() const Q_DECL_NS_RETURNS_AUTORELEASED;
|
||||
#endif
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5,0)
|
||||
QT_DEPRECATED static QString fromPunycode(const QByteArray &punycode)
|
||||
{ return fromAce(punycode); }
|
||||
QT_DEPRECATED static QByteArray toPunycode(const QString &string)
|
||||
{ return toAce(string); }
|
||||
|
||||
QT_DEPRECATED inline void setQueryItems(const QList<QPair<QString, QString> > &qry);
|
||||
QT_DEPRECATED inline void addQueryItem(const QString &key, const QString &value);
|
||||
QT_DEPRECATED inline QList<QPair<QString, QString> > queryItems() const;
|
||||
QT_DEPRECATED inline bool hasQueryItem(const QString &key) const;
|
||||
QT_DEPRECATED inline QString queryItemValue(const QString &key) const;
|
||||
QT_DEPRECATED inline QStringList allQueryItemValues(const QString &key) const;
|
||||
QT_DEPRECATED inline void removeQueryItem(const QString &key);
|
||||
QT_DEPRECATED inline void removeAllQueryItems(const QString &key);
|
||||
|
||||
QT_DEPRECATED inline void setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &query);
|
||||
QT_DEPRECATED inline void addEncodedQueryItem(const QByteArray &key, const QByteArray &value);
|
||||
QT_DEPRECATED inline QList<QPair<QByteArray, QByteArray> > encodedQueryItems() const;
|
||||
QT_DEPRECATED inline bool hasEncodedQueryItem(const QByteArray &key) const;
|
||||
QT_DEPRECATED inline QByteArray encodedQueryItemValue(const QByteArray &key) const;
|
||||
QT_DEPRECATED inline QList<QByteArray> allEncodedQueryItemValues(const QByteArray &key) const;
|
||||
QT_DEPRECATED inline void removeEncodedQueryItem(const QByteArray &key);
|
||||
QT_DEPRECATED inline void removeAllEncodedQueryItems(const QByteArray &key);
|
||||
|
||||
QT_DEPRECATED void setEncodedUrl(const QByteArray &u, ParsingMode mode = TolerantMode)
|
||||
{ setUrl(fromEncodedComponent_helper(u), mode); }
|
||||
|
||||
QT_DEPRECATED QByteArray encodedUserName() const
|
||||
{ return userName(FullyEncoded).toLatin1(); }
|
||||
QT_DEPRECATED void setEncodedUserName(const QByteArray &value)
|
||||
{ setUserName(fromEncodedComponent_helper(value)); }
|
||||
|
||||
QT_DEPRECATED QByteArray encodedPassword() const
|
||||
{ return password(FullyEncoded).toLatin1(); }
|
||||
QT_DEPRECATED void setEncodedPassword(const QByteArray &value)
|
||||
{ setPassword(fromEncodedComponent_helper(value)); }
|
||||
|
||||
QT_DEPRECATED QByteArray encodedHost() const
|
||||
{ return host(FullyEncoded).toLatin1(); }
|
||||
QT_DEPRECATED void setEncodedHost(const QByteArray &value)
|
||||
{ setHost(fromEncodedComponent_helper(value)); }
|
||||
|
||||
QT_DEPRECATED QByteArray encodedPath() const
|
||||
{ return path(FullyEncoded).toLatin1(); }
|
||||
QT_DEPRECATED void setEncodedPath(const QByteArray &value)
|
||||
{ setPath(fromEncodedComponent_helper(value)); }
|
||||
|
||||
QT_DEPRECATED QByteArray encodedQuery() const
|
||||
{ return toLatin1_helper(query(FullyEncoded)); }
|
||||
QT_DEPRECATED void setEncodedQuery(const QByteArray &value)
|
||||
{ setQuery(fromEncodedComponent_helper(value)); }
|
||||
|
||||
QT_DEPRECATED QByteArray encodedFragment() const
|
||||
{ return toLatin1_helper(fragment(FullyEncoded)); }
|
||||
QT_DEPRECATED void setEncodedFragment(const QByteArray &value)
|
||||
{ setFragment(fromEncodedComponent_helper(value)); }
|
||||
|
||||
private:
|
||||
// helper function for the encodedQuery and encodedFragment functions
|
||||
static QByteArray toLatin1_helper(const QString &string)
|
||||
{
|
||||
if (string.isEmpty())
|
||||
return string.isNull() ? QByteArray() : QByteArray("");
|
||||
return string.toLatin1();
|
||||
}
|
||||
#endif
|
||||
private:
|
||||
static QString fromEncodedComponent_helper(const QByteArray &ba);
|
||||
|
||||
|
|
@ -412,8 +346,4 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QUrl &);
|
|||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5,0)
|
||||
# include <QtCore/qurlquery.h>
|
||||
#endif
|
||||
|
||||
#endif // QURL_H
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Intel Corporation.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
|
|
@ -44,10 +45,6 @@
|
|||
#include <QtCore/qshareddata.h>
|
||||
#include <QtCore/qurl.h>
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5,0)
|
||||
#include <QtCore/qstringlist.h>
|
||||
#endif
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
|
@ -116,64 +113,6 @@ public:
|
|||
|
||||
Q_DECLARE_SHARED(QUrlQuery)
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5,0)
|
||||
inline void QUrl::setQueryItems(const QList<QPair<QString, QString> > &qry)
|
||||
{ QUrlQuery q(*this); q.setQueryItems(qry); setQuery(q); }
|
||||
inline void QUrl::addQueryItem(const QString &key, const QString &value)
|
||||
{ QUrlQuery q(*this); q.addQueryItem(key, value); setQuery(q); }
|
||||
inline QList<QPair<QString, QString> > QUrl::queryItems() const
|
||||
{ return QUrlQuery(*this).queryItems(); }
|
||||
inline bool QUrl::hasQueryItem(const QString &key) const
|
||||
{ return QUrlQuery(*this).hasQueryItem(key); }
|
||||
inline QString QUrl::queryItemValue(const QString &key) const
|
||||
{ return QUrlQuery(*this).queryItemValue(key); }
|
||||
inline QStringList QUrl::allQueryItemValues(const QString &key) const
|
||||
{ return QUrlQuery(*this).allQueryItemValues(key); }
|
||||
inline void QUrl::removeQueryItem(const QString &key)
|
||||
{ QUrlQuery q(*this); q.removeQueryItem(key); setQuery(q); }
|
||||
inline void QUrl::removeAllQueryItems(const QString &key)
|
||||
{ QUrlQuery q(*this); q.removeAllQueryItems(key); setQuery(q); }
|
||||
|
||||
inline void QUrl::addEncodedQueryItem(const QByteArray &key, const QByteArray &value)
|
||||
{ QUrlQuery q(*this); q.addQueryItem(fromEncodedComponent_helper(key), fromEncodedComponent_helper(value)); setQuery(q); }
|
||||
inline bool QUrl::hasEncodedQueryItem(const QByteArray &key) const
|
||||
{ return QUrlQuery(*this).hasQueryItem(fromEncodedComponent_helper(key)); }
|
||||
inline QByteArray QUrl::encodedQueryItemValue(const QByteArray &key) const
|
||||
{ return QUrlQuery(*this).queryItemValue(fromEncodedComponent_helper(key), QUrl::FullyEncoded).toLatin1(); }
|
||||
inline void QUrl::removeEncodedQueryItem(const QByteArray &key)
|
||||
{ QUrlQuery q(*this); q.removeQueryItem(fromEncodedComponent_helper(key)); setQuery(q); }
|
||||
inline void QUrl::removeAllEncodedQueryItems(const QByteArray &key)
|
||||
{ QUrlQuery q(*this); q.removeAllQueryItems(fromEncodedComponent_helper(key)); setQuery(q); }
|
||||
|
||||
inline void QUrl::setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &qry)
|
||||
{
|
||||
QUrlQuery q;
|
||||
QList<QPair<QByteArray, QByteArray> >::ConstIterator it = qry.constBegin();
|
||||
for ( ; it != qry.constEnd(); ++it)
|
||||
q.addQueryItem(fromEncodedComponent_helper(it->first), fromEncodedComponent_helper(it->second));
|
||||
setQuery(q);
|
||||
}
|
||||
inline QList<QPair<QByteArray, QByteArray> > QUrl::encodedQueryItems() const
|
||||
{
|
||||
QList<QPair<QString, QString> > items = QUrlQuery(*this).queryItems(QUrl::FullyEncoded);
|
||||
QList<QPair<QString, QString> >::ConstIterator it = items.constBegin();
|
||||
QList<QPair<QByteArray, QByteArray> > result;
|
||||
result.reserve(items.size());
|
||||
for ( ; it != items.constEnd(); ++it)
|
||||
result << qMakePair(it->first.toLatin1(), it->second.toLatin1());
|
||||
return result;
|
||||
}
|
||||
inline QList<QByteArray> QUrl::allEncodedQueryItemValues(const QByteArray &key) const
|
||||
{
|
||||
const QStringList items = QUrlQuery(*this).allQueryItemValues(fromEncodedComponent_helper(key), QUrl::FullyEncoded);
|
||||
QList<QByteArray> result;
|
||||
result.reserve(items.size());
|
||||
for (const QString &item : items)
|
||||
result << item.toLatin1();
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QURLQUERY_H
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
#define QT_DEPRECATED
|
||||
#define QT_DISABLE_DEPRECATED_BEFORE 0
|
||||
#include <qurl.h>
|
||||
#include <QtTest/QtTest>
|
||||
#include <QtCore/QDebug>
|
||||
|
|
|
|||
Loading…
Reference in New Issue