Get an option by name (noexcept non-const version)
| 6044 | |
| 6045 | /// Get an option by name (noexcept non-const version) |
| 6046 | Option *get_option_no_throw(std::string option_name) noexcept { |
| 6047 | for (Option_p &opt : options_) { |
| 6048 | if (opt->check_name(option_name)) { |
| 6049 | return opt.get(); |
| 6050 | } |
| 6051 | } |
| 6052 | for (auto &subc : subcommands_) { |
| 6053 | // also check down into nameless subcommands |
| 6054 | if (subc->get_name().empty()) { |
| 6055 | auto opt = subc->get_option_no_throw(option_name); |
| 6056 | if (opt != nullptr) { |
| 6057 | return opt; |
| 6058 | } |
| 6059 | } |
| 6060 | } |
| 6061 | return nullptr; |
| 6062 | } |
| 6063 | |
| 6064 | /// Get an option by name (noexcept const version) |
| 6065 | const Option *get_option_no_throw(std::string option_name) const noexcept { |
no test coverage detected