GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
DataObjectOperator.h
1 
29 #pragma once
30 
31 #include <optional>
32 
33 #include "core/function/GlobalSettingStation.h"
34 #include "core/function/basic/GpgFunctionObject.h"
35 
36 namespace GpgFrontend {
37 
38 class GPGFRONTEND_CORE_EXPORT DataObjectOperator
39  : public SingletonFunctionObject<DataObjectOperator> {
40  public:
46  explicit DataObjectOperator(
48 
49  auto SaveDataObj(const QString &_key, const QJsonDocument &value) -> QString;
50 
51  auto GetDataObject(const QString &_key) -> std::optional<QJsonDocument>;
52 
53  auto GetDataObjectByRef(const QString &_ref) -> std::optional<QJsonDocument>;
54 
55  private:
60  void init_app_secure_key();
61 
62  GlobalSettingStation &global_setting_station_ =
64  QString app_secure_path_ =
65  global_setting_station_.GetAppDataPath() +
66  "/secure";
67  QString app_secure_key_path_ =
68  app_secure_path_ +
69  "/app.key";
70  QString app_data_objs_path_ =
71  global_setting_station_.GetAppDataPath() + "/data_objs";
72 
73  QByteArray hash_key_;
74 };
75 
76 } // namespace GpgFrontend
Definition: DataObjectOperator.h:39
QByteArray hash_key_
Hash key.
Definition: DataObjectOperator.h:73
Singleton class for managing global settings in the application.
Definition: GlobalSettingStation.h:43
auto GetAppDataPath() const -> QString
Gets the application data directory.
Definition: GlobalSettingStation.cpp:149
Definition: GpgFunctionObject.h:58
static auto GetInstance(int channel=GpgFrontend::kGpgFrontendDefaultChannel) -> GlobalSettingStation &
Get the Instance object.
Definition: GpgFunctionObject.h:80
static auto GetDefaultChannel() -> int
Get the Default Channel object.
Definition: GpgFunctionObject.h:131
Definition: app.cpp:39