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

RepeatableCmdLineArgument Class Reference

base class for optional and/or repeated command line arguments. More...

#include <Option.h>

Inheritance diagram for rs::cmdline::RepeatableCmdLineArgument:

Inheritance graph
[legend]
Collaboration diagram for RepeatableCmdLineArgument:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual ~RepeatableCmdLineArgument ()
std::string get ()
 Get next of the repeated command line arguments. More...

virtual void set (std::string value_, bool set_default_value=false)
 Manually add new argument. More...

void reset ()
 resets to the first argument. More...

virtual std::string get_name () const
 Return name of argument (as shown in helptext: i.e. "[<arg>]+" ). More...


Protected Methods

 RepeatableCmdLineArgument (const char *name_, const char *helptext_, int min_occur_, int max_occur_, CmdLineArgumentPredicate isArg_, bool is_real_arg)
 RepeatableCmdLineArgument may only be constructed by it's child classes. More...

int get_min_occur () const
int get_max_occur () const
int get_count () const

Private Attributes

int min_occur
int max_occur
std::list< std::string > repeated_values
std::list< std::string > seen_values
CmdLineArgumentPredicate isArg
int count

Friends

class ProgramInfo

Detailed Description

base class for optional and/or repeated command line arguments.

Warning:
Do NOT use this class (use child classes instead)!!!

Definition at line 204 of file Option.h.


Constructor & Destructor Documentation

RepeatableCmdLineArgument const char *    name_,
const char *    helptext_,
int    min_occur_,
int    max_occur_,
CmdLineArgumentPredicate    isArg_,
bool    is_real_arg
[protected]
 

RepeatableCmdLineArgument may only be constructed by it's child classes.

Definition at line 306 of file Option.cpp.

virtual ~RepeatableCmdLineArgument   [inline, virtual]
 

Definition at line 217 of file Option.h.


Member Function Documentation

string get   [virtual]
 

Get next of the repeated command line arguments.

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

Returns:
next command line argument.

Reimplemented from CmdLineArgument.

Reimplemented in RepeatedCmdLineArgumentOption.

Definition at line 339 of file Option.cpp.

Referenced by RepeatableCmdLineArgument::reset().

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

Manually add new argument.

Parameters:
value_  Value of the argument.
set_default_value  defaults to false.
if true then reallyUsed() remains false. Use this to manually add an RepeatableCmdLineArgument without setting the reallyUsed-flag.

Reimplemented from CmdLineArgument.

Reimplemented in RepeatedCmdLineArgumentOption.

Definition at line 235 of file Option.h.

void reset  
 

resets to the first argument.

Definition at line 356 of file Option.cpp.

string get_name   const [virtual]
 

Return name of argument (as shown in helptext: i.e. "[<arg>]+" ).

Reimplemented from CmdLineArgument.

Reimplemented in RepeatedCmdLineArgumentOption.

Definition at line 324 of file Option.cpp.

int get_min_occur   const [inline, protected]
 

Definition at line 250 of file Option.h.

Referenced by ProgramInfo::init().

int get_max_occur   const [inline, protected]
 

Definition at line 251 of file Option.h.

Referenced by ProgramInfo::init().

int get_count   const [inline, protected]
 

Definition at line 252 of file Option.h.

Referenced by ProgramInfo::init().


Friends And Related Function Documentation

friend class ProgramInfo [friend]
 

Reimplemented from CmdLineArgument.

Definition at line 248 of file Option.h.


Member Data Documentation

int min_occur [private]
 

Definition at line 206 of file Option.h.

Referenced by RepeatableCmdLineArgument::get_name(), and RepeatableCmdLineArgument::RepeatableCmdLineArgument().

int max_occur [private]
 

Definition at line 207 of file Option.h.

Referenced by RepeatableCmdLineArgument::get_name(), and RepeatableCmdLineArgument::RepeatableCmdLineArgument().

std::list<std::string> repeated_values [private]
 

Definition at line 208 of file Option.h.

Referenced by RepeatableCmdLineArgument::get(), and RepeatableCmdLineArgument::reset().

std::list<std::string> seen_values [private]
 

Definition at line 209 of file Option.h.

Referenced by RepeatableCmdLineArgument::get(), and RepeatableCmdLineArgument::reset().

CmdLineArgumentPredicate isArg [private]
 

Definition at line 210 of file Option.h.

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

int count [private]
 

Definition at line 211 of file Option.h.

Referenced by RepeatableCmdLineArgument::RepeatableCmdLineArgument().


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