mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Refactor config API
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
//qt includes
|
||||
#include <QRegularExpression>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -158,4 +160,31 @@ namespace JsonUtils {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString jsonValueToQString(const QJsonValue &value, QJsonDocument::JsonFormat format)
|
||||
{
|
||||
switch (value.type()) {
|
||||
case QJsonValue::Object:
|
||||
{
|
||||
return QJsonDocument(value.toObject()).toJson(format);
|
||||
}
|
||||
case QJsonValue::Array:
|
||||
{
|
||||
return QJsonDocument(value.toArray()).toJson(format);
|
||||
}
|
||||
case QJsonValue::String:
|
||||
case QJsonValue::Double:
|
||||
case QJsonValue::Bool:
|
||||
{
|
||||
return value.toString();
|
||||
}
|
||||
case QJsonValue::Null:
|
||||
{
|
||||
return "Null";
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user