Make QUUid constructors from string like types explicit

I don't think we want to have implicit conversion
from a const char * or a QByteArray to a QUuid.

Change-Id: Idfe7450ce15b89e295aa7af7ccf1fc94f5acd4f9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Lars Knoll 2020-07-09 21:01:00 +02:00 committed by Sona Kurazyan
parent 9067b8a456
commit 84f3690947
2 changed files with 6 additions and 6 deletions

View File

@ -123,13 +123,13 @@ public:
}
#endif
QUuid(const QString &);
explicit QUuid(const QString &);
static QUuid fromString(QStringView string) noexcept;
static QUuid fromString(QLatin1String string) noexcept;
QUuid(const char *);
explicit QUuid(const char *);
QString toString() const;
QString toString(StringFormat mode) const; // ### Qt6: merge with previous
QUuid(const QByteArray &);
explicit QUuid(const QByteArray &);
QByteArray toByteArray() const;
QByteArray toByteArray(StringFormat mode) const; // ### Qt6: merge with previous
QByteArray toRfc4122() const;

View File

@ -358,7 +358,7 @@ void tst_QUuid::variants()
QVERIFY( uuidA.variant() == QUuid::DCE );
QVERIFY( uuidB.variant() == QUuid::DCE );
QUuid NCS = "{3a2f883c-4000-000d-0000-00fb40000000}";
QUuid NCS("{3a2f883c-4000-000d-0000-00fb40000000}");
QVERIFY( NCS.variant() == QUuid::NCS );
}
@ -368,10 +368,10 @@ void tst_QUuid::versions()
QVERIFY( uuidA.version() == QUuid::Random );
QVERIFY( uuidB.version() == QUuid::Random );
QUuid DCE_time= "{406c45a0-3b7e-11d0-80a3-0000c08810a7}";
QUuid DCE_time("{406c45a0-3b7e-11d0-80a3-0000c08810a7}");
QVERIFY( DCE_time.version() == QUuid::Time );
QUuid NCS = "{3a2f883c-4000-000d-0000-00fb40000000}";
QUuid NCS("{3a2f883c-4000-000d-0000-00fb40000000}");
QVERIFY( NCS.version() == QUuid::VerUnknown );
}