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
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()
|
virtual |
Destructor.
Definition at line 651 of file options.cpp.
Member Function Documentation
◆ help()
|
virtual |
Print help text.
Reimplemented in BIBDOptions, Gecode::FlatZinc::FlatZincOptions, Gecode::InstanceOptions, Gecode::SizeOptions, JobShopOptions, LangfordNumberOptions, SchurOptions, and SteelMillOptions.
Definition at line 557 of file options.cpp.
◆ 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()
|
inline |
Parse options with strict checking (equivalent to parse() with true).
Definition at line 195 of file options.hpp.
◆ parse_permissive()
|
inline |
Parse options partially (equivalent to parse() with false).
Definition at line 199 of file options.hpp.
◆ name() [1/2]
|
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
|
protected |
◆ lst
|
protected |
◆ _name
|
protected |
The documentation for this class was generated from the following files:
- gecode/driver.hh
- gecode/driver/options.cpp
- gecode/driver/options.hpp
