OBT::OptionLastArg Class Reference

The option to retrieve the last argument of a command line. More...

#include <OBTOptionArgExtra.h>

Inheritance diagram for OBT::OptionLastArg:
[legend]
Collaboration diagram for OBT::OptionLastArg:
[legend]

List of all members.

Public Member Functions

 OptionLastArg (const std::string &helpMsg)
virtual ~OptionLastArg ()
virtual bool argMatch ()
 Returns true if the argument matches the option flag.
virtual bool parseArg ()
 The method to parse the arguments.
const std::string & getPrm () const

Protected Attributes

std::string _prm

Detailed Description

The option to retrieve the last argument of a command line.

Author:
BenoƮt Chanclou.

There is no flag for this option, its value returned by getPrm is simply the last argument of the command line (if it is not use for the parameters of a option flag).

Important To work it must be the last creating option argument parser.

Definition at line 30 of file OBTOptionArgExtra.h.


Constructor & Destructor Documentation

OBT::OptionLastArg::OptionLastArg ( const std::string &  helpMsg  )  [inline]

Definition at line 33 of file OBTOptionArgExtra.h.

00033 : OptionArg( "<last arg>", helpMsg ), _prm() {}

virtual OBT::OptionLastArg::~OptionLastArg (  )  [inline, virtual]

Definition at line 34 of file OBTOptionArgExtra.h.

00034 {}


Member Function Documentation

bool OptionLastArg::argMatch (  )  [virtual]

Returns true if the argument matches the option flag.

Reimplemented from OBT::OptionArg.

Definition at line 6 of file OBTOptionArgExtra.cpp.

References OBT::OptionArg::_flag, _prm, OBT::OptionArg::atLastArg(), OBT_ASSERT, and OBT::OptionArg::peekArg().

00007 { 
00008   OBT_ASSERT( !_flag && "Unable to parse the arguments " ) ;
00009   _prm = peekArg() ; 
00010   return atLastArg() ; 
00011 }

const std::string& OBT::OptionLastArg::getPrm (  )  const [inline]

Definition at line 37 of file OBTOptionArgExtra.h.

00037 { return _prm ; }

virtual bool OBT::OptionLastArg::parseArg (  )  [inline, virtual]

The method to parse the arguments.

Returns:
true if the arguments can be parsed.

Retrieves the argument which can be following the option flag. See OptionFlag::parseArg, OptionNPrm::parseArg, OptionMultiNPrm::parseArg for examples.

Implements OBT::OptionArg.

Definition at line 36 of file OBTOptionArgExtra.h.

00036 { return true ; }


Member Data Documentation

std::string OBT::OptionLastArg::_prm [protected]

Definition at line 39 of file OBTOptionArgExtra.h.

Referenced by argMatch().


Generated on 1 Jan 2010 for OBT by  doxygen 1.6.1