4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::options Namespace Reference

Library for command-line options. More...

Classes

struct  active_value_tag
 The tag of strong typedefs for active values. More...
 
class  argument
 An argument parser. More...
 
class  argument_conversion_error
 
class  argument_usage
 
class  base
 The base class for parsers with a given result type. More...
 
class  commands
 A parser for multiple sub commands. More...
 
class  commands_usage
 
struct  default_value_tag
 The tag of strong typedefs for default values. More...
 
class  dual_flag_error
 
class  dual_option_error
 
class  duplicate_names
 
class  error
 The error type retuned. More...
 
class  error_pair
 
class  exception
 
class  flag
 A flag parser. More...
 
class  flag_usage
 
struct  inactive_value_tag
 The tag of strong typedefs for inactive values. More...
 
class  invalid_command_error
 
class  leftover_error
 
class  many
 A parser for zero or more elements. More...
 
class  many_usage
 
class  missing_argument_error
 
class  missing_command_error
 
class  missing_error
 Occurs if an argument/flag/option is missing. More...
 
class  missing_error_pair
 
class  missing_flag_error
 
class  missing_option_argument_error
 
class  missing_option_error
 
class  option
 An option parser. More...
 
class  option_conversion_error
 
class  option_name
 An option name that may be for a short or long option. More...
 
class  option_usage
 
class  optional
 An optional parser. More...
 
class  optional_usage
 
class  parse_context
 
struct  pretty_type_impl
 
struct  pretty_type_impl< Enum, std::enable_if_t< std::is_enum_v< Enum > > >
 Specialization for enums that uses fcppt::enum_::names.
 
class  product
 A product of two parsers. More...
 
class  product_usage
 
class  state
 A parse state. More...
 
class  state_with_value
 A parse state together with a value. More...
 
class  sub_command
 A sub command consists of a command name and a parser. More...
 
class  sub_command_usage
 
class  sum
 A sum of two parsers. More...
 
class  sum_usage
 
class  switch_
 A switch parser. More...
 
class  unit
 A parser that succeeds when provided with no arguments. More...
 
class  unit_switch
 A required switch. More...
 
class  unit_usage
 
class  usage
 The usage type of a parser.This shows to a user how a parser is supposed to be used. More...
 

Typedefs

template<typename Type >
using active_value = fcppt::strong_typedef<Type, fcppt::options::active_value_tag>
 A strong typedef used as a parser's active value.
 
template<typename Result >
using base_unique_ptr = fcppt::unique_ptr<fcppt::options::base<Result>>
 A unique pointer for fcppt::options::base.
 
template<typename Type >
using default_value = fcppt::strong_typedef<Type, fcppt::options::default_value_tag>
 A strong typedef used as a parser's default value.
 
template<typename Parser >
using deref_type = std::remove_cvref_t<fcppt::deref_type<Parser>>
 The dereferenced type of a parser.
 
using error_variant
 
using flag_name = fcppt::strong_typedef< fcppt::string ,_>
 
using flag_name_set = std::set<fcppt::options::flag_name>
 The set of flag names.
 
template<typename Result >
using help_result
 The result of invoking a regular parser and a help parser.
 
using help_switch = fcppt::options::unit_switch<fcppt::options::detail::help_label>
 The type of a help parser.
 
using help_text = fcppt::strong_typedef< fcppt::string ,_>
 A string type representing a help text.
 
template<typename Type >
using inactive_value = fcppt::strong_typedef<Type, fcppt::options::inactive_value_tag>
 A strong typedef used as a parser's inactive value.
 
template<typename Type >
using left = fcppt::strong_typedef<Type, fcppt::options::detail::left_tag>
 The left result type of a sum parser.
 
using long_name = fcppt::strong_typedef< fcppt::string ,_>
 A string type representing a long name.
 
using missing_error_variant
 
using name = fcppt::strong_typedef< fcppt::string ,_>
 
using option_name_set = std::set<fcppt::options::option_name>
 The set of option names.
 
using optional_help_text = fcppt::optional::object<fcppt::options::help_text>
 An optional help text.
 
using optional_short_name = fcppt::optional::object<fcppt::options::short_name>
 An optional short name.
 
using parse_error = fcppt::variant::object<fcppt::options::missing_error, fcppt::options::error>
 The error type returned by parsers.
 
template<typename T >
using parse_result
 The result of a parser.
 
template<typename T >
using result = fcppt::either::object<fcppt::options::error, T>
 The result of a parse operation.
 
template<typename Parser >
using result_of = typename fcppt::options::deref_type<Parser>::result_type
 The result of a parser type.
 
template<typename Type >
using right = fcppt::strong_typedef<Type, fcppt::options::detail::right_tag>
 The right result type of a sum parser.
 
using short_name = fcppt::strong_typedef< fcppt::string ,_>
 A string type representing a short name.
 
using type_name = fcppt::strong_typedef< fcppt::string ,_>
 
using usage_variant
 

Functions

template<typename... Parsers>
auto apply (Parsers &&..._parsers)
 Combines two or more parsers.
 
FCPPT_OPTIONS_DETAIL_SYMBOL fcppt::options::help_switch default_help_switch ()
 The default help switch.
 
template<typename Parser >
decltype(auto) deref (Parser const &_parser)
 Dereferences a parser.
 
FCPPT_OPTIONS_DETAIL_SYMBOL bool operator== (fcppt::options::error const &, fcppt::options::error const &)
 
FCPPT_OPTIONS_DETAIL_SYMBOL fcppt::io::ostreamoperator<< (fcppt::io::ostream &, fcppt::options::error const &)
 
template<typename Type >
fcppt::options::active_value< std::remove_cvref_t< Type > > make_active_value (Type &&_value)
 Creates an active value.
 
template<typename Result , typename Parser >
fcppt::options::base_unique_ptr< Result > make_base (Parser &&_parser)
 Creates an fcppt::options::base.
 
template<typename OptionsParser , typename... SubCommands>
fcppt::options::commands< std::remove_cvref_t< OptionsParser >, std::remove_cvref_t< SubCommands >... > make_commands (OptionsParser &&_options_parser, SubCommands &&..._sub_commands)
 Makes a commands parser.
 
template<typename Type >
fcppt::options::default_value< std::remove_cvref_t< Type > > make_default_value (Type &&_value)
 Creates a default value.
 
template<typename Type >
fcppt::options::inactive_value< std::remove_cvref_t< Type > > make_inactive_value (Type &&_value)
 Creates an inactive value.
 
template<typename Type >
fcppt::options::left< std::remove_cvref_t< Type > > make_left (Type &&_value)
 Creates an fcppt::options::left.
 
template<typename Parser >
fcppt::options::many< std::remove_cvref_t< Parser > > make_many (Parser &&_parser)
 Turns a parser into a many parser.
 
template<typename Parser >
fcppt::options::optional< std::remove_cvref_t< Parser > > make_optional (Parser &&_parser)
 Turns a parser into an optional parser.
 
template<typename Type >
fcppt::options::right< std::remove_cvref_t< Type > > make_right (Type &&_value)
 Creates an fcppt::options::right.
 
template<typename Tag , typename Parser >
fcppt::options::sub_command< Tag, std::remove_cvref_t< Parser > > make_sub_command (fcppt::string &&_name, Parser &&_parser, fcppt::options::optional_help_text &&_help_text)
 Makes a sub command.
 
template<typename Type >
fcppt::options::result< std::remove_cvref_t< Type > > make_success (Type &&_value)
 Creates a success value.
 
template<typename Label , typename Left , typename Right >
fcppt::options::sum< Label, std::remove_cvref_t< Left >, std::remove_cvref_t< Right > > make_sum (Left &&_left, Right &&_right)
 Creates the sum of two parsers.
 
template<typename Type >
fcppt::options::default_value< fcppt::optional::object< Type > > no_default_value ()
 Creates an empty default value.
 
FCPPT_OPTIONS_DETAIL_SYMBOL bool operator== (fcppt::options::option_name const &, fcppt::options::option_name const &)
 
FCPPT_OPTIONS_DETAIL_SYMBOL bool operator< (fcppt::options::option_name const &, fcppt::options::option_name const &)
 
 FCPPT_RECORD_MAKE_LABEL (options_label)
 The options label name in fcppt::options::commands.
 
template<typename Parser >
fcppt::options::result< fcppt::options::result_of< Parser > > parse (Parser const &_parser, fcppt::args_vector const &_args)
 Parse a command-line.
 
template<typename Parser >
fcppt::options::help_result< fcppt::options::result_of< Parser > > parse_help (fcppt::options::help_switch const &_help, Parser const &_parser, fcppt::args_vector const &_args)
 Parse a command-line with a help parser.
 
template<typename Type >
fcppt::options::type_name pretty_type ()
 Returns a pretty type used for help texts.
 
 FCPPT_RECORD_MAKE_LABEL (sub_command_label)
 The sub-command label name in fcppt::options::commands.
 
FCPPT_OPTIONS_DETAIL_SYMBOL bool operator== (fcppt::options::usage const &, fcppt::options::usage const &)
 
FCPPT_OPTIONS_DETAIL_SYMBOL fcppt::io::ostreamoperator<< (fcppt::io::ostream &, fcppt::options::usage const &)
 

Detailed Description

Library for command-line options.

Typedef Documentation

◆ flag_name

◆ missing_error_variant

◆ type_name

Function Documentation

◆ operator<()

FCPPT_OPTIONS_DETAIL_SYMBOL bool fcppt::options::operator< ( fcppt::options::option_name const & ,
fcppt::options::option_name const &  )

◆ operator==() [1/3]

FCPPT_OPTIONS_DETAIL_SYMBOL bool fcppt::options::operator== ( fcppt::options::error const & ,
fcppt::options::error const &  )
nodiscard

◆ operator==() [2/3]

FCPPT_OPTIONS_DETAIL_SYMBOL bool fcppt::options::operator== ( fcppt::options::option_name const & ,
fcppt::options::option_name const &  )

◆ operator==() [3/3]

FCPPT_OPTIONS_DETAIL_SYMBOL bool fcppt::options::operator== ( fcppt::options::usage const & ,
fcppt::options::usage const &  )
nodiscard