7 #include "arg_router/algorithm.hpp"
8 #include "arg_router/traits.hpp"
9 #include "arg_router/utility/result.hpp"
38 using namespace std::string_literals;
40 if constexpr (traits::has_long_name_method_v<T>) {
41 if ((token.prefix == prefix_type::long_) && (token.name == T::long_name())) {
45 if constexpr (traits::has_short_name_method_v<T>) {
50 if constexpr (traits::has_none_name_method_v<T>) {
67 template <
typename Node>
70 if constexpr (traits::has_error_name_method_v<Node>) {
72 }
else if constexpr (traits::has_display_name_method_v<Node>) {
74 }
else if constexpr (traits::has_long_name_method_v<Node>) {
75 return {prefix_type::long_, Node::long_name()};
76 }
else if constexpr (traits::has_short_name_method_v<Node>) {
78 }
else if constexpr (traits::has_none_name_method_v<Node>) {
81 static_assert(traits::always_false_v<Node>,
"Node does not have a name");
104 template <
typename BaseNode,
typename... DerivedAndParents>
106 const BaseNode& base_node,
107 const DerivedAndParents&... derived_and_parents)
111 using parents_tuple = std::tuple<std::decay_t<DerivedAndParents>...>;
113 constexpr
auto remove_n = boost::mp11::mp_find_if_q<
115 boost::mp11::mp_not_fn_q<
116 boost::mp11::mp_bind<std::is_base_of, std::decay_t<BaseNode>, boost::mp11::_1>>>::value;
117 if constexpr (remove_n == 0) {
118 return std::tuple{std::cref(base_node), std::cref(derived_and_parents)...};
132 template <
typename Node,
typename... Parents>
135 auto any_disabled =
false;
137 [&]([[maybe_unused]]
auto i,
auto entry) {
138 using entry_type =
typename std::decay_t<decltype(entry)>::type;
140 if constexpr (traits::has_runtime_enabled_method_v<entry_type>) {
141 any_disabled = any_disabled || !entry.get().runtime_enabled();
144 std::tuple{std::cref(node), std::cref(parents)...});
constexpr auto tuple_drop(Tuple &&input)
@ skip_node_but_use_sub_targets
bool is_runtime_disabled(const Node &node, const Parents &... parents) noexcept
constexpr token_type node_token_type() noexcept
constexpr bool match(token_type token) noexcept
constexpr auto clean_node_ancestry_list(const BaseNode &base_node, const DerivedAndParents &... derived_and_parents)
constexpr std::enable_if_t< traits::is_tuple_like_v< std::decay_t< Tuple > > > tuple_iterator(F &&f, Tuple &&tuple)