duckstation/src/common/memory_settings_interface.h

53 lines
2.3 KiB
C
Raw Normal View History

2021-07-23 14:02:09 +00:00
#pragma once
2022-07-09 04:17:57 +00:00
#include "heterogeneous_containers.h"
#include "settings_interface.h"
2021-07-23 14:02:09 +00:00
#include <string>
2022-07-09 04:17:57 +00:00
class MemorySettingsInterface final : public SettingsInterface
2021-07-23 14:02:09 +00:00
{
public:
2022-07-09 04:17:57 +00:00
MemorySettingsInterface();
~MemorySettingsInterface();
2021-07-23 14:02:09 +00:00
bool Save() override;
2022-07-08 14:14:48 +00:00
2021-07-23 14:02:09 +00:00
void Clear() override;
2022-07-08 14:14:48 +00:00
bool GetIntValue(const char* section, const char* key, s32* value) const override;
bool GetUIntValue(const char* section, const char* key, u32* value) const override;
bool GetFloatValue(const char* section, const char* key, float* value) const override;
bool GetDoubleValue(const char* section, const char* key, double* value) const override;
bool GetBoolValue(const char* section, const char* key, bool* value) const override;
bool GetStringValue(const char* section, const char* key, std::string* value) const override;
2021-07-23 14:02:09 +00:00
2022-07-08 14:14:48 +00:00
void SetIntValue(const char* section, const char* key, s32 value) override;
void SetUIntValue(const char* section, const char* key, u32 value) override;
2021-07-23 14:02:09 +00:00
void SetFloatValue(const char* section, const char* key, float value) override;
2022-07-08 14:14:48 +00:00
void SetDoubleValue(const char* section, const char* key, double value) override;
2021-07-23 14:02:09 +00:00
void SetBoolValue(const char* section, const char* key, bool value) override;
void SetStringValue(const char* section, const char* key, const char* value) override;
2022-07-08 14:14:48 +00:00
bool ContainsValue(const char* section, const char* key) const override;
void DeleteValue(const char* section, const char* key) override;
void ClearSection(const char* section) override;
2021-07-23 14:02:09 +00:00
2022-07-08 14:14:48 +00:00
std::vector<std::string> GetStringList(const char* section, const char* key) const override;
2021-07-23 14:02:09 +00:00
void SetStringList(const char* section, const char* key, const std::vector<std::string>& items) override;
bool RemoveFromStringList(const char* section, const char* key, const char* item) override;
bool AddToStringList(const char* section, const char* key, const char* item) override;
2022-07-08 14:14:48 +00:00
// default parameter overloads
using SettingsInterface::GetBoolValue;
using SettingsInterface::GetDoubleValue;
using SettingsInterface::GetFloatValue;
using SettingsInterface::GetIntValue;
using SettingsInterface::GetStringValue;
using SettingsInterface::GetUIntValue;
2021-07-23 14:02:09 +00:00
private:
2022-07-09 04:17:57 +00:00
using KeyMap = UnorderedStringMultimap<std::string>;
using SectionMap = UnorderedStringMap<KeyMap>;
void SetValue(const char* section, const char* key, std::string value);
SectionMap m_sections;
2021-07-23 14:02:09 +00:00
};