vg
tools for working with variation graphs
|
#include <options.hpp>
Public Member Functions | |
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 |
virtual void | parse (const char *optarg)=0 |
virtual void | preset (const BaseValuation &entry)=0 |
virtual void | set (const BaseValuation &entry)=0 |
virtual void | query (BaseValuation &entry) const =0 |
virtual void | apply (Receiver &receiver) const =0 |
Apply the value to the right field of the given object. More... | |
virtual void | print_value (ostream &out, const char *sep="") const =0 |
Print value to the given stream after the given separator. More... | |
virtual void | print_metavar (ostream &out, const char *sep="") const =0 |
Print value metavar placeholder to the given stream after the given separator. More... | |
virtual void | print_default (ostream &out) const =0 |
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 =0 |
Get the getopt structure for this option. Option must outlive it and not move. More... | |
Public Member Functions inherited from vg::subcommand::TickChainLink | |
virtual void | reset_chain () |
Reset the chain to its initial values. More... | |
virtual bool | tick_chain () |
virtual TickChainLink & | chain (TickChainLink &next) |
virtual std::function< void(const std::function< void(void)> &)> | get_iterator () |
Public Attributes | |
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... | |
Public Attributes inherited from vg::subcommand::TickChainLink | |
std::function< void(void)> | reset_chain_parent |
This will be called when we want to reset_chain what we are chained onto. More... | |
std::function< bool(void)> | tick_chain_parent |
This will be called when we need to tick_chain our parent. More... | |
Interface for a command-line argument that goes into a field on an object of the given type.
|
inline |
Make an option with a long and short option name.
|
inline |
Make an option with a long option name only.
|
virtualdefault |
|
pure virtual |
Apply the value to the right field of the given object.
Implemented in vg::subcommand::ValueArgSpec< T, Receiver, Holder >, vg::subcommand::ValueArgSpec< bool, Receiver >, and vg::subcommand::ValueArgSpec< T, Receiver, Range< T > >.
|
pure virtual |
Get the getopt structure for this option. Option must outlive it and not move.
Implemented in vg::subcommand::FlagArgSpec< Receiver >, and vg::subcommand::ValueArgSpec< T, Receiver, Holder >.
|
pure virtual |
Parse the argument's value from the command line. Throws std::domain_error if validation fails.
Implemented in vg::subcommand::FlagArgSpec< Receiver >, vg::subcommand::ValueArgSpec< T, Receiver, Holder >, vg::subcommand::ValueArgSpec< bool, Receiver >, and vg::subcommand::ValueArgSpec< T, Receiver, Range< T > >.
|
pure virtual |
Apply a preset item, or fail if it doesn't match. The preset value will sit under any parsed value but above the default.
Implemented in vg::subcommand::ArgSpec< T, Receiver >, and vg::subcommand::ArgSpec< bool, Receiver >.
|
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 in vg::subcommand::FlagArgSpec< Receiver >.
|
pure virtual |
Print default value to the given stream, if appropriate.
Implemented in vg::subcommand::FlagArgSpec< Receiver >, vg::subcommand::ValueArgSpec< T, Receiver, Holder >, vg::subcommand::ValueArgSpec< bool, Receiver >, and vg::subcommand::ValueArgSpec< T, Receiver, Range< T > >.
|
pure virtual |
Print value metavar placeholder to the given stream after the given separator.
Implemented in vg::subcommand::FlagArgSpec< Receiver >, vg::subcommand::ValueArgSpec< T, Receiver, Holder >, vg::subcommand::ValueArgSpec< bool, Receiver >, and vg::subcommand::ValueArgSpec< T, Receiver, Range< T > >.
|
pure virtual |
Print value to the given stream after the given separator.
Implemented in vg::subcommand::FlagArgSpec< Receiver >, vg::subcommand::ValueArgSpec< T, Receiver, Holder >, vg::subcommand::ValueArgSpec< bool, Receiver >, and vg::subcommand::ValueArgSpec< T, Receiver, Range< T > >.
|
pure virtual |
Put our current effective value into the given BaseValuation, which must be for the right option and have the right type.
Implemented in vg::subcommand::ArgSpec< T, Receiver >, and vg::subcommand::ArgSpec< bool, Receiver >.
|
pure virtual |
Apply a valuation, or fail if it doesn't match. The value will replace any parsed value! Validation will not be run!
Implemented in vg::subcommand::ArgSpec< T, Receiver >, and vg::subcommand::ArgSpec< bool, Receiver >.
std::string vg::subcommand::BaseArgSpec< Receiver >::help |
Help for the option.
std::string vg::subcommand::BaseArgSpec< Receiver >::option |
Name of the option (long opt)
int vg::subcommand::BaseArgSpec< Receiver >::option_id |
Int value to represent the option.
char vg::subcommand::BaseArgSpec< Receiver >::short_option |
Character of the option (short opt), or 0.