| 79 | /// If found @a value is set to the corresponding value in @a list. |
| 80 | template <typename T, unsigned N> |
| 81 | static bool |
| 82 | http_config_enum_search(std::string_view key, const ConfigEnumPair<T> (&list)[N], MgmtByte &value) |
| 83 | { |
| 84 | Dbg(dbg_ctl_http_config, "enum element %.*s", static_cast<int>(key.size()), key.data()); |
| 85 | // We don't expect any of these lists to be more than 10 long, so a linear search is the best choice. |
| 86 | for (unsigned i = 0; i < N; ++i) { |
| 87 | if (key.compare(list[i]._key) == 0) { |
| 88 | value = list[i]._value; |
| 89 | return true; |
| 90 | } |
| 91 | } |
| 92 | return false; |
| 93 | } |
| 94 | |
| 95 | /// Read a string from the configuration and convert it to an enumeration value. |
| 96 | /// @a n is the number of entries in the list. |
no test coverage detected