|
RADLib
RADical C++ application framework
|
Typed application settings store. More...
#include <RADSettings.h>
Public Member Functions | |
| Settings (std::string fileName, Format format=Format::Json) | |
| Creates settings at fileName using format. More... | |
| Settings (AppIdentity identity, Format format=Format::Json) | |
| Creates settings under the platform config path from identity. More... | |
| const std::string & | fileName () const |
| Returns backing file path. More... | |
| Format | format () const |
| Returns file format. More... | |
| bool | load (std::string *error=nullptr) |
| Loads settings; missing files are treated as empty settings. More... | |
| bool | save (std::string *error=nullptr) const |
| Saves settings, creating parent directories when needed. More... | |
| bool | contains (const std::string &key) const |
| Returns true when key exists. More... | |
| void | remove (const std::string &key) |
| Removes a key. More... | |
| void | clear () |
| Clears all keys. More... | |
| RADCore::RADJsonValue | value (const std::string &key, RADCore::RADJsonValue defaultValue={}) const |
| Returns a JSON value. More... | |
| void | setValue (const std::string &key, RADCore::RADJsonValue value) |
| Sets a JSON value. More... | |
| bool | boolValue (const std::string &key, bool defaultValue=false) const |
| Returns a bool. More... | |
| int64_t | intValue (const std::string &key, int64_t defaultValue=0) const |
| Returns an integer. More... | |
| double | doubleValue (const std::string &key, double defaultValue=0.0) const |
| Returns a double. More... | |
| std::string | stringValue (const std::string &key, const std::string &defaultValue={}) const |
| Returns a string. More... | |
| void | setBool (const std::string &key, bool value) |
| Sets a bool. More... | |
| void | setInt (const std::string &key, int64_t value) |
| Sets an integer. More... | |
| void | setDouble (const std::string &key, double value) |
| Sets a double. More... | |
| void | setString (const std::string &key, std::string value) |
| Sets a string. More... | |
Static Public Member Functions | |
| static std::string | defaultFileName (const AppIdentity &identity, Format format=Format::Json) |
| Returns a config file path for identity. More... | |
Typed application settings store.
| RADSettings::Settings::Settings | ( | std::string | fileName, |
| Format | format = Format::Json |
||
| ) |
Creates settings at fileName using format.
| RADSettings::Settings::Settings | ( | AppIdentity | identity, |
| Format | format = Format::Json |
||
| ) |
Creates settings under the platform config path from identity.
| bool RADSettings::Settings::boolValue | ( | const std::string & | key, |
| bool | defaultValue = false |
||
| ) | const |
Returns a bool.
| void RADSettings::Settings::clear | ( | ) |
Clears all keys.
| bool RADSettings::Settings::contains | ( | const std::string & | key | ) | const |
Returns true when key exists.
|
static |
Returns a config file path for identity.
| double RADSettings::Settings::doubleValue | ( | const std::string & | key, |
| double | defaultValue = 0.0 |
||
| ) | const |
Returns a double.
| const std::string& RADSettings::Settings::fileName | ( | ) | const |
Returns backing file path.
| Format RADSettings::Settings::format | ( | ) | const |
Returns file format.
| int64_t RADSettings::Settings::intValue | ( | const std::string & | key, |
| int64_t | defaultValue = 0 |
||
| ) | const |
Returns an integer.
| bool RADSettings::Settings::load | ( | std::string * | error = nullptr | ) |
Loads settings; missing files are treated as empty settings.
| void RADSettings::Settings::remove | ( | const std::string & | key | ) |
Removes a key.
| bool RADSettings::Settings::save | ( | std::string * | error = nullptr | ) | const |
Saves settings, creating parent directories when needed.
| void RADSettings::Settings::setBool | ( | const std::string & | key, |
| bool | value | ||
| ) |
Sets a bool.
| void RADSettings::Settings::setDouble | ( | const std::string & | key, |
| double | value | ||
| ) |
Sets a double.
| void RADSettings::Settings::setInt | ( | const std::string & | key, |
| int64_t | value | ||
| ) |
Sets an integer.
| void RADSettings::Settings::setString | ( | const std::string & | key, |
| std::string | value | ||
| ) |
Sets a string.
| void RADSettings::Settings::setValue | ( | const std::string & | key, |
| RADCore::RADJsonValue | value | ||
| ) |
Sets a JSON value.
| std::string RADSettings::Settings::stringValue | ( | const std::string & | key, |
| const std::string & | defaultValue = {} |
||
| ) | const |
Returns a string.
| RADCore::RADJsonValue RADSettings::Settings::value | ( | const std::string & | key, |
| RADCore::RADJsonValue | defaultValue = {} |
||
| ) | const |
Returns a JSON value.