| 334 | |
| 335 | |
| 336 | std::vector<std::string> File::GetRelatedExclusiveOptions(const std::string option) |
| 337 | { |
| 338 | configure_mapping(); |
| 339 | |
| 340 | std::vector<std::string> ret{}; |
| 341 | |
| 342 | // Find the option in the mapping |
| 343 | auto s = std::find_if(map.begin(), |
| 344 | map.end(), |
| 345 | [option](OptionMapEntry &e) |
| 346 | { |
| 347 | return option == e.option; |
| 348 | }); |
| 349 | |
| 350 | if (map.end() == s || s->exclusive_group.empty()) |
| 351 | { |
| 352 | // Option not found => no related options |
| 353 | return ret; |
| 354 | } |
| 355 | |
| 356 | // Find all other options in the same option group as |
| 357 | // the option just looked up |
| 358 | for (const auto &m : map) |
| 359 | { |
| 360 | // Ignore empty exclusive_groups or itself |
| 361 | if (m.exclusive_group.empty() || m.option == option) |
| 362 | { |
| 363 | continue; |
| 364 | } |
| 365 | |
| 366 | // If it is the same exclusive option group ... |
| 367 | if (s->exclusive_group == m.exclusive_group) |
| 368 | { |
| 369 | ret.push_back(m.option); |
| 370 | } |
| 371 | } |
| 372 | return ret; |
| 373 | } |
| 374 | |
| 375 | |
| 376 | Json::Value File::Generate() |