#include <Getopt.h>
Definition at line 29 of file Getopt.h.
Public Member Functions | |
Getopt () | |
Constructor (does nothing). | |
~Getopt () | |
Destructor to clean up all the opts. | |
void | addopt (Opt *opt) |
Register a new option binding. | |
int | getopt (const char *progname, int argc, char *const argv[], const char *extra_usage="") |
Parse argv, processing all registered getopt. | |
void | usage (const char *progname, const char *extra_usage="") |
Prints a nicely formatted usage string to stderr. | |
Protected Types | |
typedef std::vector < Opt * > | OptList |
Protected Attributes | |
Opt * | opts_ [256] |
OptList | allopts_ |
typedef std::vector<Opt*> oasys::Getopt::OptList [protected] |
oasys::Getopt::Getopt | ( | ) |
oasys::Getopt::~Getopt | ( | ) |
void oasys::Getopt::addopt | ( | Opt * | opt | ) |
Register a new option binding.
Definition at line 49 of file Getopt.cc.
References allopts_, opts_, and oasys::Opt::shortopt_.
Referenced by dtntunnel::DTNTunnel::get_options(), dtn::DTND::get_options(), and main().
int oasys::Getopt::getopt | ( | const char * | progname, | |
int | argc, | |||
char *const | argv[], | |||
const char * | extra_usage = "" | |||
) |
Parse argv, processing all registered getopt.
Returns the index of the first non-option argument in argv
progname | the name of the executable | |
argc | count of command line args | |
argv | command line arg values | |
extra_opts | additional usage string |
Definition at line 66 of file Getopt.cc.
References allopts_, oasys::Opt::longopt_, oasys::Opt::needval_, opts_, oasys::Opt::set(), oasys::Opt::setp_, oasys::Opt::shortopt_, and usage().
Referenced by dtntunnel::DTNTunnel::get_options(), dtn::DTND::get_options(), and main().
void oasys::Getopt::usage | ( | const char * | progname, | |
const char * | extra_usage = "" | |||
) |
Prints a nicely formatted usage string to stderr.
progname | the name of the executable | |
extra_opts | additional usage string |
Definition at line 172 of file Getopt.cc.
References allopts_, oasys::Opt::desc_, oasys::Opt::longopt_, oasys::Opt::shortopt_, snprintf(), and oasys::Opt::valdesc_.
Referenced by dtntunnel::DTNTunnel::get_options(), dtn::DTND::get_options(), getopt(), and main().
Opt* oasys::Getopt::opts_[256] [protected] |
OptList oasys::Getopt::allopts_ [protected] |