A database of program command line and environment variable options and methods for manipulating them.
More...
#include <Ioss_GetLongOpt.h>
|
| | GetLongOption (char optmark='-') |
| | Create an empty options database. More...
|
| |
| | ~GetLongOption () |
| | Frees dynamically allocated memory. More...
|
| |
| int | parse (int argc, char *const *argv) |
| | parse command line arguments More...
|
| |
| int | parse (char *str, char *p) |
| | parse an argument string. More...
|
| |
| int | enroll (const char *opt, OptType t, const char *desc, const char *val, const char *optval=nullptr) |
| | Enroll a command line option into the database. More...
|
| |
| const char * | retrieve (const char *opt) const |
| | Get a command line option object. More...
|
| |
| void | usage (std::ostream &outfile=std::cout) const |
| | Print the program usage string. More...
|
| |
| void | usage (const char *str) |
| | Set the program usage string. More...
|
| |
|
| static char * | basename (char *pathname) |
| | Extract the base file name from a full path. More...
|
| |
|
| int | setcell (Cell *c, char *valtoken, char *nexttoken, const char *name) |
| |
A database of program command line and environment variable options and methods for manipulating them.
A collection of long command line option names for a program that uses the Ioss library.
◆ OptType
| Enumerator |
|---|
| NoValue | |
| OptionalValue | |
| MandatoryValue | |
◆ GetLongOption()
| Ioss::GetLongOption::GetLongOption |
( |
char |
optmark = '-' | ) |
|
|
explicit |
Create an empty options database.
- Parameters
-
| optmark | The command line symbol designating options. |
◆ ~GetLongOption()
| Ioss::GetLongOption::~GetLongOption |
( |
| ) |
|
Frees dynamically allocated memory.
Frees memory for the private struct variables representing the options.
◆ basename()
| char * Ioss::GetLongOption::basename |
( |
char * |
pathname | ) |
|
|
static |
Extract the base file name from a full path.
Finds the last instance of the '/' character and extracts the part of the string that follows.
- Parameters
-
| [in] | pathname | The full path. |
- Returns
- The base file name.
◆ enroll()
| int Ioss::GetLongOption::enroll |
( |
const char * |
opt, |
|
|
OptType |
t, |
|
|
const char * |
desc, |
|
|
const char * |
val, |
|
|
const char * |
optval = nullptr |
|
) |
| |
Enroll a command line option into the database.
Dynamically allocates memory for the option, sets its name type, description, value, and default value, and links it to the preceding option.
- Parameters
-
| [in] | opt | The long option name. |
| [in] | t | The option type. |
| [in] | desc | A short description of the option. |
| [in] | val | The option value. |
| [in] | optval | The default value. |
- Returns
- 1 if successful, 0 if unsuccessful.
◆ parse() [1/2]
| int Ioss::GetLongOption::parse |
( |
int |
argc, |
|
|
char *const * |
argv |
|
) |
| |
parse command line arguments
Set the values of options in the option table based on the given command line arguments.
- Parameters
-
- Returns
- Number of options processed, or -1 on failure.
◆ parse() [2/2]
| int Ioss::GetLongOption::parse |
( |
char * |
str, |
|
|
char * |
p |
|
) |
| |
parse an argument string.
Set the values of options in the option table based on the given option string.
- Parameters
-
| [in] | str | The option string. |
| [in] | p | A string to be used in error reporting |
- Returns
- 1 if successful, or -1 otherwise.
◆ retrieve()
| const char * Ioss::GetLongOption::retrieve |
( |
const char * |
opt | ) |
const |
Get a command line option object.
- Parameters
-
- Returns
- The option object.
◆ setcell()
| int Ioss::GetLongOption::setcell |
( |
Cell * |
c, |
|
|
char * |
valtoken, |
|
|
char * |
nexttoken, |
|
|
const char * |
name |
|
) |
| |
|
private |
◆ usage() [1/2]
| void Ioss::GetLongOption::usage |
( |
std::ostream & |
outfile = std::cout | ) |
const |
Print the program usage string.
- Parameters
-
| [in] | outfile | The output stream to which the usage string is printed. |
◆ usage() [2/2]
| void Ioss::GetLongOption::usage |
( |
const char * |
str | ) |
|
|
inline |
Set the program usage string.
The program usage string should define the command line syntax for program options and arguments and contain other helpful usage text.
- Parameters
-
◆ enroll_done
| int Ioss::GetLongOption::enroll_done |
|
private |
◆ last
| Cell* Ioss::GetLongOption::last |
|
private |
◆ optmarker
| char Ioss::GetLongOption::optmarker |
|
private |
◆ pname
| char* Ioss::GetLongOption::pname |
|
private |
◆ table
| Cell* Ioss::GetLongOption::table |
|
private |
◆ ustring
| const char* Ioss::GetLongOption::ustring |
|
private |
The documentation for this class was generated from the following files: