JWS C++ Library
C++ language utility library
|
Base program option. More...
#include <option.h>
Public Member Functions | |
Option (char s_name, const char *l_name, const char *desc) throw (Arg_error) | |
Constructs an Option. | |
virtual | ~Option () |
Deletes an Option. | |
virtual int | process (int argc, char **argv) const =0 throw (Arg_error) |
Processes an Option from program command-line arguments. | |
virtual void | print (ostream &out, int width) const =0 throw (Arg_error) |
Prints an Option to an output stream. | |
Protected Member Functions | |
bool | is_s_name_option (const char *arg) const |
Returns whether or not arg is the short name of this Option. | |
bool | is_l_name_option (const char *arg) const |
Returns whether or not arg is the long name of this Option. | |
Protected Attributes | |
char | s_name |
Short name of the option. | |
const char * | l_name |
Long name of the option. | |
const char * | desc |
Description of the option. |
Base program option.
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::Option | ( | char | s_name, |
const char * | l_name, | ||
const char * | desc | ||
) | throw (Arg_error) |
virtual jwscxx::base::Option::~Option | ( | ) | [inline, virtual] |
virtual int jwscxx::base::Option::process | ( | int | argc, |
char ** | argv | ||
) | const throw (Arg_error) [pure virtual] |
Processes an Option from program command-line arguments.
Implemented in jwscxx::base::Option_with_arg, and jwscxx::base::Option_no_arg.
virtual void jwscxx::base::Option::print | ( | ostream & | out, |
int | width | ||
) | const throw (Arg_error) [pure virtual] |
Prints an Option to an output stream.
Implemented in jwscxx::base::Option_with_arg, and jwscxx::base::Option_no_arg.
bool Option::is_s_name_option | ( | const char * | arg | ) | const [protected] |
Returns whether or not arg is the short name of this Option.
arg | Program argument to check if it is this Option. |
Definition at line 114 of file option.cpp.
bool Option::is_l_name_option | ( | const char * | arg | ) | const [protected] |
Returns whether or not arg is the long name of this Option.
arg | Program argument to check if it is this Option. |
Definition at line 132 of file option.cpp.
char jwscxx::base::Option::s_name [protected] |
const char* jwscxx::base::Option::l_name [protected] |
const char* jwscxx::base::Option::desc [protected] |