UCommon
ucommon::shell::Option Class Referenceabstract

A base class used to create parsable shell options. More...

#include <shell.h>

Inheritance diagram for ucommon::shell::Option:
Collaboration diagram for ucommon::shell::Option:

Public Member Functions

virtual const char * assign (const char *value)=0
 Used to send option into derived receiver.
 
void disable (void)
 Disable a 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.
 
- Public Member Functions inherited from ucommon::LinkedObject
void delist (LinkedObject **root)
 Locate and remove ourselves from a list of objects.
 
void enlist (LinkedObject **root)
 Add our object to an existing linked list through a pointer.
 
LinkedObjectgetNext (void) const
 Get next effective object when iterating.
 
bool is_member (LinkedObject *list) const
 Search to see if we are a member of a specific list.
 
virtual void release (void)
 Release list, mark as no longer linked.
 
virtual void retain (void)
 Retain by marking as self referenced list.
 
- Public Member Functions inherited from ucommon::ObjectProtocol
ObjectProtocolcopy (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 LinkedObjectfirst (void)
 
static void reset (void)
 
- Static Public Member Functions inherited from ucommon::LinkedObject
static unsigned count (const LinkedObject *root)
 Count the number of linked objects in a list.
 
static LinkedObjectgetIndexed (LinkedObject *root, unsigned index)
 Get member by index.
 
static void purge (LinkedObject *root)
 Release all objects from a list.
 

Data Fields

const char * help_string
 
const char * long_option
 
char short_option
 
bool trigger_option
 
const char * uses_option
 

Additional Inherited Members

- Protected Member Functions inherited from ucommon::LinkedObject
 LinkedObject ()
 Construct base class unattached to anyone.
 
 LinkedObject (const LinkedObject &from)
 
 LinkedObject (LinkedObject **root)
 Construct base class attached to a chain of objects.
 
- Protected Attributes inherited from ucommon::LinkedObject
LinkedObjectNext
 

Detailed Description

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.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 186 of file shell.h.

Constructor & Destructor Documentation

◆ Option()

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.

Parameters
short_optionfor single character code.
long_optionfor extended string.
value_typeif -x value or -long=yyy.
helpstring, future use.

Member Function Documentation

◆ assign()

virtual const char * ucommon::shell::Option::assign ( const char * value)
pure virtual

Used to send option into derived receiver.

Parameters
valueoption that was received.
Returns
NULL or error string to use.

Implemented in ucommon::shell::charopt, ucommon::shell::counteropt, ucommon::shell::numericopt, and ucommon::shell::stringopt.

◆ disable()

void ucommon::shell::Option::disable ( void )

Disable a option.

Might happen if argv0 name suggests an option is no longer actively needed.

Field Documentation

◆ help_string

const char* ucommon::shell::Option::help_string

Definition at line 195 of file shell.h.

◆ long_option

const char* ucommon::shell::Option::long_option

Definition at line 193 of file shell.h.

◆ short_option

char ucommon::shell::Option::short_option

Definition at line 192 of file shell.h.

◆ trigger_option

bool ucommon::shell::Option::trigger_option

Definition at line 196 of file shell.h.

◆ uses_option

const char* ucommon::shell::Option::uses_option

Definition at line 194 of file shell.h.


The documentation for this class was generated from the following file: