#include <cmdline.h> class CmdArg ; // An abstract command-argument class CmdLineArgIter ; // abstract iterator for command-line-arguments class CmdArgvIter : public CmdLineArgIter ; class CmdStrTokIter : public CmdLineArgIter ; class CmdIstreamIter : public CmdLineArgIter ; class CmdLine ; // A command-line object class CmdLineCmdArgIter ; // iterator for a CmdLine's CmdArgs
CmdLine is a set of classes to parse command-line arguments. Unlike getopt(3C) and its variants, CmdLine does more than just split up the command-line into some canonical form. CmdLine will actually parse the command-line, assigning the appropriate command-line values to the corresponding variables, and will verify the command-line syntax (and print a usage message if necessary) all in one member function call. Furthermore, many features of CmdLine's parsing behavior are configurable at run-time. These features include the following:
CmdLine also allows for options that take an optional argument, options that take a (possibly optional) list of one or more arguments, options whose argument must reside in the same token as the option itself, and options whose argument must reside in a separate token from the option itself.
CmdLine consists of a set of classes to parse arguments from an input source called a CmdLineArgIter (which is a base class for iterating over arguments from an arbitrary input source). Argument iterators are defined for an argv[] array (with or without a corresponding argc), for a string of tokens that are separated by a given set of delimiters, and for an input-stream. Users can easily extend CmdLine to parse arguments from other input sources simply by creating their own argument iterator classes derived from the CmdLineArgIter class defined in <cmdline.h>.
Command-line arguments are themselves objects that contain a specific command-line interface, and a function that performs the desired actions when its corresponding argument is seen on the command line. Predefined command-line argument types (derived from the abstract class CmdArg in <cmdline.h>) exist for boolean, integer, floating-point, character, and string arguments, and for lists of integers, floats, and strings. These predefined subclasses of CmdArg may be found in <cmdargs.h>. Users can also create their own command-argument types on the fly by defining and implementing an appropriate subclass of the CmdArg class.
man2html: unable to open or read file ../example.man
man2html: unable to open or read file ../parsing.man
man2html: unable to open or read file ../environ.man
man2html: unable to open or read file ../classes.man
man2html: unable to open or read file ../files.man
man2html: unable to open or read file ../caveats.man
man2html: unable to open or read file ../bugs.man