Freundlich's C++ toolkit
Public Types | Public Member Functions
fcppt::options::switch_< Label > Class Template Reference

Detailed Description

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

A switch parser.

A switch parser is similar to fcppt::options::flag, but its value type is fixed to bool, where its active value is true and its inactive value is false.

Public Types

using result_type = typename impl::result_type

Public Member Functions

 switch_ (fcppt::options::optional_short_name &&short_name, fcppt::options::long_name &&long_name, fcppt::options::optional_help_text &&help_text)
 Constructs a switch parser. More...
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::string usage () const
const fcppt::options::optional_short_nameshort_name () const
const fcppt::options::long_namelong_name () const

Member Typedef Documentation

◆ result_type

template<typename Label >
using fcppt::options::switch_< Label >::result_type = typename impl::result_type

Constructor & Destructor Documentation

◆ switch_()

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

Constructs a switch parser.

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::switch_< Label >::flag_names ( ) const

◆ long_name()

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

◆ option_names()

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

◆ parse()

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

◆ short_name()

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

◆ usage()

template<typename Label >
fcppt::string fcppt::options::switch_< Label >::usage ( ) const