# GpgFrontend Project: src/core/function/DataObjectOperator.h Source File

DataObjectOperator.h
#ifndef GPGFRONTEND_DATAOBJECTOPERATOR_H
#define GPGFRONTEND_DATAOBJECTOPERATOR_H
#include "core/GpgFrontendCore.h"
#include "core/GpgFunctionObject.h"
#include "core/function/GlobalSettingStation.h"
namespace GpgFrontend {
class GPGFRONTEND_CORE_EXPORT DataObjectOperator
: public SingletonFunctionObject<DataObjectOperator> {
public:
explicit DataObjectOperator(
int channel = SingletonFunctionObject::GetDefaultChannel());
std::string SaveDataObj(const std::string &_key, const nlohmann::json &value);
std::optional<nlohmann::json> GetDataObject(const std::string &_key);
std::optional<nlohmann::json> GetDataObjectByRef(const std::string &_ref);
private:
void init_app_secure_key();
GlobalSettingStation &global_setting_station_ =
GlobalSettingStation::GetInstance();
std::filesystem::path app_secure_path_ =
global_setting_station_.GetAppConfigPath() /
"secure";
std::filesystem::path app_secure_key_path_ =
app_secure_path_ / "app.key";
std::filesystem::path app_data_objs_path_ =
global_setting_station_.GetAppDataPath() / "data_objs";
std::random_device rd_;
std::mt19937 mt_ = std::mt19937(rd_());
QByteArray hash_key_;
};
} // namespace GpgFrontend
#endif // GPGFRONTEND_DATAOBJECTOPERATOR_H
GpgFrontend::DataObjectOperator
Definition: DataObjectOperator.h:39
GpgFrontend::DataObjectOperator::rd_
std::random_device rd_
Random device.
Definition: DataObjectOperator.h:74
GpgFrontend::DataObjectOperator::hash_key_
QByteArray hash_key_
Hash key.
Definition: DataObjectOperator.h:76
GpgFrontend::GlobalSettingStation
Definition: GlobalSettingStation.h:43
GpgFrontend::SingletonFunctionObject
Definition: GpgFunctionObject.h:150
GpgFrontend::SingletonFunctionObject::GetDefaultChannel
static int GetDefaultChannel()
Get the Default Channel object.
Definition: GpgFunctionObject.h:251
GpgFrontend::SingletonFunctionObject< GlobalSettingStation >::GetInstance
static GlobalSettingStation & GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)
Get the Instance object.
Definition: GpgFunctionObject.h:172
GpgFrontend
Definition: CoreCommonUtil.cpp:31