The option flag. More...
#include <OBTOptionArgExtra.h>
Public Member Functions | |
OptionFlag (const std::string &flagName, const std::string &helpMsg) | |
virtual | ~OptionFlag () |
virtual bool | parseArg () |
The method to parse the arguments. |
The option flag.
An option flag without parameter arguments.
Usage:
In the command line
-trace -debug
To retrieve such command arguments
OptionFlag traceOpt( "-trace", "this option activate the trace mode" ) ; OptionFlag debugOpt( "-debug", "this option activate the debug mode" ) ;
To get the parameters
if( traceOpt.isPresent() ) { // -trace is in the command line ... do something } activateDebugMode( debugOpt.isPresent() ) ; // -debug is in the command line ...
Definition at line 68 of file OBTOptionArgExtra.h.
OBT::OptionFlag::OptionFlag | ( | const std::string & | flagName, | |
const std::string & | helpMsg | |||
) | [inline] |
Definition at line 71 of file OBTOptionArgExtra.h.
00071 : OptionArg( flagName, helpMsg ) {}
virtual OBT::OptionFlag::~OptionFlag | ( | ) | [inline, virtual] |
Definition at line 72 of file OBTOptionArgExtra.h.
bool OptionFlag::parseArg | ( | ) | [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 13 of file OBTOptionArgExtra.cpp.
References OBT::OptionArg::_flag, and OBT::OptionArg::throwError().
00014 { 00015 if( _flag ) throwError( "This option cannot be used more than once" ) ; 00016 return true ; 00017 }