13#ifndef ARGS__GROUPS_HPP__INCLUDED
14#define ARGS__GROUPS_HPP__INCLUDED
36 bool required =
false)
55 return std::any_of(
children().cbegin(),
children().cend(), [](
const auto &arg) {
56 return arg->isDefined();
76 if (arg->isRequired()) {
79 +
SL(
"\" is not allowed to be in OnlyOne group \"")
94 if (arg->isDefined()) {
97 "be defined in OnlyOne group \""))
100 +
SL(
"Whereas defined \"")
123 bool required =
false)
142 return !std::any_of(
children().cbegin(),
children().cend(), [](
const auto &arg) {
143 return !arg->isDefined();
163 if (arg->isRequired()) {
166 +
SL(
"\" is not allowed to ")
167 +
SL(
"be in AllOf group \"")
179 const bool defined = std::any_of(
children().cbegin(),
children().cend(), [](
const auto &arg) {
180 return arg->isDefined();
183 const bool all = std::all_of(
children().cbegin(),
children().cend(), [](
const auto &arg) {
184 return arg->isDefined();
187 if (defined && !all) {
191 +
SL(
"\" should be defined."));
206 bool required =
false)
225 return std::any_of(
children().cbegin(),
children().cend(), [](
const auto &arg) {
226 return arg->isDefined();
246 if (arg->isRequired()) {
249 +
SL(
"\" is not allowed to ")
250 +
SL(
"be in AtLeastOne group \"")
bool isDefined() const override
AllOfGroup(T &&name, bool required=false)
void checkCorrectnessBeforeParsing(StringList &flags, StringList &names) const override
Check correctness of the argument before parsing.
void checkCorrectnessAfterParsing() const override
Check correctness of the argument after parsing.
ArgType type() const override
virtual String name() const =0
AtLeastOneGroup(T &&name, bool required=false)
virtual ~AtLeastOneGroup()
bool isDefined() const override
ArgType type() const override
void checkCorrectnessBeforeParsing(StringList &flags, StringList &names) const override
Check correctness of the argument before parsing.
Base exception of the library.
String name() const override
const Arguments & children() const
void checkCorrectnessBeforeParsing(StringList &flags, StringList &names) const override
Check correctness of the argument before parsing.
GroupIface(T &&name, bool required=false)
void checkCorrectnessAfterParsing() const override
Check correctness of the argument after parsing.
void checkCorrectnessBeforeParsing(StringList &flags, StringList &names) const override
Check correctness of the argument before parsing.
OnlyOneGroup(T &&name, bool required=false)
bool isDefined() const override
ArgType type() const override
void checkCorrectnessAfterParsing() const override
Check correctness of the argument after parsing.
constexpr std::add_const< T >::type & asConst(T &t) noexcept
Adds const to non-const objects.
std::string String
String type.
ArgType
Type of the argument.
@ AllOfGroup
"All of" group.
@ AtLeastOneGroup
"At least one" group.
@ OnlyOneGroup
"Only one" group.
std::vector< String > StringList
List of strings.