Generated on for Gecode by doxygen 1.17.0

Base class for script options. More...

#include <gecode/driver.hh>

Public Member Functions

 BaseOptions (const char *s)
 Initialize options for script with name s.
virtual void help (void)
 Print help text.
void add (Driver::BaseOption &o)
 Add new option o.
void parse (int &argc, char *argv[])
 Parse options from arguments argv (number is argc).
void parse (int &argc, char *argv[], bool strict)
 Parse options, optionally rejecting unrecognised arguments.
void parse_strict (int &argc, char *argv[])
 Parse options with strict checking (equivalent to parse() with true).
void parse_permissive (int &argc, char *argv[])
 Parse options partially (equivalent to parse() with false).
const char * name (void) const
 Return name of script.
void name (const char *)
 Set name of script.
virtual ~BaseOptions (void)
 Destructor.

Protected Attributes

Driver::BaseOption * fst
 First registered option.
Driver::BaseOption * lst
 Last registered option.
const char * _name
 Script name.

Detailed Description

Base class for script options.

Definition at line 391 of file driver.hh.

Constructor & Destructor Documentation

◆ BaseOptions()

Gecode::BaseOptions::BaseOptions ( const char * s)

Initialize options for script with name s.

Definition at line 546 of file options.cpp.

◆ ~BaseOptions()

Gecode::BaseOptions::~BaseOptions ( void )
virtual

Destructor.

Definition at line 651 of file options.cpp.

Member Function Documentation

◆ help()

void Gecode::BaseOptions::help ( void )
virtual

◆ add()

void Gecode::BaseOptions::add ( Driver::BaseOption & o)

Add new option o.

Definition at line 537 of file options.cpp.

◆ parse() [1/2]

void Gecode::BaseOptions::parse ( int & argc,
char * argv[] )

Parse options from arguments argv (number is argc).

The options are parsed from position one onwards until no more options are detected. After parsing, the parsed arguments have been removed.

Strict parsing will become the default in a future major release. Use parse_permissive() to explicitly retain partial parsing.

Definition at line 611 of file options.cpp.

◆ parse() [2/2]

void Gecode::BaseOptions::parse ( int & argc,
char * argv[],
bool strict )

Parse options, optionally rejecting unrecognised arguments.

With strict set to false, this behaves like the two-argument overload. With strict set to true, any remaining argument causes an error message and help text to be printed, followed by exit with failure. Use strict parsing when no positional arguments or further parsing are expected. SizeOptions and InstanceOptions accept their size or instance as the only remaining argument. Help options are handled as in the two-argument overload.

Definition at line 645 of file options.cpp.

◆ parse_strict()

void Gecode::BaseOptions::parse_strict ( int & argc,
char * argv[] )
inline

Parse options with strict checking (equivalent to parse() with true).

Definition at line 195 of file options.hpp.

◆ parse_permissive()

void Gecode::BaseOptions::parse_permissive ( int & argc,
char * argv[] )
inline

Parse options partially (equivalent to parse() with false).

Definition at line 199 of file options.hpp.

◆ name() [1/2]

const char * Gecode::BaseOptions::name ( void ) const
inline

Return name of script.

Definition at line 204 of file options.hpp.

◆ name() [2/2]

void Gecode::BaseOptions::name ( const char * n)

Set name of script.

Definition at line 551 of file options.cpp.

Member Data Documentation

◆ fst

Driver::BaseOption* Gecode::BaseOptions::fst
protected

First registered option.

Definition at line 393 of file driver.hh.

◆ lst

Driver::BaseOption* Gecode::BaseOptions::lst
protected

Last registered option.

Definition at line 394 of file driver.hh.

◆ _name

const char* Gecode::BaseOptions::_name
protected

Script name.

Definition at line 395 of file driver.hh.


The documentation for this class was generated from the following files: