vg
tools for working with variation graphs
Public Types | Public Member Functions | List of all members
vg::subcommand::FlagArgSpec< Receiver > Struct Template Reference

#include <options.hpp>

Inheritance diagram for vg::subcommand::FlagArgSpec< Receiver >:
vg::subcommand::ValueArgSpec< bool, Receiver > vg::subcommand::ArgSpec< bool, Receiver > vg::subcommand::BaseArgSpec< Receiver > vg::subcommand::TickChainLink

Public Types

using T = bool
 
using Holder = T
 

Public Member Functions

virtual ~FlagArgSpec ()=default
 
virtual void parse (const char *optarg)
 
virtual void print_metavar (ostream &out, const char *sep="") const
 Print value metavar placeholder to the given stream after the given separator. More...
 
virtual void print_value (ostream &out, const char *sep="") const
 Print value to the given stream after the given separator. More...
 
virtual void print_default (ostream &out) const
 Print default value to the given stream, if appropriate. More...
 
virtual void print (ostream &out, const char *sep="", const char *after="", bool slug=false) const
 
virtual struct option get_option_struct () const
 Get the getopt structure for this option. Option must outlive it and not move. More...
 
- Public Member Functions inherited from vg::subcommand::ValueArgSpec< bool, Receiver >
 ValueArgSpec (const std::string &option, char short_option, bool Receiver::*dest, const bool &default_value, const std::string &help, const ValidatorFunction< bool > &validator)
 Make an option with a long and short option name. More...
 
 ValueArgSpec (const std::string &option, bool Receiver::*dest, const bool &default_value, const std::string &help, const ValidatorFunction< bool > &validator)
 Make an option with a long option name only. More...
 
virtual ~ValueArgSpec ()=default
 
virtual void set_value (const bool &replacement)
 Allow setting our stored value. More...
 
virtual bool get_value () const
 And getting our current effective value. More...
 
virtual bool was_set () const
 Return true if a value has been set from parsing or a preset. More...
 
virtual void apply (Receiver &receiver) const
 Apply the value to the right field of the given object. More...
 
virtual struct option get_option_struct () const
 Get the getopt structure for this option. Option must outlive it and not move. More...
 
- Public Member Functions inherited from vg::subcommand::ArgSpec< bool, Receiver >
 ArgSpec (const std::string &option, char short_option, bool Receiver::*dest, const bool &default_value, const std::string &help, const ValidatorFunction< bool > &validator)
 Make an option with a long and short option name. More...
 
 ArgSpec (const std::string &option, bool Receiver::*dest, const bool &default_value, const std::string &help, const ValidatorFunction< bool > &validator)
 Make an option with a long option name only. More...
 
virtual ~ArgSpec ()=default
 
virtual void preset (const BaseValuation &entry)
 
virtual void set (const BaseValuation &entry)
 
virtual void query (BaseValuation &entry) const
 
- Public Member Functions inherited from vg::subcommand::BaseArgSpec< Receiver >
 BaseArgSpec (const std::string &option, char short_option, const std::string &help)
 Make an option with a long and short option name. More...
 
 BaseArgSpec (const std::string &option, const std::string &help)
 Make an option with a long option name only. More...
 
virtual ~BaseArgSpec ()=default
 

Additional Inherited Members

- Public Attributes inherited from vg::subcommand::ValueArgSpec< bool, Receiver >
bool value
 
bool value_set
 
- Public Attributes inherited from vg::subcommand::ArgSpec< bool, Receiver >
bool Receiver::* dest
 Field in the receiving type we set. More...
 
bool default_value
 Original default value. More...
 
ValidatorFunction< bool > validator
 Function to check value with. More...
 
- Public Attributes inherited from vg::subcommand::BaseArgSpec< Receiver >
std::string option
 Name of the option (long opt) More...
 
std::string help
 Help for the option. More...
 
char short_option
 Character of the option (short opt), or 0. More...
 
int option_id
 Int value to represent the option. More...
 

Detailed Description

template<typename Receiver>
struct vg::subcommand::FlagArgSpec< Receiver >

Definition structure for flag options that flip a default value.

Member Typedef Documentation

◆ Holder

template<typename Receiver >
using vg::subcommand::FlagArgSpec< Receiver >::Holder = T

◆ T

template<typename Receiver >
using vg::subcommand::FlagArgSpec< Receiver >::T = bool

Constructor & Destructor Documentation

◆ ~FlagArgSpec()

template<typename Receiver >
virtual vg::subcommand::FlagArgSpec< Receiver >::~FlagArgSpec ( )
virtualdefault

Member Function Documentation

◆ get_option_struct()

template<typename Receiver >
virtual struct option vg::subcommand::FlagArgSpec< Receiver >::get_option_struct ( ) const
inlinevirtual

Get the getopt structure for this option. Option must outlive it and not move.

Implements vg::subcommand::BaseArgSpec< Receiver >.

◆ parse()

template<typename Receiver >
virtual void vg::subcommand::FlagArgSpec< Receiver >::parse ( const char *  optarg)
inlinevirtual

Parse the argument's value from the command line. Throws std::domain_error if validation fails.

Reimplemented from vg::subcommand::ValueArgSpec< bool, Receiver >.

◆ print()

template<typename Receiver >
virtual void vg::subcommand::FlagArgSpec< Receiver >::print ( ostream &  out,
const char *  sep = "",
const char *  after = "",
bool  slug = false 
) const
inlinevirtual

Print option and value to the given stream, without newlines, between the given separators. If slug is set, use short option if available and don't include spaces.

Reimplemented from vg::subcommand::BaseArgSpec< Receiver >.

◆ print_default()

template<typename Receiver >
virtual void vg::subcommand::FlagArgSpec< Receiver >::print_default ( ostream &  out) const
inlinevirtual

Print default value to the given stream, if appropriate.

Reimplemented from vg::subcommand::ValueArgSpec< bool, Receiver >.

◆ print_metavar()

template<typename Receiver >
virtual void vg::subcommand::FlagArgSpec< Receiver >::print_metavar ( ostream &  out,
const char *  sep = "" 
) const
inlinevirtual

Print value metavar placeholder to the given stream after the given separator.

Reimplemented from vg::subcommand::ValueArgSpec< bool, Receiver >.

◆ print_value()

template<typename Receiver >
virtual void vg::subcommand::FlagArgSpec< Receiver >::print_value ( ostream &  out,
const char *  sep = "" 
) const
inlinevirtual

Print value to the given stream after the given separator.

Reimplemented from vg::subcommand::ValueArgSpec< bool, Receiver >.


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