| 42 | } |
| 43 | |
| 44 | Rv<Modifier::Handle> |
| 45 | Modifier::load(Config &cfg, YAML::Node const &node, ActiveType ex_type) |
| 46 | { |
| 47 | if (!node.IsMap()) { |
| 48 | return Errata(S_ERROR, R"(Modifier at {} is not an object as required.)", node.Mark()); |
| 49 | } |
| 50 | |
| 51 | for (auto const &[key_node, value_node] : node) { |
| 52 | TextView key{key_node.Scalar()}; |
| 53 | auto &&[arg, arg_errata]{parse_arg(key)}; |
| 54 | if (!arg_errata.is_ok()) { |
| 55 | return std::move(arg_errata); |
| 56 | } |
| 57 | // See if @a key is in the factory. |
| 58 | if (auto spot{_factory.find(key)}; spot != _factory.end()) { |
| 59 | auto &&[handle, errata]{spot->second(cfg, node, key, arg, value_node)}; |
| 60 | |
| 61 | if (!errata.is_ok()) { |
| 62 | return std::move(errata); |
| 63 | } |
| 64 | if (!handle->is_valid_for(ex_type)) { |
| 65 | return Errata(S_ERROR, R"(Modifier "{}" at {} cannot accept a feature of type "{}".)", key, node.Mark(), ex_type); |
| 66 | } |
| 67 | |
| 68 | return std::move(handle); |
| 69 | } |
| 70 | } |
| 71 | return Errata(S_ERROR, R"(No valid modifier key in object at {}.)", node.Mark()); |
| 72 | } |
| 73 | |
| 74 | swoc::Rv<Feature> |
| 75 | Modifier::operator()(Context &, feature_type_for<NIL>) |
nothing calls this directly
no test coverage detected