7 #include "arg_router/multi_arg_base.hpp"
8 #include "arg_router/policy/description.hpp"
9 #include "arg_router/policy/long_name.hpp"
10 #include "arg_router/policy/short_name.hpp"
11 #include "arg_router/utility/string_to_policy.hpp"
23 template <
typename T,
typename... Policies>
28 static_assert(!traits::has_none_name_method_v<multi_arg_t>,
29 "Multi arg must not have a none name policy");
30 static_assert(!traits::has_display_name_method_v<multi_arg_t>,
31 "Multi arg must not have a display name policy");
33 static_assert(!((parent_type::minimum_count() == parent_type::maximum_count()) &&
34 parent_type::minimum_count() == 1),
35 "Multi arg set to a fixed count of 1, use arg_t instead");
37 parent_type::minimum_count() >= 1,
38 "Multi arg requires a minimum of one value token, use min_max_count_t to define the range");
41 using typename parent_type::policies_type;
47 template <
bool Flatten>
51 using label = std::decay_t<decltype(
52 parent_type::template default_leaf_help_data_type<Flatten>::label_generator() +
54 parent_type::template default_leaf_help_data_type<Flatten>::count_suffix())>;
56 typename parent_type::template default_leaf_help_data_type<Flatten>::description;
57 using children = std::tuple<>;
64 constexpr
explicit multi_arg_t(Policies... policies) noexcept :
69 template <
typename Validator,
bool HasTarget,
typename... Parents>
70 [[nodiscard]] std::optional<parsing::parse_target> pre_parse(
71 parsing::pre_parse_data<Validator, HasTarget> pre_parse_data,
72 const Parents&... parents)
const
75 return parent_type::pre_parse(pre_parse_data, *
this, parents...);
78 template <
typename... Parents>
79 value_type parse(parsing::parse_target&& target,
const Parents&... parents)
const
85 static_assert(!parent_type::template any_phases_v<value_type, policy::has_routing_phase_method>,
86 "Multi arg does not support policies with routing phases "
110 template <
typename T,
typename... Policies>
111 [[nodiscard]] constexpr
auto multi_arg(Policies... policies) noexcept
114 [](
auto... converted_policies) {
115 return multi_arg_t<T, std::decay_t<decltype(converted_policies)>...>{
116 std::move(converted_policies)...};
122 std::move(policies)...));
value_type parse(parsing::parse_target target, const Parents &... parents) const
typename parent_type::value_type value_type
constexpr multi_arg_t(Policies... policies) noexcept
constexpr auto convert(Params &&... params) noexcept
constexpr auto multi_arg(Policies... policies) noexcept