diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2020-06-09 12:02:57 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2021-07-30 22:54:28 +0200 |
commit | 615a9cf99150cfee34c14cfed0aa9583f5993934 (patch) | |
tree | 80f69ace058792b1faf39f27ef6f6de97fbe52a8 /src/corelib/compat/removed_api.cpp | |
parent | 09fba5cf3657c19c38e897a11a015d45b4328ae3 (diff) |
QUuid: port to QAnyStringView
Remove the QString/QStringView/QLatin1String/const char* overloads
from the API, but not the ABI.
As a drive-by, replace a use of QStringView::left() by truncate(), as
suggested by a comment.
[ChangeLog][QtCore][QUuid] The from-string constructor and the
fromString() function now take QAnyStringView (was: overload set with
a subset of QString, QByteArray, const char*, QLatin1String,
QStringView each).
Change-Id: If7fa26cfbef9280480c78b669d9f5f14118995ed
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/compat/removed_api.cpp')
-rw-r--r-- | src/corelib/compat/removed_api.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index d5d71ce75a..b2e758d2ca 100644 --- a/src/corelib/compat/removed_api.cpp +++ b/src/corelib/compat/removed_api.cpp @@ -59,6 +59,31 @@ QByteArray QCryptographicHash::hash(const QByteArray &data, Algorithm method) #include "quuid.h" +QUuid::QUuid(const QString &text) + : QUuid{qToAnyStringViewIgnoringNull(text)} +{ +} + +QUuid::QUuid(const char *text) + : QUuid{QAnyStringView(text)} +{ +} + +QUuid::QUuid(const QByteArray &text) + : QUuid{qToAnyStringViewIgnoringNull(text)} +{ +} + +QUuid QUuid::fromString(QStringView string) noexcept +{ + return fromString(QAnyStringView{string}); +} + +QUuid QUuid::fromString(QLatin1String string) noexcept +{ + return fromString(QAnyStringView{string}); +} + QUuid QUuid::fromRfc4122(const QByteArray &bytes) { return fromRfc4122(qToByteArrayViewIgnoringNull(bytes)); |