RhythmGame 1.4.3
Loading...
Searching...
No Matches
SerializeConfig.h
Go to the documentation of this file.
1//
2// Created by bobini on 29.11.23.
3//
4
5#ifndef CONFIGSERIALIZER_H
6#define CONFIGSERIALIZER_H
8
9#include <QQmlPropertyMap>
10#include <filesystem>
11#include <QJsonObject>
12#include <QThreadPool>
13#include <mutex>
14
15namespace resource_managers {
16
17auto
18readJsonConfig(const std::filesystem::path& path) -> QJsonObject;
19void
20writeJsonConfig(const std::filesystem::path& path,
21 QJsonObject values,
22 bool merge = false);
23
24// Keeps at most one pending snapshot per file while a write is in progress.
26{
27 struct PendingWrite
28 {
29 QJsonObject values;
30 bool merge;
31 };
32 std::mutex mutex;
33 QHash<QString, PendingWrite> pending;
34 bool running{};
35 QThreadPool pool;
36
37 public:
39 void write(const std::filesystem::path& path,
40 QJsonObject values,
41 bool merge = false);
42};
43
44auto
45writeConfig(const std::filesystem::path& path, QQmlPropertyMap& object) -> void;
46auto
47readConfig(const std::filesystem::path& path,
48 QQmlPropertyMap& object,
49 const QMap<QString, qml_components::ThemeFamily>& themeFamilies)
50 -> void;
51
52} // namespace resource_managers
53
54#endif // CONFIGSERIALIZER_H
QString path
Definition Lr2SkinParser.cpp:87
Definition SerializeConfig.h:26
~ConfigWriter()
Definition SerializeConfig.cpp:81
void write(const std::filesystem::path &path, QJsonObject values, bool merge=false)
Definition SerializeConfig.cpp:87
Classes and functions related to loading and managing resources such as charts, sounds,...
Definition ProfileArenaIdentityProvider.h:12
auto writeConfig(const std::filesystem::path &path, QQmlPropertyMap &object) -> void
Definition SerializeConfig.cpp:125
void writeJsonConfig(const std::filesystem::path &path, QJsonObject values, bool merge)
Definition SerializeConfig.cpp:50
auto readConfig(const std::filesystem::path &path, QQmlPropertyMap &object, const QMap< QString, qml_components::ThemeFamily > &themeFamilies) -> void
Definition SerializeConfig.cpp:134
auto readJsonConfig(const std::filesystem::path &path) -> QJsonObject
Definition SerializeConfig.cpp:39