diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2024-05-21 13:27:40 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2024-05-29 14:24:30 +0200 |
| commit | d8131960d89a51fd4c860944cc32b00e496da2d9 (patch) | |
| tree | bc9f3c34251e581a2d63a25f3aad16c9263ee8b0 /src/corelib/plugin/quuid.cpp | |
| parent | fa8256bb5a36aa18480bc603d538bf07c8464ec7 (diff) | |
QUuid: port createUuidV{3,5}() to QByteArrayView
Requires to mark the existing QString overload as Q_WEAK_OVERLOAD.¹
And since this non-polymorphic class is exported wholesale, we need to
involve REMOVED_SINCE here, too.
¹ While QString and QByteArray don't overload well, the new overload
set makes calls with QByteArray arguments ambiguous, unless the
QString overload is demoted to a weak one.
As a drive-by, change the QUuid argument passing from cref to
by-value, fixing a Clazy warning.
[ChangeLog][QtCore][QUuid] Ported createUuidV3() and createUuidV5()
from QByteArray to QByteArrayView, made them noexcept, and fixed
various ambiguities in the overload set.
Change-Id: I9f71209f2ddb58ace4e15fb68418b1a21d2b3602
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/plugin/quuid.cpp')
| -rw-r--r-- | src/corelib/plugin/quuid.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 99f8ee30b0d..b3fad47ee69 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -532,11 +532,14 @@ QUuid QUuid::fromString(QAnyStringView text) noexcept /*! \since 5.0 - \fn QUuid QUuid::createUuidV3(const QUuid &ns, const QByteArray &baseData); + \fn QUuid QUuid::createUuidV3(QUuid ns, QByteArrayView baseData); This function returns a new UUID with variant QUuid::DCE and version QUuid::Md5. \a ns is the namespace and \a baseData is the basic data as described by RFC 4122. + \note In Qt versions prior to 6.8, this function took QByteArray, not + QByteArrayView. + \sa variant(), version(), createUuidV5() */ @@ -552,11 +555,14 @@ QUuid QUuid::fromString(QAnyStringView text) noexcept /*! \since 5.0 - \fn QUuid QUuid::createUuidV5(const QUuid &ns, const QByteArray &baseData); + \fn QUuid QUuid::createUuidV5(QUuid ns, QByteArrayView baseData); This function returns a new UUID with variant QUuid::DCE and version QUuid::Sha1. \a ns is the namespace and \a baseData is the basic data as described by RFC 4122. + \note In Qt versions prior to 6.8, this function took QByteArray, not + QByteArrayView. + \sa variant(), version(), createUuidV3() */ @@ -570,13 +576,13 @@ QUuid QUuid::fromString(QAnyStringView text) noexcept \sa variant(), version(), createUuidV3() */ #ifndef QT_BOOTSTRAPPED -QUuid QUuid::createUuidV3(const QUuid &ns, const QByteArray &baseData) noexcept +QUuid QUuid::createUuidV3(QUuid ns, QByteArrayView baseData) noexcept { return createFromName(ns, baseData, QCryptographicHash::Md5, 3); } #endif -QUuid QUuid::createUuidV5(const QUuid &ns, const QByteArray &baseData) noexcept +QUuid QUuid::createUuidV5(QUuid ns, QByteArrayView baseData) noexcept { return createFromName(ns, baseData, QCryptographicHash::Sha1, 5); } |
