vg
tools for working with variation graphs
|
#include <options.hpp>
Public Member Functions | |
ValueArgSpec (const std::string &option, char short_option, T Receiver::*dest, const T &default_value, const std::string &help, const ValidatorFunction< T > &validator) | |
Make an option with a long and short option name. | |
ValueArgSpec (const std::string &option, T Receiver::*dest, const T &default_value, const std::string &help, const ValidatorFunction< T > &validator) | |
Make an option with a long option name only. | |
virtual | ~ValueArgSpec ()=default |
virtual void | set_value (const T &replacement) |
Allow setting our stored value. | |
virtual T | get_value () const |
And getting our current effective value. | |
virtual bool | was_set () const |
Return true if a value has been set from parsing or a preset. | |
virtual void | parse (const char *optarg) |
virtual void | apply (Receiver &receiver) const |
Apply the value to the right field of the given object. | |
virtual void | print_metavar (ostream &out, const char *sep="") const |
Print value metavar placeholder to the given stream after the given separator. | |
virtual void | print_value (ostream &out, const char *sep="") const |
Print value to the given stream after the given separator. | |
virtual void | print_default (ostream &out) const |
Print default value to the given stream, if appropriate. | |
virtual struct option | get_option_struct () const |
Get the getopt structure for this option. Option must outlive it and not move. | |
![]() | |
ArgSpec (const std::string &option, char short_option, T Receiver::*dest, const T &default_value, const std::string &help, const ValidatorFunction< T > &validator) | |
Make an option with a long and short option name. | |
ArgSpec (const std::string &option, T Receiver::*dest, const T &default_value, const std::string &help, const ValidatorFunction< T > &validator) | |
Make an option with a long option name only. | |
virtual | ~ArgSpec ()=default |
virtual void | preset (const BaseValuation &entry) |
virtual void | set (const BaseValuation &entry) |
virtual void | query (BaseValuation &entry) const |
![]() | |
BaseArgSpec (const std::string &option, char short_option, const std::string &help) | |
Make an option with a long and short option name. | |
BaseArgSpec (const std::string &option, const std::string &help) | |
Make an option with a long option name only. | |
virtual | ~BaseArgSpec ()=default |
virtual void | print (ostream &out, const char *sep="", const char *after="", bool slug=false) const |
![]() | |
virtual void | reset_chain () |
Reset the chain to its initial values. | |
virtual bool | tick_chain () |
virtual TickChainLink & | chain (TickChainLink &next) |
virtual std::function< void(const std::function< void(void)> &)> | get_iterator () |
Public Attributes | |
Holder | value |
bool | value_set = false |
![]() | |
T Receiver::* | dest |
Field in the receiving type we set. | |
T | default_value |
Original default value. | |
ValidatorFunction< T > | validator |
Function to check value with. | |
![]() | |
std::string | option |
Name of the option (long opt) | |
std::string | help |
Help for the option. | |
char | short_option |
Character of the option (short opt), or 0. | |
int | option_id |
Int value to represent the option. | |
![]() | |
std::function< void(void)> | reset_chain_parent |
This will be called when we want to reset_chain what we are chained onto. | |
std::function< bool(void)> | tick_chain_parent |
This will be called when we need to tick_chain our parent. | |
Definition structure for normal value-having options. Lets you specify storage type for the actual value.
|
inline |
Make an option with a long and short option name.
|
inline |
Make an option with a long option name only.
|
virtualdefault |
|
inlinevirtual |
Apply the value to the right field of the given object.
Implements vg::subcommand::BaseArgSpec< Receiver >.
|
inlinevirtual |
Get the getopt structure for this option. Option must outlive it and not move.
Implements vg::subcommand::BaseArgSpec< Receiver >.
Reimplemented in vg::subcommand::FlagArgSpec< Receiver >.
|
inlinevirtual |
And getting our current effective value.
Implements vg::subcommand::ArgSpec< T, Receiver >.
|
inlinevirtual |
Parse the argument's value from the command line. Throws std::domain_error if validation fails.
Implements vg::subcommand::BaseArgSpec< Receiver >.
Reimplemented in vg::subcommand::FlagArgSpec< Receiver >.
|
inlinevirtual |
Print default value to the given stream, if appropriate.
Implements vg::subcommand::BaseArgSpec< Receiver >.
Reimplemented in vg::subcommand::FlagArgSpec< Receiver >.
|
inlinevirtual |
Print value metavar placeholder to the given stream after the given separator.
Implements vg::subcommand::BaseArgSpec< Receiver >.
Reimplemented in vg::subcommand::FlagArgSpec< Receiver >.
|
inlinevirtual |
Print value to the given stream after the given separator.
Implements vg::subcommand::BaseArgSpec< Receiver >.
Reimplemented in vg::subcommand::FlagArgSpec< Receiver >.
|
inlinevirtual |
Allow setting our stored value.
Implements vg::subcommand::ArgSpec< T, Receiver >.
|
inlinevirtual |
Return true if a value has been set from parsing or a preset.
Implements vg::subcommand::ArgSpec< T, Receiver >.
Holder vg::subcommand::ValueArgSpec< T, Receiver, Holder >::value |
bool vg::subcommand::ValueArgSpec< T, Receiver, Holder >::value_set = false |