Hide comparison operators for QtNetwork value types from non-ADL
Make them hidden friends, add a private isEqual helper where needed. Adjust and add documentation. Fixes: QTBUG-87976 Change-Id: If7c19eeab5be7452364eb76193981100f5516d6b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
d51d312c86
commit
57e57d9bcd
@ -86,12 +86,25 @@ public:
|
||||
};
|
||||
|
||||
/*!
|
||||
Returns \c true if the two policies have the same host and expiration date
|
||||
while agreeing on whether to include or exclude subdomains.
|
||||
\fn bool QHstsPolicy::operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs)
|
||||
|
||||
Returns \c true if the two policies \a lhs and \a rhs have the same host and
|
||||
expiration date while agreeing on whether to include or exclude subdomains.
|
||||
*/
|
||||
bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs)
|
||||
|
||||
/*!
|
||||
\fn bool QHstsPolicy::operator!=(const QHstsPolicy &lhs, const QHstsPolicy &rhs)
|
||||
|
||||
Returns \c true if the two policies \a lhs and \a rhs do not have the same host
|
||||
or expiration date, or do not agree on whether to include or exclude subdomains.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
bool QHstsPolicy::isEqual(const QHstsPolicy &other) const
|
||||
{
|
||||
return *lhs.d == *rhs.d;
|
||||
return *d == *other.d;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -80,21 +80,18 @@ public:
|
||||
bool isExpired() const;
|
||||
|
||||
private:
|
||||
|
||||
QSharedDataPointer<QHstsPolicyPrivate> d;
|
||||
|
||||
friend Q_NETWORK_EXPORT bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs);
|
||||
bool isEqual(const QHstsPolicy &other) const;
|
||||
friend bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs)
|
||||
{ return lhs.isEqual(rhs); }
|
||||
friend bool operator!=(const QHstsPolicy &lhs, const QHstsPolicy &rhs)
|
||||
{ return !lhs.isEqual(rhs); }
|
||||
};
|
||||
|
||||
Q_DECLARE_SHARED(QHstsPolicy)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QHstsPolicy::PolicyFlags)
|
||||
|
||||
Q_NETWORK_EXPORT bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs);
|
||||
|
||||
inline bool operator!=(const QHstsPolicy &lhs, const QHstsPolicy &rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -301,18 +301,29 @@ void QHttp2Configuration::swap(QHttp2Configuration &other) noexcept
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn bool QHttp2Configuration::operator==(const QHttp2Configuration &lhs, const QHttp2Configuration &rhs) noexcept
|
||||
Returns \c true if \a lhs and \a rhs have the same set of HTTP/2
|
||||
parameters.
|
||||
*/
|
||||
bool operator==(const QHttp2Configuration &lhs, const QHttp2Configuration &rhs)
|
||||
|
||||
/*!
|
||||
\fn bool QHttp2Configuration::operator!=(const QHttp2Configuration &lhs, const QHttp2Configuration &rhs) noexcept
|
||||
Returns \c true if \a lhs and \a rhs do not have the same set of HTTP/2
|
||||
parameters.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
bool QHttp2Configuration::isEqual(const QHttp2Configuration &other) const noexcept
|
||||
{
|
||||
if (lhs.d == rhs.d)
|
||||
if (d == other.d)
|
||||
return true;
|
||||
|
||||
return lhs.d->pushEnabled == rhs.d->pushEnabled
|
||||
&& lhs.d->huffmanCompressionEnabled == rhs.d->huffmanCompressionEnabled
|
||||
&& lhs.d->sessionWindowSize == rhs.d->sessionWindowSize
|
||||
&& lhs.d->streamWindowSize == rhs.d->streamWindowSize;
|
||||
return d->pushEnabled == other.d->pushEnabled
|
||||
&& d->huffmanCompressionEnabled == other.d->huffmanCompressionEnabled
|
||||
&& d->sessionWindowSize == other.d->sessionWindowSize
|
||||
&& d->streamWindowSize == other.d->streamWindowSize;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -53,8 +53,6 @@ QT_BEGIN_NAMESPACE
|
||||
class QHttp2ConfigurationPrivate;
|
||||
class Q_NETWORK_EXPORT QHttp2Configuration
|
||||
{
|
||||
friend Q_NETWORK_EXPORT bool operator==(const QHttp2Configuration &lhs, const QHttp2Configuration &rhs);
|
||||
|
||||
public:
|
||||
QHttp2Configuration();
|
||||
QHttp2Configuration(const QHttp2Configuration &other);
|
||||
@ -82,19 +80,19 @@ public:
|
||||
void swap(QHttp2Configuration &other) noexcept;
|
||||
|
||||
private:
|
||||
|
||||
QSharedDataPointer<QHttp2ConfigurationPrivate> d;
|
||||
|
||||
bool isEqual(const QHttp2Configuration &other) const noexcept;
|
||||
|
||||
friend bool operator==(const QHttp2Configuration &lhs, const QHttp2Configuration &rhs) noexcept
|
||||
{ return lhs.isEqual(rhs); }
|
||||
friend bool operator!=(const QHttp2Configuration &lhs, const QHttp2Configuration &rhs) noexcept
|
||||
{ return !lhs.isEqual(rhs); }
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_SHARED(QHttp2Configuration)
|
||||
|
||||
Q_NETWORK_EXPORT bool operator==(const QHttp2Configuration &lhs, const QHttp2Configuration &rhs);
|
||||
|
||||
inline bool operator!=(const QHttp2Configuration &lhs, const QHttp2Configuration &rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QHTTP2CONFIGURATION_H
|
||||
|
@ -206,31 +206,33 @@ QSslCertificate QOcspResponse::subject() const
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn bool operator==(const QOcspResponse &lhs, const QOcspResponse &rhs)
|
||||
\fn bool QOcspResponse::operator==(const QOcspResponse &lhs, const QOcspResponse &rhs)
|
||||
|
||||
Returns \c true if \a lhs and \a rhs are the responses for the same
|
||||
certificate, signed by the same responder, have the same
|
||||
revocation reason and the same certificate status.
|
||||
|
||||
\since 5.13
|
||||
\relates QOcspResponse
|
||||
*/
|
||||
Q_NETWORK_EXPORT bool operator==(const QOcspResponse &lhs, const QOcspResponse &rhs)
|
||||
{
|
||||
return lhs.d == rhs.d || *lhs.d == *rhs.d;
|
||||
}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool operator != (const QOcspResponse &lhs, const QOcspResponse &rhs)
|
||||
\fn bool QOcspResponse::operator!=(const QOcspResponse &lhs, const QOcspResponse &rhs)
|
||||
|
||||
Returns \c true if \a lhs and \a rhs are responses for different certificates,
|
||||
or signed by different responders, or have different revocation reasons, or different
|
||||
certificate statuses.
|
||||
Returns \c true if \a lhs and \a rhs are responses for different certificates,
|
||||
or signed by different responders, or have different revocation reasons, or different
|
||||
certificate statuses.
|
||||
|
||||
\since 5.13
|
||||
\relates QOcspResponse
|
||||
\since 5.13
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
bool QOcspResponse::isEqual(const QOcspResponse &other) const
|
||||
{
|
||||
return d == other.d || *d == *other.d;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn size_t qHash(const QOcspResponse &response, size_t seed)
|
||||
|
||||
|
@ -97,16 +97,19 @@ public:
|
||||
void swap(QOcspResponse &other) noexcept { d.swap(other.d); }
|
||||
|
||||
private:
|
||||
bool isEqual(const QOcspResponse &other) const;
|
||||
|
||||
friend class QSslSocketBackendPrivate;
|
||||
friend Q_NETWORK_EXPORT bool operator==(const QOcspResponse &lhs, const QOcspResponse &rhs);
|
||||
friend bool operator==(const QOcspResponse &lhs, const QOcspResponse &rhs)
|
||||
{ return lhs.isEqual(rhs); }
|
||||
friend bool operator!=(const QOcspResponse &lhs, const QOcspResponse &rhs)
|
||||
{ return !lhs.isEqual(rhs); }
|
||||
|
||||
friend Q_NETWORK_EXPORT size_t qHash(const QOcspResponse &response, size_t seed) noexcept;
|
||||
|
||||
QSharedDataPointer<QOcspResponsePrivate> d;
|
||||
};
|
||||
|
||||
inline bool operator!=(const QOcspResponse &lhs, const QOcspResponse &rhs) { return !(lhs == rhs); }
|
||||
|
||||
Q_DECLARE_SHARED(QOcspResponse)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -278,14 +278,25 @@ QString QSslDiffieHellmanParameters::errorString() const noexcept
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn bool QSslDiffieHellmanParameters::operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) noexcept
|
||||
\since 5.8
|
||||
\relates QSslDiffieHellmanParameters
|
||||
|
||||
Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false.
|
||||
*/
|
||||
bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) noexcept
|
||||
|
||||
/*!
|
||||
\fn bool QSslDiffieHellmanParameters::operator!=(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) noexcept
|
||||
\since 5.8
|
||||
|
||||
Returns \c true if \a lhs is not equal to \a rhs; otherwise returns \c false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
bool QSslDiffieHellmanParameters::isEqual(const QSslDiffieHellmanParameters &other) const noexcept
|
||||
{
|
||||
return lhs.d->derData == rhs.d->derData;
|
||||
return d->derData == other.d->derData;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
@ -63,14 +63,7 @@ class QDebug;
|
||||
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparams);
|
||||
#endif
|
||||
|
||||
Q_NETWORK_EXPORT bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) noexcept;
|
||||
|
||||
inline bool operator!=(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) noexcept
|
||||
{
|
||||
return !operator==(lhs, rhs);
|
||||
}
|
||||
|
||||
class QSslDiffieHellmanParameters
|
||||
class Q_NETWORK_EXPORT QSslDiffieHellmanParameters
|
||||
{
|
||||
public:
|
||||
enum Error {
|
||||
@ -79,30 +72,36 @@ public:
|
||||
UnsafeParametersError
|
||||
};
|
||||
|
||||
Q_NETWORK_EXPORT static QSslDiffieHellmanParameters defaultParameters();
|
||||
static QSslDiffieHellmanParameters defaultParameters();
|
||||
|
||||
Q_NETWORK_EXPORT QSslDiffieHellmanParameters();
|
||||
Q_NETWORK_EXPORT QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other);
|
||||
QSslDiffieHellmanParameters();
|
||||
QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other);
|
||||
QSslDiffieHellmanParameters(QSslDiffieHellmanParameters &&other) noexcept : d(other.d) { other.d = nullptr; }
|
||||
Q_NETWORK_EXPORT ~QSslDiffieHellmanParameters();
|
||||
~QSslDiffieHellmanParameters();
|
||||
|
||||
Q_NETWORK_EXPORT QSslDiffieHellmanParameters &operator=(const QSslDiffieHellmanParameters &other);
|
||||
QSslDiffieHellmanParameters &operator=(const QSslDiffieHellmanParameters &other);
|
||||
QSslDiffieHellmanParameters &operator=(QSslDiffieHellmanParameters &&other) noexcept { swap(other); return *this; }
|
||||
|
||||
void swap(QSslDiffieHellmanParameters &other) noexcept { qSwap(d, other.d); }
|
||||
|
||||
Q_NETWORK_EXPORT static QSslDiffieHellmanParameters fromEncoded(const QByteArray &encoded, QSsl::EncodingFormat format = QSsl::Pem);
|
||||
Q_NETWORK_EXPORT static QSslDiffieHellmanParameters fromEncoded(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem);
|
||||
static QSslDiffieHellmanParameters fromEncoded(const QByteArray &encoded, QSsl::EncodingFormat format = QSsl::Pem);
|
||||
static QSslDiffieHellmanParameters fromEncoded(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem);
|
||||
|
||||
Q_NETWORK_EXPORT bool isEmpty() const noexcept;
|
||||
Q_NETWORK_EXPORT bool isValid() const noexcept;
|
||||
Q_NETWORK_EXPORT Error error() const noexcept;
|
||||
Q_NETWORK_EXPORT QString errorString() const noexcept;
|
||||
bool isEmpty() const noexcept;
|
||||
bool isValid() const noexcept;
|
||||
Error error() const noexcept;
|
||||
QString errorString() const noexcept;
|
||||
|
||||
private:
|
||||
QSslDiffieHellmanParametersPrivate *d;
|
||||
friend class QSslContext;
|
||||
friend Q_NETWORK_EXPORT bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) noexcept;
|
||||
|
||||
bool isEqual(const QSslDiffieHellmanParameters &other) const noexcept;
|
||||
friend bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) noexcept
|
||||
{ return lhs.isEqual(rhs); }
|
||||
friend bool operator!=(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) noexcept
|
||||
{ return !lhs.isEqual(rhs); }
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
friend Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparam);
|
||||
#endif
|
||||
|
@ -139,17 +139,15 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs)
|
||||
\fn bool QSslEllipticCurve::operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs)
|
||||
\since 5.5
|
||||
\relates QSslEllipticCurve
|
||||
|
||||
Returns true if the curve \a lhs represents the same curve of \a rhs;
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs)
|
||||
\fn bool QSslEllipticCurve::operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs)
|
||||
\since 5.5
|
||||
\relates QSslEllipticCurve
|
||||
|
||||
Returns true if the curve \a lhs represents a different curve than \a rhs;
|
||||
false otherwise.
|
||||
|
@ -74,7 +74,10 @@ public:
|
||||
private:
|
||||
int id;
|
||||
|
||||
friend constexpr bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept;
|
||||
friend constexpr bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept
|
||||
{ return lhs.id == rhs.id; }
|
||||
friend constexpr bool operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept
|
||||
{ return !(lhs == rhs); }
|
||||
friend constexpr size_t qHash(QSslEllipticCurve curve, size_t seed) noexcept;
|
||||
|
||||
friend class QSslContext;
|
||||
@ -87,12 +90,6 @@ Q_DECLARE_TYPEINFO(QSslEllipticCurve, Q_PRIMITIVE_TYPE);
|
||||
constexpr inline size_t qHash(QSslEllipticCurve curve, size_t seed) noexcept
|
||||
{ return qHash(curve.id, seed); }
|
||||
|
||||
constexpr inline bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept
|
||||
{ return lhs.id == rhs.id; }
|
||||
|
||||
constexpr inline bool operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept
|
||||
{ return !operator==(lhs, rhs); }
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
class QDebug;
|
||||
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QSslEllipticCurve curve);
|
||||
|
@ -240,7 +240,7 @@ int QSslPreSharedKeyAuthenticator::maximumPreSharedKeyLength() const
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QSslPreSharedKeyAuthenticator::operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
|
||||
\fn bool QSslPreSharedKeyAuthenticator::operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
|
||||
\since 5.5
|
||||
|
||||
Returns \c true if the authenticator object \a lhs is equal to \a rhs;
|
||||
@ -249,26 +249,27 @@ int QSslPreSharedKeyAuthenticator::maximumPreSharedKeyLength() const
|
||||
Two authenticator objects are equal if and only if they have the same
|
||||
identity hint, identity, pre shared key, maximum length for the identity
|
||||
and maximum length for the pre shared key.
|
||||
|
||||
*/
|
||||
bool operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
|
||||
{
|
||||
return ((lhs.d == rhs.d) ||
|
||||
(lhs.d->identityHint == rhs.d->identityHint &&
|
||||
lhs.d->identity == rhs.d->identity &&
|
||||
lhs.d->maximumIdentityLength == rhs.d->maximumIdentityLength &&
|
||||
lhs.d->preSharedKey == rhs.d->preSharedKey &&
|
||||
lhs.d->maximumPreSharedKeyLength == rhs.d->maximumPreSharedKeyLength));
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn bool operator!=(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
|
||||
\relates QSslPreSharedKeyAuthenticator
|
||||
\fn bool QSslPreSharedKeyAuthenticator::operator!=(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
|
||||
\since 5.5
|
||||
|
||||
Returns true if the authenticator object \a lhs is different than \a rhs;
|
||||
false otherwise.
|
||||
|
||||
Returns \c true if the authenticator object \a lhs is not equal to \a rhs;
|
||||
\c false otherwise.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
bool QSslPreSharedKeyAuthenticator::isEqual(const QSslPreSharedKeyAuthenticator &other) const
|
||||
{
|
||||
return ((d == other.d) ||
|
||||
(d->identityHint == other.d->identityHint &&
|
||||
d->identity == other.d->identity &&
|
||||
d->maximumIdentityLength == other.d->maximumIdentityLength &&
|
||||
d->preSharedKey == other.d->preSharedKey &&
|
||||
d->maximumPreSharedKeyLength == other.d->maximumPreSharedKeyLength));
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -74,17 +74,19 @@ public:
|
||||
Q_NETWORK_EXPORT int maximumPreSharedKeyLength() const;
|
||||
|
||||
private:
|
||||
friend Q_NETWORK_EXPORT bool operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs);
|
||||
bool isEqual(const QSslPreSharedKeyAuthenticator &other) const;
|
||||
|
||||
friend class QSslSocketBackendPrivate;
|
||||
friend class QDtlsPrivateOpenSSL;
|
||||
|
||||
friend bool operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
|
||||
{ return lhs.isEqual(rhs); }
|
||||
friend bool operator!=(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
|
||||
{ return !lhs.isEqual(rhs); }
|
||||
|
||||
QSharedDataPointer<QSslPreSharedKeyAuthenticatorPrivate> d;
|
||||
};
|
||||
|
||||
inline bool operator!=(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
|
||||
{
|
||||
return !operator==(lhs, rhs);
|
||||
}
|
||||
|
||||
Q_DECLARE_SHARED(QSslPreSharedKeyAuthenticator)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user