Functions related to the parsing of program arguments.
More...
|
template<class T > |
T | parsePositiveNumber (const string &number) |
|
bool | getArgument (int &i, int argc, char *argv[], const string &fullName, const string &shortName, string &writeArgument) |
| It processes the arguments with one parameter. More...
|
|
bool | processArg (int &i, int argc, char *argv[], const string &fullName, const string &shortName, bool *toWrite=nullptr) |
| It processes the arguments without parameters. More...
|
|
bool | processArg (int &i, int argc, char *argv[], const string &fullName, const string &shortName, string &toWrite) |
| It processes the arguments with one string parameter. More...
|
|
template<class T > |
bool | processArg (int &i, int argc, char *argv[], const string &fullName, const string &shortName, T &toWrite, T minValue=1) |
| It processes the arguments with one numerical parameter. More...
|
|
bool | processCommandLineArguments (int argc, char *argv[]) |
| It parses the program arguments and sets the desired parameters for optimization. More...
|
|
Functions related to the parsing of program arguments.
Various functions related to the processing of program arguments. Passed arguments are reflected in the setting of the program.
- See also
- Settings
bool getArgument |
( |
int & |
i, |
|
|
int |
argc, |
|
|
char * |
argv[], |
|
|
const string & |
fullName, |
|
|
const string & |
shortName, |
|
|
string & |
writeArgument |
|
) |
| |
It processes the arguments with one parameter.
- Parameters
-
[in,out] | i | A reference to the index pointing to the current argument to be processed. The index may be updated. |
| argc | The number of program arguments including the program name. |
| argv | Arguments of the program. |
| fullName | The full name of the argument, e.g. "--use-heuristic-algorithm". |
| shortName | Abbreviated version of the full argument, e.g. "-uha". |
[out] | writeArgument | String to which the parameter of the argument is written, e.g. for "--max-runtime 10.5" the string contains "10.5". |
- Returns
- Whether the argument with the given name (short or full) was processed.
Definition at line 154 of file ProjectSolver.cpp.
template<class T >
T parsePositiveNumber |
( |
const string & |
number | ) |
|
- Parameters
-
number | A string containing only a positive number. |
- Template Parameters
-
T | Either unsigned integer or double. |
- Returns
- A positive number parsed from the string.
- Exceptions
-
Definition at line 131 of file ProjectSolver.cpp.
bool processArg |
( |
int & |
i, |
|
|
int |
argc, |
|
|
char * |
argv[], |
|
|
const string & |
fullName, |
|
|
const string & |
shortName, |
|
|
bool * |
toWrite = nullptr |
|
) |
| |
It processes the arguments without parameters.
- Parameters
-
[in,out] | i | A reference to the index pointing to the current argument to be processed. The index may be updated. |
| argc | The number of program arguments including the program name. |
| argv | Arguments of the program. |
| fullName | The full name of the argument, e.g. "--use-heuristic-algorithm". |
| shortName | Abbreviated version of the full argument, e.g. "-uha". |
[out] | toWrite | A pointer to a boolean variable that is set to true if the argument, e.g. "--verbose", is passed to the program. |
- Returns
- Whether the argument with the given name (short or full) was processed.
Definition at line 178 of file ProjectSolver.cpp.
bool processArg |
( |
int & |
i, |
|
|
int |
argc, |
|
|
char * |
argv[], |
|
|
const string & |
fullName, |
|
|
const string & |
shortName, |
|
|
string & |
toWrite |
|
) |
| |
It processes the arguments with one string parameter.
- Parameters
-
[in,out] | i | A reference to the index pointing to the current argument to be processed. The index may be updated. |
| argc | The number of program arguments including the program name. |
| argv | Arguments of the program. |
| fullName | The full name of the argument, e.g. "--use-heuristic-algorithm". |
| shortName | Abbreviated version of the full argument, e.g. "-uha". |
[out] | toWrite | String to which the parameter of the given argument is written. |
- Returns
- Whether the argument with the given name (short or full) was processed.
Definition at line 199 of file ProjectSolver.cpp.
template<class T >
bool processArg |
( |
int & |
i, |
|
|
int |
argc, |
|
|
char * |
argv[], |
|
|
const string & |
fullName, |
|
|
const string & |
shortName, |
|
|
T & |
toWrite, |
|
|
T |
minValue = 1 |
|
) |
| |
It processes the arguments with one numerical parameter.
- Parameters
-
[in,out] | i | A reference to the index pointing to the current argument to be processed. The index may be updated. |
| argc | The number of program arguments including the program name. |
| argv | Arguments of the program. |
| fullName | The full name of the argument, e.g. "--use-heuristic-algorithm". |
| shortName | Abbreviated version of the full argument, e.g. "-uha". |
- Template Parameters
-
T | Either positive integer or double. |
- Parameters
-
[out] | toWrite | A reference to a variable to which the parameter of the given argument is written. |
| minValue | The minimal allowed value of the parameter. |
- Returns
- Whether the argument with the given name (short or full) was processed.
Definition at line 216 of file ProjectSolver.cpp.
bool processCommandLineArguments |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
It parses the program arguments and sets the desired parameters for optimization.
- Parameters
-
argc | The number of program arguments (+parameters) passed to the program is argc-1. |
argv | Program name and arguments (+parameters) of the program. |
- Returns
- Returns true if the program should exit, otherwise false.
Definition at line 243 of file ProjectSolver.cpp.