The option to retrieve the last argument of a command line. More...
#include <OBTOptionArgExtra.h>
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 |
The option to retrieve the last argument of a command line.
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.
OptionNPrm debugOpt( "-debug", "this option activate the debug mode" ) ; OptionLastArg fileName( "the file name" ) ;
OptionLastArg fileName( "the file name" ) ; OptionNPrm debugOpt( "-debug", "this option activate the debug mode" ) ;
Definition at line 30 of file OBTOptionArgExtra.h.
OBT::OptionLastArg::OptionLastArg | ( | const std::string & | helpMsg | ) | [inline] |
Definition at line 33 of file OBTOptionArgExtra.h.
virtual OBT::OptionLastArg::~OptionLastArg | ( | ) | [inline, virtual] |
Definition at line 34 of file OBTOptionArgExtra.h.
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.
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.
std::string OBT::OptionLastArg::_prm [protected] |
Definition at line 39 of file OBTOptionArgExtra.h.
Referenced by argMatch().