Skip to content

Commit

Permalink
QUuid: add a named fromUInt128() ctor
Browse files Browse the repository at this point in the history
This makes the API symmetric again (fromBytes()/toBytes(),
fromString()/toString(), fromUInt128()/toUInt128()), but also gives us
the option to remove the QUuid(quint128), should we so choose, because
of its overly-broad argument matching range.

Found in API review.

Pick-to: 6.6
Change-Id: I91bd2450d62ed565ec3b8e46c875f4983bd9dc73
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
marcmutz committed Aug 11, 2023
1 parent 7bbd707 commit 70835a9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/corelib/plugin/quuid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,19 @@ static QUuid createFromName(const QUuid &ns, const QByteArray &baseData, QCrypto
\note This function is only present on platforms that offer a 128-bit
integer type.
\sa toUInt128(), fromUInt128(), fromBytes(), toBytes(), toRfc4122()
*/

/*!
\fn QUuid::fromUInt128(quint128 uuid, QSysInfo::Endian order) noexcept
\since 6.6
Creates a QUuid based on the integral \a uuid parameter and respecting the
byte order \a order.
\note This function is only present on platforms that offer a 128-bit
integer type.
\sa toUInt128(), fromBytes(), toBytes(), toRfc4122()
*/

Expand All @@ -335,7 +348,7 @@ static QUuid createFromName(const QUuid &ns, const QByteArray &baseData, QCrypto
\note This function is only present on platforms that offer a 128-bit
integer type.
\sa toRfc4122(), toBytes(), fromBytes(), QUuid()
\sa toRfc4122(), fromUInt128(), toBytes(), fromBytes(), QUuid()
*/

/*!
Expand Down
2 changes: 2 additions & 0 deletions src/corelib/plugin/quuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ class Q_CORE_EXPORT QUuid

#ifdef QT_SUPPORTS_INT128
constexpr explicit QUuid(quint128 uuid, QSysInfo::Endian order = QSysInfo::BigEndian) noexcept;
static constexpr QUuid fromUInt128(quint128 uuid, QSysInfo::Endian order = QSysInfo::BigEndian) noexcept
{ return QUuid{uuid, order}; }
constexpr quint128 toUInt128(QSysInfo::Endian order = QSysInfo::BigEndian) const noexcept;
#endif

Expand Down

0 comments on commit 70835a9

Please sign in to comment.