Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CmdLineOption Class Reference

A command line switch without an argument. More...

#include <Option.h>

Inheritance diagram for rs::cmdline::CmdLineOption:

Inheritance graph
[legend]
Collaboration diagram for CmdLineOption:

Collaboration graph
[legend]
List of all members.

Public Methods

 CmdLineOption (char optChar_, const char *helptext_)
 Declare a new command line option. More...

virtual ~CmdLineOption ()
 operator bool () const
 Test an option. More...

virtual bool reallyUsed () const
 same as operator bool(). More...

void set ()
 Manually set the options state to 'given'. More...

virtual void clear ()
 Manually set the options state to 'not given'. More...

char get_optChar () const
 get the option character (i.e. 'x' for option -x). More...


Protected Methods

virtual void print (std::ostream &out) const
virtual bool takes_argument () const

Private Attributes

bool used
char optChar

Friends

class ProgramInfo

Detailed Description

A command line switch without an argument.

Definition at line 67 of file Option.h.


Constructor & Destructor Documentation

CmdLineOption char    optChar_,
const char *    helptext_
 

Declare a new command line option.

Options should be declared global.

Parameters:
optChar_  The option character (i.e. 'c' for command line option -c). The character is case sensitive.
helptext_  A description of the option.

Definition at line 124 of file Option.cpp.

~CmdLineOption   [virtual]
 

Definition at line 136 of file Option.cpp.


Member Function Documentation

operator bool   const [inline]
 

Test an option.

Returns:
true if the option was given on the command line or set via set().

Definition at line 85 of file Option.h.

virtual bool reallyUsed   const [inline, virtual]
 

same as operator bool().

Reimplemented in CmdLineArgumentOption, and RepeatedCmdLineArgumentOption.

Definition at line 88 of file Option.h.

Referenced by ProgramInfo::init(), and ProgramInfo::neededBy().

void set   [inline]
 

Manually set the options state to 'given'.

Definition at line 91 of file Option.h.

Referenced by ProgramInfo::init(), and RepeatedCmdLineArgumentOption::RepeatedCmdLineArgumentOption().

virtual void clear   [inline, virtual]
 

Manually set the options state to 'not given'.

Reimplemented in CmdLineArgumentOption, and RepeatedCmdLineArgumentOption.

Definition at line 94 of file Option.h.

char get_optChar   const [inline]
 

get the option character (i.e. 'x' for option -x).

Definition at line 97 of file Option.h.

Referenced by ProgramInfo::neededBy(), RepeatedCmdLineArgumentOption::print(), and CmdLineArgumentOption::print().

void print std::ostream &    out const [protected, virtual]
 

Reimplemented in CmdLineArgumentOption, and RepeatedCmdLineArgumentOption.

Definition at line 139 of file Option.cpp.

virtual bool takes_argument   const [inline, protected, virtual]
 

Reimplemented in CmdLineArgumentOption, and RepeatedCmdLineArgumentOption.

Definition at line 102 of file Option.h.

Referenced by ProgramInfo::init().


Friends And Related Function Documentation

friend class ProgramInfo [friend]
 

Definition at line 100 of file Option.h.


Member Data Documentation

bool used [private]
 

Definition at line 68 of file Option.h.

Referenced by CmdLineOption::CmdLineOption().

char optChar [private]
 

Definition at line 69 of file Option.h.

Referenced by CmdLineOption::CmdLineOption(), and CmdLineOption::print().


The documentation for this class was generated from the following files:
Contact me in case of errors or questions.
This documentation is powered by Doxygen.
(C) 2000-2002 Doxygen