arg_router  1.4.0
C++ command line argument parsing and routing
arg_router::policy::token_end_marker_t< S > Class Template Reference

#include <arg_router/policy/token_end_marker.hpp>

Public Types

using string_type = S
 

Public Member Functions

constexpr token_end_marker_t ([[maybe_unused]] S str={}) noexcept
 
template<typename ProcessedTarget , typename... Parents>
parsing::pre_parse_result pre_parse_phase (parsing::dynamic_token_adapter &tokens, [[maybe_unused]] utility::compile_time_optional< ProcessedTarget > processed_target, [[maybe_unused]] parsing::parse_target &target, [[maybe_unused]] const Parents &... parents) const
 

Static Public Member Functions

constexpr static std::string_view token_end_marker () noexcept
 

Static Public Attributes

constexpr static auto priority = std::size_t{760}
 

Detailed Description

template<typename S>
class arg_router::policy::token_end_marker_t< S >

Represents the token in a variable length value list that marks the end of the list at runtime.

Typically a variable length value list (e.g. the value tokens for a positional_arg_t) sits at the end of the input tokens as the corresponding node will consume the tokens until the maximum count or token list end is reached. This policy can adjust that behaviour by defining a token that marks the end of list. This allows multiple variable length value list nodes to be used under a single mode.

If using C++17 then use the template variable helper with the S_ macro; for C++20 and higher, use the constructor directly with a compile-time string literal:

constexpr auto a = ar::policy::token_end_marker<S_("hello")>;
constexpr auto b = ar::policy::token_end_marker_t{"hello"_S};
#define S_(tok)
Note
Token must have at least one character and cannot contain any whitespace characters
Template Parameters
SCompile-time string

Definition at line 30 of file token_end_marker.hpp.

Member Typedef Documentation

◆ string_type

template<typename S >
using arg_router::policy::token_end_marker_t< S >::string_type = S

String type.

Definition at line 34 of file token_end_marker.hpp.

Constructor & Destructor Documentation

◆ token_end_marker_t()

template<typename S >
constexpr arg_router::policy::token_end_marker_t< S >::token_end_marker_t ( [[maybe_unused] ] S  str = {})
inlineexplicitconstexprnoexcept

Constructor.

Parameters
strString instance

Definition at line 43 of file token_end_marker.hpp.

Member Function Documentation

◆ pre_parse_phase()

template<typename S >
template<typename ProcessedTarget , typename... Parents>
parsing::pre_parse_result arg_router::policy::token_end_marker_t< S >::pre_parse_phase ( parsing::dynamic_token_adapter tokens,
[[maybe_unused] ] utility::compile_time_optional< ProcessedTarget >  processed_target,
[[maybe_unused] ] parsing::parse_target target,
[[maybe_unused] ] const Parents &...  parents 
) const
inline

Checks that the owner expects a variable length list of token values. This policy does not perform any operation on the input tokens.

Template Parameters
ProcessedTargetprocessed_target payload type
ParentsPack of parent tree nodes in ascending ancestry order
Parameters
tokensCurrently processed tokens
processed_targetPreviously processed parse_target of parent node, or empty is there is no non-root parent
targetPre-parse generated target
parentsParent node instances
Returns
Always returns parsing::pre_parse_action::valid_node

Definition at line 64 of file token_end_marker.hpp.

◆ token_end_marker()

template<typename S >
constexpr static std::string_view arg_router::policy::token_end_marker_t< S >::token_end_marker ( )
inlinestaticconstexprnoexcept

Returns the token end marker.

Returns
Token end marker

Definition at line 49 of file token_end_marker.hpp.

Member Data Documentation

◆ priority

template<typename S >
constexpr static auto arg_router::policy::token_end_marker_t< S >::priority = std::size_t{760}
staticconstexpr

Policy priority.

Definition at line 37 of file token_end_marker.hpp.


The documentation for this class was generated from the following file: