7 #include "arg_router/parsing/parse_target.hpp"
8 #include "arg_router/parsing/parsing.hpp"
9 #include "arg_router/policy/policy.hpp"
10 #include "arg_router/traits.hpp"
11 #include "arg_router/utility/compile_time_optional.hpp"
12 #include "arg_router/utility/utf8.hpp"
23 template <
typename =
void>
28 constexpr
static auto priority = std::size_t{900};
48 template <
typename ProcessedTarget,
typename... Parents>
53 [[maybe_unused]]
const Parents&... parents)
const
55 static_assert(
sizeof...(Parents) > 0,
56 "Short-form expansion policy requires at least one parent");
57 using owner_type = boost::mp11::mp_first<std::tuple<Parents...>>;
59 static_assert(traits::has_short_name_method_v<owner_type>,
60 "Short-form expansion support requires a short name policy");
63 "Short name must only be 1 character");
69 "Short and long prefixes cannot be the same");
75 auto first = tokens.
begin();
76 auto first_token = *first;
79 const auto& owner = algorithm::pack_element<0>(parents...);
86 }
else if (first_token.prefix == parsing::prefix_type::long_) {
91 if (first_token.name.size() == owner_type::short_name().size()) {
122 struct is_policy<short_form_expander_t<>> : std::true_type {
void transfer(iterator it)
vector< value_type > & unprocessed()
constexpr auto short_prefix
constexpr auto long_prefix
token_type get_token_type(std::string_view token)
constexpr auto short_form_expander
constexpr std::size_t count(std::string_view str) noexcept