diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-08-31 12:58:03 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-09-14 09:47:51 +0200 |
commit | ed2f5e7cf2df6843bec2260b238cbcb216ea1dca (patch) | |
tree | 88e9fc1aa5a88887fe4e038a21e3b6fdacbbe2bd /src/corelib/plugin | |
parent | 533df067e9869522b348d172fee85b2a501540b6 (diff) |
QUuid: merge toString() overloads and toByteArray() overloads
In each case, simply give WithBraces as default for mode, since that's
what _q_uuidToHex() used internally.
Task-number: QTBUG-85700
Change-Id: I9f6fddb259703917129d4be742bbdd2eb1647f44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r-- | src/corelib/plugin/quuid.cpp | 90 | ||||
-rw-r--r-- | src/corelib/plugin/quuid.h | 8 |
2 files changed, 4 insertions, 94 deletions
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index fc70ca1386..77f60c516f 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> ** Contact: https://www.qt.io/licensing/ ** @@ -569,49 +569,6 @@ QUuid QUuid::fromRfc4122(const QByteArray &bytes) */ /*! - Returns the string representation of this QUuid. The string is - formatted as five hex fields separated by '-' and enclosed in - curly braces, i.e., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where - 'x' is a hex digit. From left to right, the five hex fields are - obtained from the four public data members in QUuid as follows: - - \table - \header - \li Field # - \li Source - - \row - \li 1 - \li data1 - - \row - \li 2 - \li data2 - - \row - \li 3 - \li data3 - - \row - \li 4 - \li data4[0] .. data4[1] - - \row - \li 5 - \li data4[2] .. data4[7] - - \endtable -*/ -QString QUuid::toString() const -{ - char latin1[MaxStringUuidLength]; - const auto end = _q_uuidToHex(*this, latin1); - Q_ASSERT(end - latin1 == MaxStringUuidLength); - Q_UNUSED(end); - return QString::fromLatin1(latin1, MaxStringUuidLength); -} - -/*! \since 5.11 Returns the string representation of this QUuid, with the formattiong @@ -653,51 +610,6 @@ QString QUuid::toString(QUuid::StringFormat mode) const } /*! - Returns the binary representation of this QUuid. The byte array is - formatted as five hex fields separated by '-' and enclosed in - curly braces, i.e., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where - 'x' is a hex digit. From left to right, the five hex fields are - obtained from the four public data members in QUuid as follows: - - \table - \header - \li Field # - \li Source - - \row - \li 1 - \li data1 - - \row - \li 2 - \li data2 - - \row - \li 3 - \li data3 - - \row - \li 4 - \li data4[0] .. data4[1] - - \row - \li 5 - \li data4[2] .. data4[7] - - \endtable - - \since 4.8 -*/ -QByteArray QUuid::toByteArray() const -{ - QByteArray result(MaxStringUuidLength, Qt::Uninitialized); - const auto end = _q_uuidToHex(*this, const_cast<char*>(result.constData())); - Q_ASSERT(end - result.constData() == MaxStringUuidLength); - Q_UNUSED(end); - return result; -} - -/*! \since 5.11 Returns the string representation of this QUuid, with the formattiong diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index cc5745992c..bfea13f9fc 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -127,11 +127,9 @@ public: static QUuid fromString(QStringView string) noexcept; static QUuid fromString(QLatin1String string) noexcept; explicit QUuid(const char *); - QString toString() const; - QString toString(StringFormat mode) const; // ### Qt6: merge with previous + QString toString(StringFormat mode = WithBraces) const; explicit QUuid(const QByteArray &); - QByteArray toByteArray() const; - QByteArray toByteArray(StringFormat mode) const; // ### Qt6: merge with previous + QByteArray toByteArray(StringFormat mode = WithBraces) const; QByteArray toRfc4122() const; static QUuid fromRfc4122(const QByteArray &); bool isNull() const noexcept; |