#pragma once #include "Common.h" /// /// 完成存档文件加载和保存 /// class Document { public: Document(); ~Document(); // 执行存档文件保存 bool Save(); // 执行存档文件加载 bool Load(const QString& strFullPath); // 保存路径是否为空 bool isSelPath() { // For Debug m_strSavePath = "./test.vpp"; return !m_strSavePath.isEmpty(); } // 设置保存路径 void setSavePath(const QString& strPath) { m_strSavePath = strPath; } // 获取保存路径 QString getSavePath() { return m_strSavePath; } private: // 写入当前版本号 bool saveVersion(); // 写入系统全局配置区段 bool saveConfig(); // 写入全局和局部变量区段 bool saveGVLs(); // 写入POU区段 bool savePOUs(); bool savePOU(PouManager* pPouManager, QJsonObject& objPou); // 写入硬件区段 bool saveHardwares(); // 压缩 bool compress(); // 解压缩 bool uncompress(); private: QString m_strSavePath; QJsonObject* m_pTotalDoc; };