vg
tools for working with variation graphs
Public Member Functions | Public Attributes | List of all members
vg::subcommand::GroupedOptionGroup Struct Reference

#include <options.hpp>

Inheritance diagram for vg::subcommand::GroupedOptionGroup:
vg::subcommand::BaseOptionGroup vg::subcommand::TickChainLink

Public Member Functions

 GroupedOptionGroup ()=default
 
 GroupedOptionGroup (const GroupedOptionGroup &other)=delete
 
GroupedOptionGroupoperator= (GroupedOptionGroup &other)=delete
 
 GroupedOptionGroup (GroupedOptionGroup &&other)=default
 
GroupedOptionGroupoperator= (GroupedOptionGroup &&other)=default
 
virtual ~GroupedOptionGroup ()=default
 
template<typename Receiver >
OptionGroup< Receiver > & add_group (const std::string &heading)
 
template<typename Receiver >
void apply (Receiver &receiver)
 Apply all options that go on an object of this type to the given object. More...
 
virtual TickChainLinkchain (TickChainLink &next)
 Chain through all subgroups. More...
 
virtual bool parse (int option_id, const char *optarg)
 
virtual bool preset (const BaseValuation &entry)
 
virtual bool set (const BaseValuation &entry)
 
virtual bool query (BaseValuation &entry) const
 
virtual void print_options (ostream &out, bool slug=false) const
 
virtual std::vector< std::pair< std::string, std::string > > get_help () const
 
virtual void make_long_options (std::vector< struct option > &dest) const
 Add options to non-null-terminated input for getopt_long. More...
 
virtual void make_short_options (std::string &dest) const
 Add options to string input for getopt_long. More...
 
- Public Member Functions inherited from vg::subcommand::BaseOptionGroup
virtual ~BaseOptionGroup ()=default
 
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...
 

Public Attributes

std::vector< std::unique_ptr< BaseOptionGroup > > subgroups
 Holds all the child groups of options. More...
 

Detailed Description

Represents a group of groups of options.

Also doubles as the main parser type; you can make one of these and populate it with subgroups and options, and then use get_help() and print_table() to do help, and make_long_options(), make_short_options(), and parse() to parse with getopt_long(), and then you can apply() the options to objects they eventually belong in.

Constructor & Destructor Documentation

◆ GroupedOptionGroup() [1/3]

vg::subcommand::GroupedOptionGroup::GroupedOptionGroup ( )
default

◆ GroupedOptionGroup() [2/3]

vg::subcommand::GroupedOptionGroup::GroupedOptionGroup ( const GroupedOptionGroup other)
delete

◆ GroupedOptionGroup() [3/3]

vg::subcommand::GroupedOptionGroup::GroupedOptionGroup ( GroupedOptionGroup &&  other)
default

◆ ~GroupedOptionGroup()

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

Member Function Documentation

◆ add_group()

template<typename Receiver >
OptionGroup<Receiver>& vg::subcommand::GroupedOptionGroup::add_group ( const std::string &  heading)
inline

Create a new child group with a new heading, which we can add options to.

◆ apply()

template<typename Receiver >
void vg::subcommand::GroupedOptionGroup::apply ( Receiver &  receiver)
inline

Apply all options that go on an object of this type to the given object.

◆ chain()

TickChainLink & vg::subcommand::GroupedOptionGroup::chain ( TickChainLink next)
virtual

Chain through all subgroups.

Reimplemented from vg::subcommand::TickChainLink.

◆ get_help()

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

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

Implements vg::subcommand::BaseOptionGroup.

◆ make_long_options()

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

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

Implements vg::subcommand::BaseOptionGroup.

◆ make_short_options()

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

Add options to string input for getopt_long.

Implements vg::subcommand::BaseOptionGroup.

◆ operator=() [1/2]

GroupedOptionGroup& vg::subcommand::GroupedOptionGroup::operator= ( GroupedOptionGroup &&  other)
default

◆ operator=() [2/2]

GroupedOptionGroup& vg::subcommand::GroupedOptionGroup::operator= ( GroupedOptionGroup other)
delete

◆ parse()

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

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

Implements vg::subcommand::BaseOptionGroup.

◆ preset()

bool vg::subcommand::GroupedOptionGroup::preset ( const BaseValuation entry)
virtual

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

Implements vg::subcommand::BaseOptionGroup.

◆ print_options()

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

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

Implements vg::subcommand::BaseOptionGroup.

◆ query()

bool vg::subcommand::GroupedOptionGroup::query ( BaseValuation entry) const
virtual

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

Implements vg::subcommand::BaseOptionGroup.

◆ set()

bool vg::subcommand::GroupedOptionGroup::set ( const BaseValuation entry)
virtual

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

Implements vg::subcommand::BaseOptionGroup.

Member Data Documentation

◆ subgroups

std::vector<std::unique_ptr<BaseOptionGroup> > vg::subcommand::GroupedOptionGroup::subgroups

Holds all the child groups of options.


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