From 06ca5c49e7fb6dd23eab3a02de404c82e03bc5db Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 14 Oct 2019 15:23:48 +0200 Subject: [PATCH] Cbor: Avoid QUrl in bootstrap code QUrl is not available when building qmake. Hopefully we can get rid of this mess in Qt 6. Change-Id: Ia234996dd4f27d7f843db227e4cf2db869c92dc1 Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- src/corelib/serialization/qcborvalue.cpp | 8 ++++++++ src/corelib/serialization/qcborvalue.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp index 9053618014..1b170739d2 100644 --- a/src/corelib/serialization/qcborvalue.cpp +++ b/src/corelib/serialization/qcborvalue.cpp @@ -1765,6 +1765,7 @@ QCborValue::QCborValue(const QDateTime &dt) container->elements[1].type = String; } +#ifndef QT_BOOTSTRAPPED /*! Creates a QCborValue object of the URL extended type and containing the value represented by \a url. The value can later be retrieved using toUrl(). @@ -1781,6 +1782,7 @@ QCborValue::QCborValue(const QUrl &url) t = Url; container->elements[1].type = String; } +#endif #if QT_CONFIG(regularexpression) /*! @@ -1934,6 +1936,7 @@ QDateTime QCborValue::toDateTime(const QDateTime &defaultValue) const return QDateTime::fromString(byteData->asLatin1(), Qt::ISODateWithMs); } +#ifndef QT_BOOTSTRAPPED /*! Returns the URL value stored in this QCborValue, if it is of the URL extended type. Otherwise, it returns \a defaultValue. @@ -1954,6 +1957,7 @@ QUrl QCborValue::toUrl(const QUrl &defaultValue) const return QUrl::fromEncoded(byteData->asByteArrayView()); } +#endif #if QT_CONFIG(regularexpression) /*! @@ -2882,8 +2886,10 @@ uint qHash(const QCborValue &value, uint seed) return qHash(value.toDouble(), seed); case QCborValue::DateTime: return qHash(value.toDateTime(), seed); +#ifndef QT_BOOTSTRAPPED case QCborValue::Url: return qHash(value.toUrl(), seed); +#endif #if QT_CONFIG(regularexpression) case QCborValue::RegularExpression: return qHash(value.toRegularExpression(), seed); @@ -2936,8 +2942,10 @@ static QDebug debugContents(QDebug &dbg, const QCborValue &v) } case QCborValue::DateTime: return dbg << v.toDateTime(); +#ifndef QT_BOOTSTRAPPED case QCborValue::Url: return dbg << v.toUrl(); +#endif #if QT_CONFIG(regularexpression) case QCborValue::RegularExpression: return dbg << v.toRegularExpression(); diff --git a/src/corelib/serialization/qcborvalue.h b/src/corelib/serialization/qcborvalue.h index f79fc572c4..3c325b59e7 100644 --- a/src/corelib/serialization/qcborvalue.h +++ b/src/corelib/serialization/qcborvalue.h @@ -161,7 +161,9 @@ public: {} explicit QCborValue(const QDateTime &dt); +#ifndef QT_BOOTSTRAPPED explicit QCborValue(const QUrl &url); +#endif #if QT_CONFIG(regularexpression) explicit QCborValue(const QRegularExpression &rx); #endif @@ -387,8 +389,10 @@ public: { return concrete().toString(defaultValue); } QDateTime toDateTime(const QDateTime &defaultValue = {}) const { return concrete().toDateTime(defaultValue); } +#ifndef QT_BOOTSTRAPPED QUrl toUrl(const QUrl &defaultValue = {}) const { return concrete().toUrl(defaultValue); } +#endif #if QT_CONFIG(regularexpression) QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const { return concrete().toRegularExpression(defaultValue); }