ucommon  7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
  Fossies Dox: ucommon-7.0.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
ucommon::shell::flagopt Class Reference

Flag option for shell parsing. More...

#include <shell.h>

Inheritance diagram for ucommon::shell::flagopt:
[legend]
Collaboration diagram for ucommon::shell::flagopt:
[legend]

Public Member Functions

 flagopt (char short_option, const char *long_option=NULL, const char *help=NULL, bool single_use=true)
 
 operator bool () const
 
bool operator! () const
 
 operator unsigned () const
 
unsigned operator* () const
 
void set (unsigned value=1)
 
flagoptoperator= (unsigned value)
 
- Public Member Functions inherited from 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. More...
 
virtual ~Option ()
 
void disable (void)
 Disable a option. More...
 
virtual const char * assign (const char *value)=0
 Used to send option into derived receiver. More...
 
- Public Member Functions inherited from ucommon::LinkedObject
virtual ~LinkedObject ()
 
virtual void release (void) __OVERRIDE
 Release list, mark as no longer linked. More...
 
virtual void retain (void) __OVERRIDE
 Retain by marking as self referenced list. More...
 
void enlist (LinkedObject **root)
 Add our object to an existing linked list through a pointer. More...
 
void delist (LinkedObject **root)
 Locate and remove ourselves from a list of objects. More...
 
bool is_member (LinkedObject *list) const
 Search to see if we are a member of a specific list. More...
 
LinkedObjectgetNext (void) const
 Get next effective object when iterating. More...
 

Private Member Functions

virtual const char * assign (const char *value)
 Used to send option into derived receiver. More...
 
 __DELETE_DEFAULTS (flagopt)
 

Private Attributes

unsigned counter
 
bool single
 

Additional Inherited Members

- Static Public Member Functions inherited from ucommon::shell::Option
static LinkedObjectfirst (void)
 
static void reset (void)
 
- Static Public Member Functions inherited from ucommon::LinkedObject
static void purge (LinkedObject *root)
 Release all objects from a list. More...
 
static unsigned count (const LinkedObject *root)
 Count the number of linked objects in a list. More...
 
static LinkedObjectgetIndexed (LinkedObject *root, unsigned index)
 Get member by index. More...
 
- Public Attributes inherited from ucommon::shell::Option
char short_option
 
const char * long_option
 
const char * uses_option
 
const char * help_string
 
bool trigger_option
 
- Protected Member Functions inherited from ucommon::LinkedObject
 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)
 
- Protected Attributes inherited from ucommon::LinkedObject
LinkedObjectNext
 

Detailed Description

Flag option for shell parsing.

This offers a quick-use class to parse a shell flag, along with a counter for how many times the flag was selected. The counter might be used for -vvvv style verbose options, for example.

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

Definition at line 234 of file shell.h.

Constructor & Destructor Documentation

◆ flagopt()

ucommon::shell::flagopt::flagopt ( char  short_option,
const char *  long_option = NULL,
const char *  help = NULL,
bool  single_use = true 
)

Definition at line 153 of file shell.cpp.

References single.

Member Function Documentation

◆ __DELETE_DEFAULTS()

ucommon::shell::flagopt::__DELETE_DEFAULTS ( flagopt  )
private

◆ assign()

const char * ucommon::shell::flagopt::assign ( const char *  value)
privatevirtual

Used to send option into derived receiver.

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

Implements ucommon::shell::Option.

Definition at line 160 of file shell.cpp.

References ucommon::shell::errmsg(), and ucommon::shell::OPTION_USED.

Here is the call graph for this function:

◆ operator bool()

ucommon::shell::flagopt::operator bool ( ) const
inline

Definition at line 247 of file shell.h.

◆ operator unsigned()

ucommon::shell::flagopt::operator unsigned ( ) const
inline

Definition at line 255 of file shell.h.

◆ operator!()

bool ucommon::shell::flagopt::operator! ( ) const
inline

Definition at line 251 of file shell.h.

◆ operator*()

unsigned ucommon::shell::flagopt::operator* ( ) const
inline

Definition at line 259 of file shell.h.

◆ operator=()

flagopt & ucommon::shell::flagopt::operator= ( unsigned  value)
inline

Definition at line 267 of file shell.h.

◆ set()

void ucommon::shell::flagopt::set ( unsigned  value = 1)
inline

Definition at line 263 of file shell.h.

Member Data Documentation

◆ counter

unsigned ucommon::shell::flagopt::counter
private

Definition at line 237 of file shell.h.

◆ single

bool ucommon::shell::flagopt::single
private

Definition at line 238 of file shell.h.

Referenced by flagopt().


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