76 ref.
path = json[QLatin1String(
"path")].toString();
77 ref.
sha256 = json[QLatin1String(
"sha256")].toString();
78 ref.
format = json[QLatin1String(
"format")].toString();
79 ref.
sizeBytes =
static_cast<qint64
>(json[QLatin1String(
"size_bytes")].toDouble());
80 ref.
embedded = json[QLatin1String(
"embedded")].toBool();
82 ref.
data = QByteArray::fromBase64(json[QLatin1String(
"data")].toString().toLatin1());
85 static const QSet<QString> knownKeys = {
86 QStringLiteral(
"role"), QStringLiteral(
"path"),
87 QStringLiteral(
"sha256"), QStringLiteral(
"format"),
88 QStringLiteral(
"size_bytes"), QStringLiteral(
"embedded"),
89 QStringLiteral(
"data")
91 for (
auto it = json.constBegin(); it != json.constEnd(); ++it) {
92 if (!knownKeys.contains(it.key()))
93 ref.
extras.insert(it.key(), it.value());
122 ref.
path = cbor[QLatin1String(
"path")].toString();
123 ref.
sha256 = cbor[QLatin1String(
"sha256")].toString();
124 ref.
format = cbor[QLatin1String(
"format")].toString();
125 ref.
sizeBytes = cbor[QLatin1String(
"size_bytes")].toInteger();
126 ref.
embedded = cbor[QLatin1String(
"embedded")].toBool();
128 ref.
data = cbor[QLatin1String(
"data")].toByteArray();
131 static const QSet<QString> knownKeys = {
132 QStringLiteral(
"role"), QStringLiteral(
"path"),
133 QStringLiteral(
"sha256"), QStringLiteral(
"format"),
134 QStringLiteral(
"size_bytes"), QStringLiteral(
"embedded"),
135 QStringLiteral(
"data")
137 QJsonObject cborJson = cbor.toJsonObject();
138 for (
auto it = cborJson.constBegin(); it != cborJson.constEnd(); ++it) {
139 if (!knownKeys.contains(it.key()))
140 ref.
extras.insert(it.key(), it.value());