#pragma once #include #include #include #include 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