| 233 | |
| 234 | |
| 235 | void File::SetValue(const std::string &key, const std::string &value) |
| 236 | { |
| 237 | configure_mapping(); |
| 238 | |
| 239 | auto it = std::find_if(map.begin(), |
| 240 | map.end(), |
| 241 | [key](OptionMapEntry &e) |
| 242 | { |
| 243 | return key == e.option; |
| 244 | }); |
| 245 | if (it == map.end()) |
| 246 | { |
| 247 | throw OptionNotFound(key); |
| 248 | } |
| 249 | |
| 250 | if (OptionValueType::Present == it->type) |
| 251 | { |
| 252 | it->present = true; |
| 253 | it->present_value = ("1" == value || "yes" == value || "true" == value); |
| 254 | it->value = ""; |
| 255 | } |
| 256 | else |
| 257 | { |
| 258 | it->value = value; |
| 259 | it->present = !value.empty(); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | |
| 264 | void File::SetValue(const std::string &key, const int value) |