MCPcopy Create free account
hub / github.com/ElementsProject/elements / InterpretValue

Function InterpretValue

src/util/system.cpp:243–260  ·  view source on GitHub ↗

* Interpret settings value based on registered flags. * * @param[in] key key information to know if key was negated * @param[in] value string value of setting to be parsed * @param[in] flags ArgsManager registered argument flags * @param[out] error Error description if settings value is not valid * * @return parsed settings value if it is valid, otherwise nullopt accomp

Source from the content-addressed store, hash-verified

241 * by a descriptive error string
242 */
243static std::optional<util::SettingsValue> InterpretValue(const KeyInfo& key, const std::string& value,
244 unsigned int flags, std::string& error)
245{
246 // Return negated settings as false values.
247 if (key.negated) {
248 if (flags & ArgsManager::DISALLOW_NEGATION) {
249 error = strprintf("Negating of -%s is meaningless and therefore forbidden", key.name);
250 return std::nullopt;
251 }
252 // Double negatives like -nofoo=0 are supported (but discouraged)
253 if (!InterpretBool(value)) {
254 LogPrintf("Warning: parsed potentially confusing double-negative -%s=%s\n", key.name, value);
255 return true;
256 }
257 return false;
258 }
259 return value;
260}
261
262// Define default constructor and destructor that are not inline, so code instantiating this class doesn't need to
263// #include class definitions for all members.

Callers 2

ParseParametersMethod · 0.85
ReadConfigStreamMethod · 0.85

Calls 1

InterpretBoolFunction · 0.85

Tested by

no test coverage detected