QJson: Remove QT_JSON_READONLY

moc (and thus the bootstrap library) has needed JSON output since Qt
5.15 (commit da284ef10e0ef80776b9fc9b7bb0e6dc8d71ba63 "Add support for
machine-readable JSON output to the MOC").

Pick-to: 6.9
Change-Id: I4b8cf51c092eb35cc383fffd48d120f0cb2c56b0
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Johannes Grunenberg <nerixdev@outlook.de>
This commit is contained in:
Thiago Macieira 2024-12-29 21:34:30 -03:00
parent 9d35561f6f
commit 029bb47e12
9 changed files with 9 additions and 17 deletions

View File

@ -1073,7 +1073,7 @@ size_t qHash(const QJsonArray &array, size_t seed)
return qHashRange(array.begin(), array.end(), seed);
}
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
#if !defined(QT_NO_DEBUG_STREAM)
QDebug operator<<(QDebug dbg, const QJsonArray &a)
{
QDebugStateSaver saver(dbg);

View File

@ -325,7 +325,7 @@ inline QJsonValueConstRef::QJsonValueConstRef(QJsonArray *a, qsizetype idx)
Q_CORE_EXPORT size_t qHash(const QJsonArray &array, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonArray &);
#endif

View File

@ -129,7 +129,7 @@ static Q_NEVER_INLINE QString makeString(const QCborContainerPrivate *d, qsizety
case QCborValue::Array:
case QCborValue::Map:
#if defined(QT_JSON_READONLY) || defined(QT_BOOTSTRAPPED)
#if defined(QT_BOOTSTRAPPED)
Q_UNREACHABLE_RETURN(QString());
#else
return d->valueAt(idx).toDiagnosticNotation(QCborValue::Compact);

View File

@ -242,7 +242,6 @@ QVariant QJsonDocument::toVariant() const
\sa fromJson(), JsonFormat
*/
#if !defined(QT_JSON_READONLY) || defined(Q_QDOC)
QByteArray QJsonDocument::toJson(JsonFormat format) const
{
QByteArray json;
@ -253,7 +252,6 @@ QByteArray QJsonDocument::toJson(JsonFormat format) const
format == JsonFormat::Compact ? QJsonValue::JsonFormat::Compact
: QJsonValue::JsonFormat::Indented);
}
#endif
/*!
Parses \a json as a UTF-8 encoded JSON document, and creates a QJsonDocument
@ -472,7 +470,7 @@ bool QJsonDocument::isNull() const
return (d == nullptr);
}
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
#if !defined(QT_NO_DEBUG_STREAM)
QDebug operator<<(QDebug dbg, const QJsonDocument &o)
{
QDebugStateSaver saver(dbg);

View File

@ -74,9 +74,7 @@ public:
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = nullptr);
#if !defined(QT_JSON_READONLY) || defined(Q_QDOC)
QByteArray toJson(JsonFormat format = JsonFormat::Indented) const;
#endif
bool isEmpty() const;
bool isArray() const;
@ -113,7 +111,7 @@ private:
Q_DECLARE_SHARED(QJsonDocument)
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonDocument &);
#endif

View File

@ -1424,7 +1424,7 @@ size_t qHash(const QJsonObject &object, size_t seed)
return seed;
}
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
#if !defined(QT_NO_DEBUG_STREAM)
QDebug operator<<(QDebug dbg, const QJsonObject &o)
{
QDebugStateSaver saver(dbg);

View File

@ -366,7 +366,7 @@ inline QJsonValueConstRef::QJsonValueConstRef(QJsonObject *o, qsizetype idx)
Q_CORE_EXPORT size_t qHash(const QJsonObject &object, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonObject &);
#endif

View File

@ -642,7 +642,6 @@ QJsonValue QJsonValue::fromJson(QByteArrayView json, QJsonParseError *error)
\sa fromJson(), JsonFormat
*/
#if !defined(QT_JSON_READONLY) || defined(Q_QDOC)
QByteArray QJsonValue::toJson(JsonFormat format) const
{
QByteArray json;
@ -651,7 +650,6 @@ QByteArray QJsonValue::toJson(JsonFormat format) const
return json;
}
#endif
/*!
Returns the type of the value.
@ -1168,7 +1166,7 @@ size_t qHash(const QJsonValue &value, size_t seed)
Q_UNREACHABLE_RETURN(0);
}
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
#if !defined(QT_NO_DEBUG_STREAM)
QDebug operator<<(QDebug dbg, const QJsonValue &o)
{
QDebugStateSaver saver(dbg);

View File

@ -83,9 +83,7 @@ public:
static QJsonValue fromJson(QByteArrayView json, QJsonParseError *error = nullptr);
#if !defined(QT_JSON_READONLY) || defined(Q_QDOC)
QByteArray toJson(JsonFormat format = JsonFormat::Indented) const;
#endif
Type type() const;
inline bool isNull() const { return type() == Null; }
@ -333,7 +331,7 @@ inline QJsonValue QCborValueConstRef::toJsonValue() const
Q_CORE_EXPORT size_t qHash(const QJsonValue &value, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonValue &);
#endif