#include <cmdargs.h> class CmdArgDummy : public CmdArg ; class CmdArgUsage : public CmdArg ; class CmdArgIntCompiler : public CmdArg ; class CmdArgInt : public CmdArgIntCompiler ; class CmdArgIntList : public CmdArgIntCompiler ; class CmdArgFloatCompiler : public CmdArg ; class CmdArgFloat : public CmdArgFloatCompiler ; class CmdArgFloatList : public CmdArgFloatCompiler ; class CmdArgCharCompiler : public CmdArg ; class CmdArgChar : public CmdArgCharCompiler ; class CmdArgStrCompiler : public CmdArg ; class CmdArgStr : public CmdArgStrCompiler ; class CmdArgStrList : public CmdArgStrCompiler ; class CmdArgBoolCompiler : public CmdArg ; class CmdArgBool : public CmdArgBoolCompiler ; class CmdArgClear : public CmdArgBool ; class CmdArgToggle : public CmdArgBool ; class CmdArgBoolRef : public CmdArg ; class CmdArgClearRef : public CmdArg ; class CmdArgToggleRef : public CmdArg ;
cmdargs(3) is the portion of the CmdLine(3) library that contains the predefined argument types to use in conjunction with one or more CmdLine objects. The include file <cmdargs.h> defines classes derived from class CmdArg (which is defined in <cmdline.h>) for the most commonly used types of command-line arguments. Most command-line arguments are either boolean-flags, a number, a character, or a string (or a list of numbers or strings). In each of these cases, the call operator (operator()) of the argument just compiles the value given into some internal value and waits for the programmer to query the value at some later time.
These types of arguments are referred to as "ArgCompilers". For each of the most common argument types, a corresponding abstract ArgCompiler class is declared. All that this class does is to add a member function named "compile" to the class. The compile() function looks exactly like the call operator but it takes an additional parameter: a reference to the value to be modified by compiling the argument value. In all other respects, the compile() member function behaves exactly like the call operator. In fact, most of the call operator member functions simply call the ArgCompiler's compile() member function with the appropriate value and return whatever the compile function returned.
Once all of these ArgCompilers are declared, it is a simple matter to declare a class that holds a single item, or a list of items, by deriving it from the corresponding ArgCompiler type.
For derived classes of these ArgCompilers that hold a single item, The derived class implements some operators (such as operator= and an appropriate cast operator) to treat the argument as if it were simply an item (instead of an argument that contains an item). The output operator (ostream & operator<<) is also defined.
For derived classes of ArgCompilers that hold a list of items, the subscript operator (operator[]) is defined in order to treat the argument as if it were simply an array of items and not an argument that contains a list of items.
man2html: unable to open or read file ../example.man
man2html: unable to open or read file ../classes.man
man2html: unable to open or read file ../files.man