Classes | |
class | CmdArg |
class | CmdArgBase |
class | CmdArgList |
class | CmdArgListBase |
class | CmdLine |
class | CmdOpt |
class | CmdOptBase |
class | CmdOptDictionary |
class | CmdOptList |
class | CmdOptRTable |
Implementation of a C++ command line parser to replace the getopt functionality. These classes can be used in stand-alone programs that are executed on the command-line.
A command-line consists of the program name, the command-line options, followed by the command-line arguments. Command-line options (or flags) are optional, and are given by for instance in the form "-optionname=optionvalue". Options may be specified in any order, but must be specified before the arguments. Command-line arguments are given in a pre-defined sequence, after the options.
A utility that extracts solution and gradient data from a B2000++ database.
In the first step, for each command-line option, a b2000::cmdline::CmdOpt instance must be created, and for each mandatory argument, a b2000::cmdline::CmdArg instance must be created.
The options:
The program has a single command-line argument:
In the second step, the option and argument instances are used to initialize, together with the arguments argc and argv, to initialize the Cmdline object:
In the third step, the command-line options and arguments are parsed, and the CmdOpt and CmdArg instances are set. This is done by means of the CmdLine::parse() function.
In the final step, the individual options and arguments are checked.