4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::options::unit_switch< Label > Class Template Reference

Detailed Description

template<typename Label>
class fcppt::options::unit_switch< Label >

A required switch.

This parser is similar to fcppt::options::switch_ but instead of returning true or false, it only succeeds if its flag is given.

Public Types

using result_type = fcppt::record::object<fcppt::record::element<Label, fcppt::unit>>
 

Public Member Functions

 unit_switch (fcppt::options::optional_short_name &&short_name, fcppt::options::long_name &&long_name, fcppt::options::optional_help_text &&help_text)
 Constructs a unit switch parser.
 
fcppt::options::parse_result< result_typeparse (fcppt::options::state &&, fcppt::options::parse_context const &) const
 
fcppt::options::flag_name_set flag_names () const
 
fcppt::options::option_name_set option_names () const
 
fcppt::options::usage usage () const
 
fcppt::options::optional_short_name const & short_name () const
 
fcppt::options::long_name const & long_name () const
 

Member Typedef Documentation

◆ result_type

template<typename Label >
using fcppt::options::unit_switch< Label >::result_type = fcppt::record::object<fcppt::record::element<Label, fcppt::unit>>

Constructor & Destructor Documentation

◆ unit_switch()

template<typename Label >
fcppt::options::unit_switch< Label >::unit_switch ( fcppt::options::optional_short_name && short_name,
fcppt::options::long_name && long_name,
fcppt::options::optional_help_text && help_text )

Constructs a unit switch parser.

Parameters
short_nameAn optional short name ("-f") this parser will match.
long_nameThe long name ("--flag") this parser will match.
help_textOptional help text for this flag.

Member Function Documentation

◆ flag_names()

template<typename Label >
fcppt::options::flag_name_set fcppt::options::unit_switch< Label >::flag_names ( ) const
nodiscard

◆ long_name()

template<typename Label >
fcppt::options::long_name const & fcppt::options::unit_switch< Label >::long_name ( ) const
nodiscard

◆ option_names()

template<typename Label >
fcppt::options::option_name_set fcppt::options::unit_switch< Label >::option_names ( ) const
nodiscard

◆ parse()

template<typename Label >
fcppt::options::parse_result< result_type > fcppt::options::unit_switch< Label >::parse ( fcppt::options::state && ,
fcppt::options::parse_context const &  ) const
nodiscard

◆ short_name()

template<typename Label >
fcppt::options::optional_short_name const & fcppt::options::unit_switch< Label >::short_name ( ) const
nodiscard

◆ usage()

template<typename Label >
fcppt::options::usage fcppt::options::unit_switch< Label >::usage ( ) const
nodiscard