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 <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ulf Hermann 2019-10-14 15:23:48 +02:00
parent 80ddac3a0a
commit 06ca5c49e7
2 changed files with 12 additions and 0 deletions

View File

@ -1765,6 +1765,7 @@ QCborValue::QCborValue(const QDateTime &dt)
container->elements[1].type = String; container->elements[1].type = String;
} }
#ifndef QT_BOOTSTRAPPED
/*! /*!
Creates a QCborValue object of the URL extended type and containing the 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(). value represented by \a url. The value can later be retrieved using toUrl().
@ -1781,6 +1782,7 @@ QCborValue::QCborValue(const QUrl &url)
t = Url; t = Url;
container->elements[1].type = String; container->elements[1].type = String;
} }
#endif
#if QT_CONFIG(regularexpression) #if QT_CONFIG(regularexpression)
/*! /*!
@ -1934,6 +1936,7 @@ QDateTime QCborValue::toDateTime(const QDateTime &defaultValue) const
return QDateTime::fromString(byteData->asLatin1(), Qt::ISODateWithMs); return QDateTime::fromString(byteData->asLatin1(), Qt::ISODateWithMs);
} }
#ifndef QT_BOOTSTRAPPED
/*! /*!
Returns the URL value stored in this QCborValue, if it is of the URL Returns the URL value stored in this QCborValue, if it is of the URL
extended type. Otherwise, it returns \a defaultValue. extended type. Otherwise, it returns \a defaultValue.
@ -1954,6 +1957,7 @@ QUrl QCborValue::toUrl(const QUrl &defaultValue) const
return QUrl::fromEncoded(byteData->asByteArrayView()); return QUrl::fromEncoded(byteData->asByteArrayView());
} }
#endif
#if QT_CONFIG(regularexpression) #if QT_CONFIG(regularexpression)
/*! /*!
@ -2882,8 +2886,10 @@ uint qHash(const QCborValue &value, uint seed)
return qHash(value.toDouble(), seed); return qHash(value.toDouble(), seed);
case QCborValue::DateTime: case QCborValue::DateTime:
return qHash(value.toDateTime(), seed); return qHash(value.toDateTime(), seed);
#ifndef QT_BOOTSTRAPPED
case QCborValue::Url: case QCborValue::Url:
return qHash(value.toUrl(), seed); return qHash(value.toUrl(), seed);
#endif
#if QT_CONFIG(regularexpression) #if QT_CONFIG(regularexpression)
case QCborValue::RegularExpression: case QCborValue::RegularExpression:
return qHash(value.toRegularExpression(), seed); return qHash(value.toRegularExpression(), seed);
@ -2936,8 +2942,10 @@ static QDebug debugContents(QDebug &dbg, const QCborValue &v)
} }
case QCborValue::DateTime: case QCborValue::DateTime:
return dbg << v.toDateTime(); return dbg << v.toDateTime();
#ifndef QT_BOOTSTRAPPED
case QCborValue::Url: case QCborValue::Url:
return dbg << v.toUrl(); return dbg << v.toUrl();
#endif
#if QT_CONFIG(regularexpression) #if QT_CONFIG(regularexpression)
case QCborValue::RegularExpression: case QCborValue::RegularExpression:
return dbg << v.toRegularExpression(); return dbg << v.toRegularExpression();

View File

@ -161,7 +161,9 @@ public:
{} {}
explicit QCborValue(const QDateTime &dt); explicit QCborValue(const QDateTime &dt);
#ifndef QT_BOOTSTRAPPED
explicit QCborValue(const QUrl &url); explicit QCborValue(const QUrl &url);
#endif
#if QT_CONFIG(regularexpression) #if QT_CONFIG(regularexpression)
explicit QCborValue(const QRegularExpression &rx); explicit QCborValue(const QRegularExpression &rx);
#endif #endif
@ -387,8 +389,10 @@ public:
{ return concrete().toString(defaultValue); } { return concrete().toString(defaultValue); }
QDateTime toDateTime(const QDateTime &defaultValue = {}) const QDateTime toDateTime(const QDateTime &defaultValue = {}) const
{ return concrete().toDateTime(defaultValue); } { return concrete().toDateTime(defaultValue); }
#ifndef QT_BOOTSTRAPPED
QUrl toUrl(const QUrl &defaultValue = {}) const QUrl toUrl(const QUrl &defaultValue = {}) const
{ return concrete().toUrl(defaultValue); } { return concrete().toUrl(defaultValue); }
#endif
#if QT_CONFIG(regularexpression) #if QT_CONFIG(regularexpression)
QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const
{ return concrete().toRegularExpression(defaultValue); } { return concrete().toRegularExpression(defaultValue); }