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/Genus/CheckableItems.cpp

37 lines
706 B
C++
Raw Normal View History

#include "CheckableItems.h"
2018-05-23 09:08:50 +00:00
#include <QJsonArray>
CheckableItems::CheckableItems(std::initializer_list<std::string> itemNames)
{
for (const auto &itemName : itemNames)
{
emplace_back(itemName);
}
}
void CheckableItems::write(QJsonArray &json) const
{
2018-05-23 09:08:50 +00:00
for (const auto &item : *this)
{
QJsonObject itemObject;
item.write(itemObject);
json.append(itemObject);
}
}
void CheckableItems::read(const QJsonArray &json)
{
clear();
for (const auto &itemObject : json)
{
2018-05-23 09:08:50 +00:00
if (itemObject.isObject())
{
CheckableItem item;
item.read(itemObject.toObject());
emplace_back(item);
}
}
}