UCommon
|
A base class used to create parsable shell options. More...
#include <shell.h>
Public Member Functions | |
virtual const char * | assign (const char *value)=0 |
Used to send option into derived receiver. More... | |
void | disable (void) |
Disable a option. More... | |
Option (char short_option=0, const char *long_option=NULL, const char *value_type=NULL, const char *help=NULL) | |
Construct a shell parser option. More... | |
![]() | |
void | delist (LinkedObject **root) |
Locate and remove ourselves from a list of objects. More... | |
void | enlist (LinkedObject **root) |
Add our object to an existing linked list through a pointer. More... | |
LinkedObject * | getNext (void) const |
Get next effective object when iterating. More... | |
bool | is_member (LinkedObject *list) const |
Search to see if we are a member of a specific list. More... | |
virtual void | release (void) |
Release list, mark as no longer linked. More... | |
virtual void | retain (void) |
Retain by marking as self referenced list. More... | |
![]() | |
ObjectProtocol * | copy (void) |
Retain (increase retention of) object when copying. | |
void | operator++ (void) |
Increase retention operator. | |
void | operator-- (void) |
Decrease retention operator. | |
virtual | ~ObjectProtocol () |
Required virtual destructor. | |
Static Public Member Functions | |
static LinkedObject * | first (void) |
static void | reset (void) |
![]() | |
static unsigned | count (const LinkedObject *root) |
Count the number of linked objects in a list. More... | |
static LinkedObject * | getIndexed (LinkedObject *root, unsigned index) |
Get member by index. More... | |
static void | purge (LinkedObject *root) |
Release all objects from a list. More... | |
Data Fields | |
const char * | help_string |
const char * | long_option |
char | short_option |
bool | trigger_option |
const char * | uses_option |
Additional Inherited Members | |
![]() | |
LinkedObject (LinkedObject **root) | |
Construct base class attached to a chain of objects. More... | |
LinkedObject () | |
Construct base class unattached to anyone. More... | |
LinkedObject (const LinkedObject &from) | |
![]() | |
LinkedObject * | Next |
A base class used to create parsable shell options.
The virtual is invoked when the shell option is detected. Both short and long forms of argument parsing are supported. An instance of a derived class is created to perform the argument parsing.
ucommon::shell::Option::Option | ( | char | short_option = 0 , |
const char * | long_option = NULL , |
||
const char * | value_type = NULL , |
||
const char * | help = NULL |
||
) |
Construct a shell parser option.
short_option | for single character code. |
long_option | for extended string. |
value_type | if -x value or -long=yyy. |
help | string, future use. |
|
pure virtual |
Used to send option into derived receiver.
value | option that was received. |
Implemented in ucommon::shell::counteropt, ucommon::shell::numericopt, ucommon::shell::charopt, and ucommon::shell::stringopt.
void ucommon::shell::Option::disable | ( | void | ) |
Disable a option.
Might happen if argv0 name suggests an option is no longer actively needed.