mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2025-03-14 04:18:29 +00:00
NOISSUE add a way to require object from Json value ref
This commit is contained in:
parent
8bced9da83
commit
e044744faf
@ -78,6 +78,14 @@ QJsonObject requireObject(const QJsonDocument &doc, const QString &what)
|
||||
}
|
||||
return doc.object();
|
||||
}
|
||||
QJsonObject requireObject(const QJsonValueRef &node, const QString &what)
|
||||
{
|
||||
if (!node.isObject())
|
||||
{
|
||||
throw JsonException(what + " is not an object");
|
||||
}
|
||||
return node.toObject();
|
||||
}
|
||||
QJsonArray requireArray(const QJsonDocument &doc, const QString &what)
|
||||
{
|
||||
if (!doc.isArray())
|
||||
|
@ -41,6 +41,8 @@ QJsonDocument requireDocument(const QString &filename, const QString &what = "Do
|
||||
/// @throw JsonException
|
||||
QJsonObject requireObject(const QJsonDocument &doc, const QString &what = "Document");
|
||||
/// @throw JsonException
|
||||
QJsonObject requireObject(const QJsonValueRef &node, const QString &what = "Node");
|
||||
/// @throw JsonException
|
||||
QJsonArray requireArray(const QJsonDocument &doc, const QString &what = "Document");
|
||||
|
||||
/////////////////// WRITING ////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user