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

Detailed Description

template<typename Label, typename Type>
class fcppt::options::argument< Label, Type >

An argument parser.

Argument parsers match the next command-line parameter that is not a flag ("-f"/"--flag") or an option ("-o value"/"--option value""). The result is stored in a record that has a single element with label Label and type Type. In case reading the value into Type fails, the parser also fails.

Template Parameters
LabelAn fcppt::record::label.
TypeThe type of the argument's value which must be readable from an fcppt::io::istream.

Public Types

typedef fcppt::record::element< Label, Type > element_type
 
typedef fcppt::record::variadic< element_typeresult_type
 

Public Member Functions

 argument (fcppt::options::long_name &&long_name, fcppt::options::optional_help_text &&help_text)
 Constructs an argument 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
 

Member Typedef Documentation

◆ element_type

template<typename Label , typename Type >
typedef fcppt::record::element< Label, Type > fcppt::options::argument< Label, Type >::element_type

◆ result_type

template<typename Label , typename Type >
typedef fcppt::record::variadic< element_type > fcppt::options::argument< Label, Type >::result_type

Constructor & Destructor Documentation

◆ argument()

template<typename Label , typename Type >
fcppt::options::argument< Label, Type >::argument ( fcppt::options::long_name &&  long_name,
fcppt::options::optional_help_text &&  help_text 
)

Constructs an argument parser.

Parameters
long_nameThe name of the argument as displayed in usage output.
help_textOptional help text for this argument.

Member Function Documentation

◆ flag_names()

template<typename Label , typename Type >
fcppt::options::flag_name_set fcppt::options::argument< Label, Type >::flag_names ( ) const

◆ option_names()

template<typename Label , typename Type >
fcppt::options::option_name_set fcppt::options::argument< Label, Type >::option_names ( ) const

◆ parse()

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

◆ usage()

template<typename Label , typename Type >
fcppt::string fcppt::options::argument< Label, Type >::usage ( ) const