| 293 | |
| 294 | |
| 295 | void File::CheckExclusiveOptions() |
| 296 | { |
| 297 | |
| 298 | // Create a map of all exclusive groups and |
| 299 | // which options each belongs to |
| 300 | std::map<std::string, std::vector<std::string>> groups; |
| 301 | for (const auto &e : map) |
| 302 | { |
| 303 | if (e.exclusive_group.empty()) |
| 304 | { |
| 305 | // Ignore empty group values |
| 306 | continue; |
| 307 | } |
| 308 | groups[e.exclusive_group].push_back(e.option); |
| 309 | } |
| 310 | |
| 311 | // Go through each option in each group and |
| 312 | // check if a value is present for that option |
| 313 | for (const auto &grp : groups) |
| 314 | { |
| 315 | std::vector<std::string> used; |
| 316 | for (const auto &opt : grp.second) |
| 317 | { |
| 318 | if (IsPresent(opt)) |
| 319 | { |
| 320 | // track each option which is |
| 321 | // used in this exclusive group |
| 322 | used.push_back(opt); |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | // If more than one option has been used |
| 327 | // in this exclusive group, complain |
| 328 | if (used.size() > 1) |
| 329 | { |
| 330 | throw ExclusiveOptionError(used); |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | |
| 336 | std::vector<std::string> File::GetRelatedExclusiveOptions(const std::string option) |
nothing calls this directly
no test coverage detected