ProjectLoader: replace access to listific with iterator; minor fixes
This commit is contained in:
@ -1,4 +1,10 @@
|
||||
#include <concepts>
|
||||
#include <list>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "projectloader.h"
|
||||
|
||||
@ -299,9 +305,9 @@ template <detail::Listific T>
|
||||
std::expected<QJsonArray, QString> save(const T &val) {
|
||||
QJsonArray arr;
|
||||
|
||||
for (size_t i = 0; i < val.size(); i++) {
|
||||
const auto &el = val[i];
|
||||
auto json = save<typename T::value_type>(el);
|
||||
size_t i = 0;
|
||||
for (auto it = std::cbegin(val); it != std::cend(val); it++, i++) {
|
||||
auto json = save<typename T::value_type>(*it);
|
||||
if (json) {
|
||||
arr.push_back(json.value());
|
||||
} else {
|
||||
|
@ -2,16 +2,12 @@
|
||||
#define PROJECTLOADER_H
|
||||
|
||||
#include <expected>
|
||||
#include <vector>
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QString>
|
||||
|
||||
#include "lightproject.h"
|
||||
|
||||
#include "projectloader.h"
|
||||
|
||||
namespace ProjectLoader {
|
||||
|
||||
std::expected<LightProject, QString> loadProject(const QJsonDocument &json);
|
||||
|
Reference in New Issue
Block a user