HepCmdLine is a base class for command line parsing. It uses
the HepCmdArg class and its
subclasses.
The user interfaces of this class and for the
HepCmdArg class were inspired by
the CmdLine package written by Brad Appleton .
However, the coding is entirely new. It was felt that the CmdLine
package was too large and complex when all we wanted was straightforward
command line argument parsing.
See also
HepCmdArg,
HepCmdArgInt,
HepCmdArgFloat,
HepCmdArgBoolean,
HepCmdArgString,
HepCmdArgStringList,
Declaration
#include "CLHEP/String/CmdLine.h"
class HepCmdLine
Public Member Functions
- Constructor
- HepCmdLine(int argc, char **argv)
- Destructor
- ~HepCmdLine()
- append
- void append(HepCmdArg &)
- Append an argument.
- void append(HepCmdArg *arg1, ...)
- Append arguments. Last parameter MUST be 0.
The order matters for positional arguments.
If two optional arguments share a letter, last one appended wins.
- parse
- void parse()
- The parse command. Pass argc, argv directly from
main(), don't remove the first arg.
- printHelp
- void printHelp()
- Prints help and exit.
- printUsage
- void printUsage(ostream &)
- Prints the usage.
- systaxError
- void syntaxError(const char *message)
- Prints the messaget to cerr and exit.
Example
CLHEP/test/testCmd.cc
30 September 1997
EVC