This commit is contained in:
2026-05-14 13:30:06 +08:00
parent 974946cee4
commit e43171521d
91 changed files with 10485 additions and 3254 deletions
+20
View File
@@ -0,0 +1,20 @@
#pragma once
#include <QByteArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QString>
namespace core::persistence {
/// 原子写 JSON:写入 .tmp 后 rename 覆盖,避免截断导致下次打开“损坏”。
bool writeJsonAtomic(const QString& absolutePath, const QJsonObject& obj, bool pretty = true);
/// 读取 JSON 文件(必须为 object)。失败返回 false。
bool readJsonObject(const QString& absolutePath, QJsonObject& out);
/// 原子写 bytes:写入 .tmp 后 rename 覆盖。
bool writeBytesAtomic(const QString& absolutePath, const QByteArray& bytes);
} // namespace core::persistence