This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
ESGRAF48/source/DataModel.cpp

35 lines
619 B
C++

#include "DataModel.h"
DataModel::DataModel(QObject *parent)
: QObject(parent)
, m_metaData(this)
, m_genus(this)
{
}
void DataModel::write(QJsonObject &target) const
{
QJsonObject metaData;
m_metaData.write(metaData);
target["MetaData"] = metaData;
QJsonObject genus;
m_genus.write(genus);
target["Genus"] = genus;
}
void DataModel::read(const QJsonObject &source)
{
const auto &metaData = source["MetaData"];
if (metaData.isObject())
{
m_metaData.read(metaData.toObject());
}
const auto &genus = source["Genus"];
if (genus.isObject())
{
m_genus.read(genus.toObject());
}
}