7 #include "arg_router/parsing/token_type.hpp"
8 #include "arg_router/tree_node_fwd.hpp"
9 #include "arg_router/utility/type_hash.hpp"
10 #include "arg_router/utility/unsafe_any.hpp"
12 #include <boost/mp11/algorithm.hpp>
40 template <
typename Node,
typename... Parents>
42 node_type_{utility::type_hash<std::decay_t<Node>>()}, tokens_(std::move(
tokens))
44 static_assert(is_tree_node_v<Node>,
"Target must be a tree_node");
47 if constexpr (std::is_void_v<decltype(node.parse(std::move(target), parents...))>) {
48 node.parse(std::move(target), parents...);
51 return node.parse(std::move(target), parents...);
63 template <
typename Node,
typename... Parents>
67 const Parents&... parents) noexcept :
100 [[nodiscard]]
explicit operator bool() const noexcept {
return static_cast<bool>(parse_); }
106 [[nodiscard]] std::size_t
node_type() const noexcept {
return node_type_; }
128 auto parse = std::move(parse_);
130 return parse(std::move(*
this));
137 std::size_t node_type_;
150 template <
typename T>
152 static_assert(is_tree_node_v<T>,
"T must be node");
154 template <
typename U>
155 using type = decltype(
156 std::declval<const U&>().
template parse<>(std::declval<parsing::parse_target>()));
158 constexpr
static bool value = boost::mp11::mp_valid<type, T>::value;
165 template <
typename T>
const vector< parse_target > & sub_targets() const noexcept
utility::unsafe_any operator()()
const vector< token_type > & tokens() const noexcept
vector< parse_target > & sub_targets() noexcept
parse_target(vector< token_type > tokens, const Node &node, const Parents &... parents) noexcept
void tokens(vector< token_type > tokens)
parse_target(const Node &node, const Parents &... parents) noexcept
std::size_t node_type() const noexcept
void add_sub_target(parse_target target)
vector< token_type > & tokens() noexcept
unsafe_any_t< sizeof(std::string_view)> unsafe_any
std::vector< T, config::allocator< T > > vector