OBT::OptionFlag Class Reference

The option flag. More...

#include <OBTOptionArgExtra.h>

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

List of all members.

Public Member Functions

 OptionFlag (const std::string &flagName, const std::string &helpMsg)
virtual ~OptionFlag ()
virtual bool parseArg ()
 The method to parse the arguments.

Detailed Description

The option flag.

Author:
BenoƮt Chanclou.

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.


Constructor & Destructor Documentation

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.

00072 {}


Member Function Documentation

bool OptionFlag::parseArg (  )  [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 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 }


Generated on 1 Jan 2010 for OBT by  doxygen 1.6.1