vg
tools for working with variation graphs
Loading...
Searching...
No Matches
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
GroupedOptionGroup & operator= (GroupedOptionGroup &other)=delete
 GroupedOptionGroup (GroupedOptionGroup &&other)=delete
GroupedOptionGroup & operator= (GroupedOptionGroup &&other)=delete
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.
virtual TickChainLink & chain (TickChainLink &next)
 Chain through all subgroups.
virtual void reset_chain ()
 Delegate reset to last subgroup.
virtual bool tick_chain ()
 Delegate tick to last subgroup.
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 bool print_options (ostream &out, OptionFormat format=OptionFormat::CLI) 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.
virtual void make_short_options (std::string &dest) const
 Add options to string input for getopt_long.
Public Member Functions inherited from vg::subcommand::BaseOptionGroup
virtual ~BaseOptionGroup ()=default
template<typename T>
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.

Public Attributes

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

Additional Inherited Members

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)
delete

◆ ~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)
delete

◆ 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()

bool vg::subcommand::GroupedOptionGroup::print_options ( ostream & out,
OptionFormat format = OptionFormat::CLI ) const
virtual

Print all options set, in the given format. Returns true if any output was produced.

Implements vg::subcommand::BaseOptionGroup.

◆ query()

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

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

Implements vg::subcommand::BaseOptionGroup.

◆ reset_chain()

void vg::subcommand::GroupedOptionGroup::reset_chain ( )
virtual

Delegate reset to last subgroup.

Reimplemented from vg::subcommand::TickChainLink.

◆ 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.

◆ tick_chain()

bool vg::subcommand::GroupedOptionGroup::tick_chain ( )
virtual

Delegate tick to last subgroup.

Reimplemented from vg::subcommand::TickChainLink.

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: