Document_Json.h 945 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #pragma once
  2. #include "Common.h"
  3. /// <summary>
  4. /// 完成存档文件加载和保存
  5. /// </summary>
  6. class Document
  7. {
  8. public:
  9. Document();
  10. ~Document();
  11. // 执行存档文件保存
  12. bool Save();
  13. // 执行存档文件加载
  14. bool Load(const QString& strFullPath);
  15. // 保存路径是否为空
  16. bool isSelPath()
  17. {
  18. // For Debug
  19. m_strSavePath = "./test.vpp";
  20. return !m_strSavePath.isEmpty();
  21. }
  22. // 设置保存路径
  23. void setSavePath(const QString& strPath)
  24. {
  25. m_strSavePath = strPath;
  26. }
  27. // 获取保存路径
  28. QString getSavePath()
  29. {
  30. return m_strSavePath;
  31. }
  32. private:
  33. // 写入当前版本号
  34. bool saveVersion();
  35. // 写入系统全局配置区段
  36. bool saveConfig();
  37. // 写入全局和局部变量区段
  38. bool saveGVLs();
  39. // 写入POU区段
  40. bool savePOUs();
  41. bool savePOU(PouManager* pPouManager, QJsonObject& objPou);
  42. // 写入硬件区段
  43. bool saveHardwares();
  44. // 压缩
  45. bool compress();
  46. // 解压缩
  47. bool uncompress();
  48. private:
  49. QString m_strSavePath;
  50. QJsonObject* m_pTotalDoc;
  51. };