14 #include <QJsonDocument> 15 #include <QJsonObject> 22 template<
typename,
typename>
34 template<QJsonValue::Type Expected>
35 auto As (
const QJsonValue& value)
37 if (value.type () != Expected) [[unlikely]]
40 if constexpr (Expected == QJsonValue::Array)
41 return value.toArray ();
42 if constexpr (Expected == QJsonValue::Object)
43 return value.toObject ();
44 if constexpr (Expected == QJsonValue::String)
45 return value.toString ();
46 if constexpr (Expected == QJsonValue::Double)
47 return value.toDouble ();
48 if constexpr (Expected == QJsonValue::Bool)
49 return value.toBool ();
52 template<QJsonValue::Type Expected>
53 requires (Expected == QJsonValue::Object || Expected == QJsonValue::Array)
54 auto As (
const QJsonDocument& doc)
56 if constexpr (Expected == QJsonValue::Object)
61 else if constexpr (Expected == QJsonValue::Array)
Either< QString, QJsonDocument > ToJson(const QByteArray &json)
auto As(const QJsonValue &value)
Type
Describes the various types of XDG .desktop files.
requires(Tup1Size==Tup2Size) const expr auto ZipWith(Tup1 &&tup1