JWS C++ Library
C++ language utility library
|
Option that does not take an argument. More...
#include <option.h>
Public Member Functions | |
Option_no_arg (char s_name, const char *l_name, const char *desc, void(*func)(void)) throw (Arg_error) | |
Constructs an Option that does not take an argument. | |
int | process (int argc, char **argv) const throw (Arg_error) |
Processes an Option from program command-line arguments. | |
void | print (ostream &out, int width) const throw (Arg_error) |
Prints an Option to an output stream. | |
Protected Attributes | |
void(* | func )(void) |
Function to process an Option with an argument. |
Option that does not take an argument.
An option is specified on the command-line as follows
--option-string
-O
where
Option::l_name = "option-string" Option::s_name = 'O'
Specifying an option in a file is similar, but only the Option::l_name can be used, for instance
option-string
Option_no_arg::Option_no_arg | ( | char | s_name, |
const char * | l_name, | ||
const char * | desc, | ||
void(*)(void) | func | ||
) | throw (Arg_error) |
int Option_no_arg::process | ( | int | argc, |
char ** | argv | ||
) | const throw (Arg_error) [virtual] |
Processes an Option from program command-line arguments.
argc | Number of command-line arguments. |
argv | The command-line arguments. |
Arg_error | Error in processing the Option. This will never actually occur. It is just here because the function extends a virtual one. |
Implements jwscxx::base::Option.
Definition at line 431 of file option.cpp.
void Option_no_arg::print | ( | ostream & | out, |
int | width | ||
) | const throw (Arg_error) [virtual] |
Prints an Option to an output stream.
The format for printing is as follows
-O, --option-string Option description.
The Option::desc may wrap to multiple lines, but will be aligned properly.
out | Output stream to print to. |
width | Width of the option name field to use. |
Arg_error | Maximum width is 60. |
Implements jwscxx::base::Option.
Definition at line 463 of file option.cpp.
void(* jwscxx::base::Option_no_arg::func)(void) [protected] |