Changeset View
Changeset View
Standalone View
Standalone View
src/util/system.h
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
struct SectionInfo { | struct SectionInfo { | ||||
std::string m_name; | std::string m_name; | ||||
std::string m_file; | std::string m_file; | ||||
int m_line; | int m_line; | ||||
}; | }; | ||||
std::string SettingToString(const util::SettingsValue &, const std::string &); | |||||
int64_t SettingToInt(const util::SettingsValue &, int64_t); | |||||
bool SettingToBool(const util::SettingsValue &, bool); | |||||
class ArgsManager { | class ArgsManager { | ||||
public: | public: | ||||
enum Flags { | enum Flags { | ||||
// Boolean options can accept negation syntax -noOPTION or -noOPTION=1 | // Boolean options can accept negation syntax -noOPTION or -noOPTION=1 | ||||
ALLOW_BOOL = 0x01, | ALLOW_BOOL = 0x01, | ||||
ALLOW_INT = 0x02, | ALLOW_INT = 0x02, | ||||
ALLOW_STRING = 0x04, | ALLOW_STRING = 0x04, | ||||
ALLOW_ANY = ALLOW_BOOL | ALLOW_INT | ALLOW_STRING, | ALLOW_ANY = ALLOW_BOOL | ALLOW_INT | ALLOW_STRING, | ||||
▲ Show 20 Lines • Show All 252 Lines • ▼ Show 20 Lines | public: | ||||
bool ReadSettingsFile(std::vector<std::string> *errors = nullptr); | bool ReadSettingsFile(std::vector<std::string> *errors = nullptr); | ||||
/** | /** | ||||
* Write settings file. Push errors to vector, or log them if null. | * Write settings file. Push errors to vector, or log them if null. | ||||
*/ | */ | ||||
bool WriteSettingsFile(std::vector<std::string> *errors = nullptr) const; | bool WriteSettingsFile(std::vector<std::string> *errors = nullptr) const; | ||||
/** | /** | ||||
* Get current setting from config file or read/write settings file, | |||||
* ignoring nonpersistent command line or forced settings values. | |||||
*/ | |||||
util::SettingsValue GetPersistentSetting(const std::string &name) const; | |||||
/** | |||||
* Access settings with lock held. | * Access settings with lock held. | ||||
*/ | */ | ||||
template <typename Fn> void LockSettings(Fn &&fn) { | template <typename Fn> void LockSettings(Fn &&fn) { | ||||
LOCK(cs_args); | LOCK(cs_args); | ||||
fn(m_settings); | fn(m_settings); | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |