mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-10-03 08:41:42 +00:00
NOISSUE add a way to require object from Json value ref
This commit is contained in:
@@ -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 ////////////////////
|
||||
|
Reference in New Issue
Block a user