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

#include <arg_router/policy/value_separator.hpp>

Public Types

using string_type = S
 

Public Member Functions

constexpr value_separator_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 value_separator () noexcept
 

Static Public Attributes

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

Detailed Description

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

Represents the character that separates a label token from its value token(s).

Your terminal will separate tokens using whitespace by default, but often a different character is used e.g. –arg=42 - this policy specifies that character.

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

constexpr auto a = ar::policy::value_separator<'='>;
constexpr auto b = ar::policy::value_separator_utf8<S_("=")>;
constexpr auto c = ar::policy::value_separator_t{"="_S};
#define S_(tok)
Template Parameters
SCompile-time string

Definition at line 31 of file value_separator.hpp.

Member Typedef Documentation

◆ string_type

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

String type.

Definition at line 40 of file value_separator.hpp.

Constructor & Destructor Documentation

◆ value_separator_t()

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

Constructor.

Parameters
strString instance

Definition at line 49 of file value_separator.hpp.

Member Function Documentation

◆ pre_parse_phase()

template<typename S >
template<typename ProcessedTarget , typename... Parents>
parsing::pre_parse_result arg_router::policy::value_separator_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

Splits the label token from the value using the separator.

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 targets
parentsParent node instances
Returns
True if the owning node's label token matches the label part of the first token, false otherwise. No exception is stored in the return value

Definition at line 70 of file value_separator.hpp.

◆ value_separator()

template<typename S >
constexpr static std::string_view arg_router::policy::value_separator_t< S >::value_separator ( )
inlinestaticconstexprnoexcept

Returns the separator.

Returns
Separator character

Definition at line 55 of file value_separator.hpp.

Member Data Documentation

◆ priority

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

Policy priority.

Definition at line 43 of file value_separator.hpp.


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