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

CmdLineArgumentOption Class Reference

A command line option which has to be followed by an argument. More...

#include <Option.h>

Inheritance diagram for rs::cmdline::CmdLineArgumentOption:

Inheritance graph
[legend]
Collaboration diagram for CmdLineArgumentOption:

Collaboration graph
[legend]
List of all members.

Public Methods

 CmdLineArgumentOption (char optChar_, const char *argname_, const char *helptext_, const char *value_=0)
 Declare a new argument option. More...

virtual ~CmdLineArgumentOption ()
virtual void set (std::string value_, bool set_default_value=false)
 Manually set the options state to 'given' and set the value of the argument of the option. More...

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

virtual bool reallyUsed () const
 Return true only if option was given on command line or set using set. More...


Protected Methods

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

Detailed Description

A command line option which has to be followed by an argument.

Definition at line 319 of file Option.h.


Constructor & Destructor Documentation

CmdLineArgumentOption char    optChar_,
const char *    argname_,
const char *    helptext_,
const char *    value_ = 0
 

Declare a new argument option.

CmdLineArgumentOptions should be declared global.

Parameters:
optChar_  The option character (i.e. 'c' for command line option -c). The character is case sensitive.
argname_  The name of the argument as it should be used in the helptext. (i.e. "filename" results in <filename>)
helptext_  A description of the option.
value_  Default value (defaults to 0). If value_ is set then operator bool returns true.

Definition at line 158 of file Option.cpp.

~CmdLineArgumentOption   [virtual]
 

Definition at line 179 of file Option.cpp.


Member Function Documentation

virtual void set std::string    value_,
bool    set_default_value = false
[inline, virtual]
 

Manually set the options state to 'given' and set the value of the argument of the option.

Parameters:
value_  the new value
set_default_value  if true -> reallyUsed() returns false

Reimplemented from CmdLineArgument.

Definition at line 339 of file Option.h.

Referenced by ProgramInfo::init().

virtual void clear   [inline, virtual]
 

Manually set the state of the option to 'not given'.

Reimplemented from CmdLineOption.

Definition at line 345 of file Option.h.

virtual bool reallyUsed   const [inline, virtual]
 

Return true only if option was given on command line or set using set.

operator bool() also returns true if the option was set by specifying a default value.

Reimplemented from CmdLineOption.

Definition at line 354 of file Option.h.

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

Reimplemented from CmdLineOption.

Definition at line 185 of file Option.cpp.

virtual bool takes_argument   const [inline, protected, virtual]
 

Reimplemented from CmdLineOption.

Definition at line 358 of file Option.h.


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