* 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). */
| 75 | * that debug log output is not sent to any file at all). |
| 76 | */ |
| 77 | KeyInfo InterpretKey(std::string key) |
| 78 | { |
| 79 | KeyInfo result; |
| 80 | // Split section name from key name for keys like "testnet.foo" or "regtest.bar" |
| 81 | size_t option_index = key.find('.'); |
| 82 | if (option_index != std::string::npos) { |
| 83 | result.section = key.substr(0, option_index); |
| 84 | key.erase(0, option_index + 1); |
| 85 | } |
| 86 | if (key.starts_with("no")) { |
| 87 | key.erase(0, 2); |
| 88 | result.negated = true; |
| 89 | } |
| 90 | result.name = key; |
| 91 | return result; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Interpret settings value based on registered flags. |
no test coverage detected