37 std::optional<std::reference_wrapper<BasicSettings>>
mSettings;
47 void Reset() noexcept;
61 virtual wxString GetGroup() const = 0;
63 virtual wxArrayString GetChildGroups() const = 0;
65 virtual wxArrayString GetChildKeys() const = 0;
68 virtual
bool HasEntry(const wxString&
key) const = 0;
70 virtual
bool HasGroup(const wxString&
key) const = 0;
72 virtual
bool Exists(const wxString&
key) const;
78 virtual
void Clear() = 0;
81 bool DeleteGroup(const wxString&
key);
83 bool DeleteEntry(const wxString&
key);
90 virtual
bool Read(const wxString&
key,
bool* value) const = 0;
91 virtual
bool Read(const wxString&
key,
int* value) const = 0;
92 virtual
bool Read(const wxString&
key,
long* value) const = 0;
93 virtual
bool Read(const wxString&
key,
long long* value) const = 0;
94 virtual
bool Read(const wxString&
key,
double* value) const = 0;
95 virtual
bool Read(const wxString&
key, wxString* value) const = 0;
96 virtual
bool Read(const wxString&
key,
float* value) const;
100 bool Read(const wxString&
key, T* value)
const
109 std::enable_if_t<std::is_scalar_v<T>,
bool>
110 Read(
const wxString&
key, T* value, T defaultValue)
const
112 if(!Read(
key, value))
114 *value = defaultValue;
121 std::enable_if_t<!std::is_scalar_v<T>,
bool>
122 Read(
const wxString&
key, T* value,
const T& defaultValue)
124 if(!Read(
key, value))
126 *value = defaultValue;
132 wxString Read(
const wxString&
key,
const wxString& defaultValue = wxEmptyString)
const;
133 wxString Read(
const wxString&
key,
const char* defaultValue)
const;
134 wxString Read(
const wxString&
key,
const wchar_t* defaultValue)
const;
137 std::enable_if_t<std::is_scalar_v<T>, T>
138 Read(
const wxString&
key, T defaultValue)
const
141 if(!Read(
key, &value))
147 std::enable_if_t<!std::is_scalar_v<T>, T>
148 Read(
const wxString&
key,
const T& defaultValue)
const
151 if(!Read(
key, &value))
156 virtual bool Write(
const wxString&
key,
bool value) = 0;
157 virtual bool Write(
const wxString&
key,
int value) = 0;
158 virtual bool Write(
const wxString&
key,
long value) = 0;
159 virtual bool Write(
const wxString&
key,
long long value) = 0;
160 virtual bool Write(
const wxString&
key,
double value) = 0;
161 virtual bool Write(
const wxString&
key,
const wxString& value) = 0;
163 virtual bool Write(
const wxString&
key,
float value);
164 virtual bool Write(
const wxString&
key,
const char* value);
165 virtual bool Write(
const wxString&
key,
const wchar_t* value);
176 bool ReadBool(const wxString&
key,
bool defaultValue) const;
177 long ReadLong(const wxString&
key,
long defaultValue) const;
178 double ReadDouble(const wxString&
key,
double defaultValue) const;
180 template <typename T>
181 T ReadObject(const wxString&
key, const T& defaultValue)
const
183 return Read(
key, defaultValue);
wxString wxToString(const Stringifyable &obj)
bool wxFromString(const wxString &str, Stringifyable *obj)
static Settings & settings()
Global function-valued variable, adding a convenient Call()
GroupScope(GroupScope &&)=delete
GroupScope & operator=(GroupScope &&)=delete
GroupScope & operator=(const GroupScope &)=delete
std::optional< std::reference_wrapper< BasicSettings > > mSettings
GroupScope(const GroupScope &)=delete
Base class for objects that provide facility to store data persistently, and access it with string ke...
virtual bool Write(const wxString &key, const wxString &value)=0
std::enable_if_t< std::is_scalar_v< T >, bool > Read(const wxString &key, T *value, T defaultValue) const
virtual bool Flush() noexcept=0
std::enable_if_t<!std::is_scalar_v< T >, T > Read(const wxString &key, const T &defaultValue) const
virtual bool Write(const wxString &key, double value)=0
virtual bool Write(const wxString &key, bool value)=0
virtual bool Write(const wxString &key, long value)=0
virtual bool Write(const wxString &key, long long value)=0
std::enable_if_t< std::is_scalar_v< T >, T > Read(const wxString &key, T defaultValue) const
bool Write(const wxString &key, const T &value)
Uses wxToString to convert object into string.
virtual void DoBeginGroup(const wxString &prefix)=0
virtual bool Write(const wxString &key, int value)=0
virtual void DoEndGroup() noexcept=0
std::enable_if_t<!std::is_scalar_v< T >, bool > Read(const wxString &key, T *value, const T &defaultValue)
PROJECT_FILE_IO_API void Remove(const FilePath &path)
static const auto ReadLong
Provides an access to application-wise settings.