| 229 | // |
| 230 | |
| 231 | void ParsedArgs::CheckExclusiveOptions(const ExclusiveGroups &args_exclusive) const |
| 232 | { |
| 233 | // Check if processed options is listed as an exclusive argument |
| 234 | for (const auto &arg : present) |
| 235 | { |
| 236 | for (const auto &group : args_exclusive) |
| 237 | { |
| 238 | // Is this argument listed in this group of exclusive args? |
| 239 | if (std::find(group.begin(), group.end(), arg) == group.end()) |
| 240 | { |
| 241 | // Not found in this group, continue to next group |
| 242 | continue; |
| 243 | } |
| 244 | |
| 245 | // This argument was found to be in an exclusiveness group. |
| 246 | // Now we need to see if any of the other arguments in this |
| 247 | // group has been used already. |
| 248 | for (const auto &x : group) |
| 249 | { |
| 250 | if (arg == x) |
| 251 | { |
| 252 | // Don't check against itself |
| 253 | continue; |
| 254 | } |
| 255 | |
| 256 | // Check if any of the other options in this group in |
| 257 | // the exclusiveness list has been used already |
| 258 | if (std::find(present.begin(), |
| 259 | present.end(), |
| 260 | x) |
| 261 | != present.end()) |
| 262 | { |
| 263 | throw ExclusiveOptionError(arg, group); |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | } // End of exclusiveness check |
| 268 | } |
| 269 | |
| 270 | |
| 271 | bool ParsedArgs::parse_bool_value(const std::string &k, const std::string &value) const |