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

RepeatedCmdLineArgumentOption Class Reference

an option with a repeatable argument. More...

#include <Option.h>

Inheritance diagram for rs::cmdline::RepeatedCmdLineArgumentOption:

Inheritance graph
[legend]
Collaboration diagram for RepeatedCmdLineArgumentOption:

Collaboration graph
[legend]
List of all members.

Public Methods

 RepeatedCmdLineArgumentOption (char optChar_, const char *argname_, char separator_, const char *helptext_, const char *value_=0)
 declare a command line switch with repeated argument. More...

virtual ~RepeatedCmdLineArgumentOption ()
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...

std::string get ()
 Get the next part of the separated arguments. More...

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

virtual std::string get_name () const
 Return name of argument option (as shown in helptext: i.e. '<arg>[,<arg>]*' ). 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

Private Attributes

char separator

Detailed Description

an option with a repeatable argument.

Example: -e "text1;text2;text3"

Definition at line 369 of file Option.h.


Constructor & Destructor Documentation

RepeatedCmdLineArgumentOption char    optChar_,
const char *    argname_,
char    separator_,
const char *    helptext_,
const char *    value_ = 0
 

declare a command line switch with repeated argument.

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>)
separator_  The separator for the argument
helptext_  A description of the option.
value_  Default value (defaults to 0). If value_ is set then operator bool returns true.

Definition at line 382 of file Option.cpp.

virtual ~RepeatedCmdLineArgumentOption   [inline, virtual]
 

Definition at line 382 of file Option.h.


Member Function Documentation

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

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

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

Reimplemented from RepeatableCmdLineArgument.

Definition at line 395 of file Option.cpp.

std::string get   [inline, virtual]
 

Get the next part of the separated arguments.

After all values have been read via this function, operator bool() returns false. Further calls return an empty string.

Returns:
next part

Reimplemented from RepeatableCmdLineArgument.

Definition at line 397 of file Option.h.

virtual void clear   [inline, virtual]
 

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

Reimplemented from CmdLineOption.

Definition at line 400 of file Option.h.

string get_name   const [virtual]
 

Return name of argument option (as shown in helptext: i.e. '<arg>[,<arg>]*' ).

Reimplemented from RepeatableCmdLineArgument.

Definition at line 413 of file Option.cpp.

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

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 412 of file Option.h.

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

Reimplemented from CmdLineOption.

Definition at line 421 of file Option.cpp.

virtual bool takes_argument   const [inline, protected, virtual]
 

Reimplemented from CmdLineOption.

Definition at line 416 of file Option.h.


Member Data Documentation

char separator [private]
 

Definition at line 371 of file Option.h.

Referenced by RepeatedCmdLineArgumentOption::get_name(), and RepeatedCmdLineArgumentOption::set().


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