Allow reading and writing settings through code

This commit is contained in:
WerWolv
2021-02-01 19:03:28 +01:00
parent 16a1ae3010
commit d9ec628333
2 changed files with 70 additions and 0 deletions

View File

@@ -42,6 +42,14 @@ namespace hex {
static void add(std::string_view category, std::string_view name, s64 defaultValue, const std::function<bool(nlohmann::json&)> &callback);
static void add(std::string_view category, std::string_view name, std::string_view defaultValue, const std::function<bool(nlohmann::json&)> &callback);
static void write(std::string_view category, std::string_view name, s64 value);
static void write(std::string_view category, std::string_view name, std::string_view value);
static void write(std::string_view category, std::string_view name, const std::vector<std::string>& value);
static s64 read(std::string_view category, std::string_view name, s64 defaultValue);
static std::string read(std::string_view category, std::string_view name, std::string_view defaultValue);
static std::vector<std::string> read(std::string_view category, std::string_view name, const std::vector<std::string>& defaultValue = { });
static std::map<std::string, std::vector<Entry>>& getEntries();
static nlohmann::json& getSettingsData();
};