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 <type_traits>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
#include "projectloader.h"
|
#include "projectloader.h"
|
||||||
|
|
||||||
@ -299,9 +305,9 @@ template <detail::Listific T>
|
|||||||
std::expected<QJsonArray, QString> save(const T &val) {
|
std::expected<QJsonArray, QString> save(const T &val) {
|
||||||
QJsonArray arr;
|
QJsonArray arr;
|
||||||
|
|
||||||
for (size_t i = 0; i < val.size(); i++) {
|
size_t i = 0;
|
||||||
const auto &el = val[i];
|
for (auto it = std::cbegin(val); it != std::cend(val); it++, i++) {
|
||||||
auto json = save<typename T::value_type>(el);
|
auto json = save<typename T::value_type>(*it);
|
||||||
if (json) {
|
if (json) {
|
||||||
arr.push_back(json.value());
|
arr.push_back(json.value());
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,16 +2,12 @@
|
|||||||
#define PROJECTLOADER_H
|
#define PROJECTLOADER_H
|
||||||
|
|
||||||
#include <expected>
|
#include <expected>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QString>
|
||||||
|
|
||||||
#include "lightproject.h"
|
#include "lightproject.h"
|
||||||
|
|
||||||
#include "projectloader.h"
|
|
||||||
|
|
||||||
namespace ProjectLoader {
|
namespace ProjectLoader {
|
||||||
|
|
||||||
std::expected<LightProject, QString> loadProject(const QJsonDocument &json);
|
std::expected<LightProject, QString> loadProject(const QJsonDocument &json);
|
||||||
|
Reference in New Issue
Block a user