vg
tools for working with variation graphs
Public Member Functions | List of all members
vg::subcommand::BaseOptionGroup Struct Referenceabstract

#include <options.hpp>

Inheritance diagram for vg::subcommand::BaseOptionGroup:
vg::subcommand::TickChainLink vg::subcommand::GroupedOptionGroup vg::subcommand::OptionGroup< Receiver >

Public Member Functions

virtual ~BaseOptionGroup ()=default
 
virtual bool parse (int option_id, const char *optarg)=0
 
virtual bool preset (const BaseValuation &entry)=0
 
virtual bool set (const BaseValuation &entry)=0
 
virtual bool query (BaseValuation &entry) const =0
 
virtual void print_options (ostream &out, bool slug=false) const =0
 
virtual std::vector< std::pair< std::string, std::string > > get_help () const =0
 
virtual void make_long_options (std::vector< struct option > &dest) const =0
 Add options to non-null-terminated input for getopt_long. More...
 
virtual void make_short_options (std::string &dest) const =0
 Add options to string input for getopt_long. More...
 
template<typename T >
get_option_value (const std::string &option) const
 
template<typename T >
void set_option_value (const std::string &option, const T &value)
 Allow the user to manually set an option value. More...
 

Additional Inherited Members

Detailed Description

Represents a set of command-line options.

Constructor & Destructor Documentation

◆ ~BaseOptionGroup()

virtual vg::subcommand::BaseOptionGroup::~BaseOptionGroup ( )
virtualdefault

Member Function Documentation

◆ get_help()

virtual std::vector<std::pair<std::string, std::string> > vg::subcommand::BaseOptionGroup::get_help ( ) const
pure virtual

Get help, in the form of pairs of options and descriptions. Headings are descriptions without options.

Implemented in vg::subcommand::GroupedOptionGroup, and vg::subcommand::OptionGroup< Receiver >.

◆ get_option_value()

template<typename T >
T vg::subcommand::BaseOptionGroup::get_option_value ( const std::string &  option) const
inline

Allow the user to query an option value by name. Would be simpler if we could override template methods but we can't.

◆ make_long_options()

virtual void vg::subcommand::BaseOptionGroup::make_long_options ( std::vector< struct option > &  dest) const
pure virtual

Add options to non-null-terminated input for getopt_long.

Implemented in vg::subcommand::GroupedOptionGroup, and vg::subcommand::OptionGroup< Receiver >.

◆ make_short_options()

virtual void vg::subcommand::BaseOptionGroup::make_short_options ( std::string &  dest) const
pure virtual

Add options to string input for getopt_long.

Implemented in vg::subcommand::GroupedOptionGroup, and vg::subcommand::OptionGroup< Receiver >.

◆ parse()

virtual bool vg::subcommand::BaseOptionGroup::parse ( int  option_id,
const char *  optarg 
)
pure virtual

Parse the given option ID, with the given value if needed. Return true if we matched the ID, and false otherwise.

Implemented in vg::subcommand::GroupedOptionGroup, and vg::subcommand::OptionGroup< Receiver >.

◆ preset()

virtual bool vg::subcommand::BaseOptionGroup::preset ( const BaseValuation entry)
pure virtual

Apply a preset value to its option. Returns true if it was found, and false otherwies.

Implemented in vg::subcommand::GroupedOptionGroup, and vg::subcommand::OptionGroup< Receiver >.

◆ print_options()

virtual void vg::subcommand::BaseOptionGroup::print_options ( ostream &  out,
bool  slug = false 
) const
pure virtual

Print all options set. By default, prints one option per line. If slug is set, prints short options, all on one line.

Implemented in vg::subcommand::GroupedOptionGroup, and vg::subcommand::OptionGroup< Receiver >.

◆ query()

virtual bool vg::subcommand::BaseOptionGroup::query ( BaseValuation entry) const
pure virtual

Fill in entry with the value of the correspondign option, if we have that option. If so, return true.

Implemented in vg::subcommand::GroupedOptionGroup, and vg::subcommand::OptionGroup< Receiver >.

◆ set()

virtual bool vg::subcommand::BaseOptionGroup::set ( const BaseValuation entry)
pure virtual

Apply a value to its option. Returns true if it was found, and false otherwies.

Implemented in vg::subcommand::GroupedOptionGroup, and vg::subcommand::OptionGroup< Receiver >.

◆ set_option_value()

template<typename T >
void vg::subcommand::BaseOptionGroup::set_option_value ( const std::string &  option,
const T &  value 
)
inline

Allow the user to manually set an option value.


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