|
RADLib
RADical C++ application framework
|
JSON-file-backed key/value settings helper. More...
#include <RADCore.h>
Public Member Functions | |
| RADSettings (std::string fileName) | |
| Creates settings bound to fileName. More... | |
| const std::string & | fileName () const |
| Returns backing file path. More... | |
| bool | load (std::string *error=nullptr) |
| Loads settings from disk. More... | |
| bool | save (std::string *error=nullptr) const |
| Saves settings to disk. More... | |
| bool | contains (const std::string &key) const |
| Returns true when key exists. More... | |
| RADJsonValue | value (const std::string &key, RADJsonValue defaultValue={}) const |
| Returns value for key or defaultValue. More... | |
| void | setValue (const std::string &key, RADJsonValue value) |
| Sets value for key. More... | |
| void | remove (const std::string &key) |
| Removes key. More... | |
| void | clear () |
| Removes all settings. More... | |
JSON-file-backed key/value settings helper.
|
explicit |
Creates settings bound to fileName.
| void RADCore::RADSettings::clear | ( | ) |
Removes all settings.
| bool RADCore::RADSettings::contains | ( | const std::string & | key | ) | const |
Returns true when key exists.
| const std::string& RADCore::RADSettings::fileName | ( | ) | const |
Returns backing file path.
| bool RADCore::RADSettings::load | ( | std::string * | error = nullptr | ) |
Loads settings from disk.
| void RADCore::RADSettings::remove | ( | const std::string & | key | ) |
Removes key.
| bool RADCore::RADSettings::save | ( | std::string * | error = nullptr | ) | const |
Saves settings to disk.
| void RADCore::RADSettings::setValue | ( | const std::string & | key, |
| RADJsonValue | value | ||
| ) |
Sets value for key.
| RADJsonValue RADCore::RADSettings::value | ( | const std::string & | key, |
| RADJsonValue | defaultValue = {} |
||
| ) | const |
Returns value for key or defaultValue.