* Parse "name", "section.name", "noname", "section.noname" settings keys. * * @note Where an option was negated can be later checked using the * IsArgNegated() method. One use case for this is to have a way to disable * options that are not normally boolean (e.g. using -nodebuglogfile to request * that debug log output is not sent to any file at all). */
| 213 | * that debug log output is not sent to any file at all). |
| 214 | */ |
| 215 | KeyInfo InterpretKey(std::string key) |
| 216 | { |
| 217 | KeyInfo result; |
| 218 | // Split section name from key name for keys like "testnet.foo" or "regtest.bar" |
| 219 | size_t option_index = key.find('.'); |
| 220 | if (option_index != std::string::npos) { |
| 221 | result.section = key.substr(0, option_index); |
| 222 | key.erase(0, option_index + 1); |
| 223 | } |
| 224 | if (key.substr(0, 2) == "no") { |
| 225 | key.erase(0, 2); |
| 226 | result.negated = true; |
| 227 | } |
| 228 | result.name = key; |
| 229 | return result; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Interpret settings value based on registered flags. |
no test coverage detected