File: converters.cpp

package info (click to toggle)
libquotient 0.9.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,596 kB
  • sloc: xml: 39,103; cpp: 25,274; sh: 97; makefile: 9
file content (35 lines) | stat: -rw-r--r-- 833 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// SPDX-FileCopyrightText: 2018 Kitsune Ral <kitsune-ral@users.sf.net>
// SPDX-License-Identifier: LGPL-2.1-or-later

#include "converters.h"

#include "logging_categories_p.h"

#include <QtCore/QVariant>

void Quotient::_impl::reportEnumOutOfBounds(uint32_t v, const char* enumTypeName)
{
    qCritical(MAIN).noquote()
        << "Value" << v << "is out of bounds for enumeration" << enumTypeName;
}

QJsonValue Quotient::JsonConverter<QVariant>::dump(const QVariant& v)
{
    return QJsonValue::fromVariant(v);
}

QVariant Quotient::JsonConverter<QVariant>::load(const QJsonValue& jv)
{
    return jv.toVariant();
}

QJsonObject Quotient::toJson(const QVariantHash& vh)
{
    return QJsonObject::fromVariantHash(vh);
}

template<>
QVariantHash Quotient::fromJson(const QJsonValue& jv)
{
    return jv.toObject().toVariantHash();
}