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

#include <options.hpp>

Inheritance diagram for vg::subcommand::NegationFlagArgSpec< Receiver >:
vg::subcommand::BaseArgSpec< Receiver > vg::subcommand::TickChainLink

Public Member Functions

 NegationFlagArgSpec (const std::string &option, const std::string &help, FlagArgSpec< Receiver > *primary)
 
virtual ~NegationFlagArgSpec ()=default
 
virtual void parse (const char *optarg)
 
virtual void preset (const BaseValuation &entry)
 
virtual void set (const BaseValuation &entry)
 
virtual void query (BaseValuation &entry) const
 
virtual void apply (Receiver &receiver) const
 Apply the value to the right field of the given object. More...
 
virtual bool print_value (ostream &out, const char *sep="") const
 
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_default (ostream &out) const
 Print default value to the given stream, if appropriate. More...
 
virtual bool print (ostream &out, const char *before="", OptionFormat format=OptionFormat::CLI) 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::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
 

Public Attributes

FlagArgSpec< Receiver > * primary
 The primary flag whose storage we manipulate. 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...
 

Additional Inherited Members

Detailed Description

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

Definition structure for the negation counterpart of a flag (e.g. –no-XXX for –XXX, or –XXX for –no-XXX). Has its own option name, ID, and help text, but uses the primary FlagArgSpec's storage when parsed.

Constructor & Destructor Documentation

◆ NegationFlagArgSpec()

template<typename Receiver >
vg::subcommand::NegationFlagArgSpec< Receiver >::NegationFlagArgSpec ( const std::string &  option,
const std::string &  help,
FlagArgSpec< Receiver > *  primary 
)
inline

◆ ~NegationFlagArgSpec()

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

Member Function Documentation

◆ apply()

template<typename Receiver >
virtual void vg::subcommand::NegationFlagArgSpec< Receiver >::apply ( Receiver &  receiver) const
inlinevirtual

Apply the value to the right field of the given object.

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

◆ get_option_struct()

template<typename Receiver >
virtual struct option vg::subcommand::NegationFlagArgSpec< 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::NegationFlagArgSpec< Receiver >::parse ( const char *  optarg)
inlinevirtual

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

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

◆ preset()

template<typename Receiver >
virtual void vg::subcommand::NegationFlagArgSpec< Receiver >::preset ( const BaseValuation entry)
inlinevirtual

Apply a preset item, or fail if it doesn't match. The preset value will sit under any parsed value but above the default.

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

◆ print()

template<typename Receiver >
virtual bool vg::subcommand::NegationFlagArgSpec< Receiver >::print ( ostream &  out,
const char *  before = "",
OptionFormat  format = OptionFormat::CLI 
) const
inlinevirtual

Print when the negation is in effect (value was explicitly set back to default by the user).

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

◆ print_default()

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

Print default value to the given stream, if appropriate.

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

◆ print_metavar()

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

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

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

◆ print_value()

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

Print value to the given stream after the given separator. Returns true if any output was produced.

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

◆ query()

template<typename Receiver >
virtual void vg::subcommand::NegationFlagArgSpec< Receiver >::query ( BaseValuation entry) const
inlinevirtual

Put our current effective value into the given BaseValuation, which must be for the right option and have the right type.

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

◆ set()

template<typename Receiver >
virtual void vg::subcommand::NegationFlagArgSpec< Receiver >::set ( const BaseValuation entry)
inlinevirtual

Apply a valuation, or fail if it doesn't match. The value will replace any parsed value! Validation will not be run!

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

Member Data Documentation

◆ primary

template<typename Receiver >
FlagArgSpec<Receiver>* vg::subcommand::NegationFlagArgSpec< Receiver >::primary

The primary flag whose storage we manipulate.


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