16#include "ioss_export.h"
45 const char *
ustring{
"[valid options and arguments]"};
51 int setcell(Cell *c,
char *valtoken,
char *nexttoken,
const char *name);
57 static char *basename(
char *pathname);
59 int parse(
int argc,
char *
const *argv);
60 int parse(
char *str,
char *p);
62 bool enroll(
const char *opt, OptType t,
const char *desc,
const char *val,
63 const char *optval =
nullptr,
bool extra_line =
false);
64 const char *retrieve(
const char *opt)
const;
65 const char *program_name()
const;
67 void usage(std::ostream &outfile = std::cout)
const;
78 template <
class INT,
typename std::enable_if_t<std::is_
integral_v<INT>, INT> * =
nullptr>
81 INT value = default_value;
82 const char *temp =
retrieve(option_txt);
83 if (temp !=
nullptr) {
84 value = std::strtol(temp,
nullptr, 10);
89 template <
class DBL,
typename std::enable_if_t<std::is_
floating_po
int_v<DBL>, DBL> * =
nullptr>
92 DBL value = default_value;
93 const char *temp =
retrieve(option_txt);
94 if (temp !=
nullptr) {
95 value = std::strtod(temp,
nullptr);
100 std::string
get_option_value(
const char *option_txt,
const std::string &default_value)
const
102 auto value = default_value;
103 const char *temp =
retrieve(option_txt);
104 if (temp !=
nullptr) {
A database of program command line and environment variable options and methods for manipulating them...
Definition Ioss_GetLongOpt.h:25
char optmarker
Definition Ioss_GetLongOpt.h:48
DBL get_option_value(const char *option_txt, DBL default_value)
Definition Ioss_GetLongOpt.h:90
char * pname
Definition Ioss_GetLongOpt.h:46
GetLongOption(char optmark='-')
Create an empty options database.
Definition Ioss_GetLongOpt.C:21
void usage(const char *str)
Set the program usage string.
Definition Ioss_GetLongOpt.h:76
OptType
Definition Ioss_GetLongOpt.h:27
@ MandatoryValue
Definition Ioss_GetLongOpt.h:27
@ NoValue
Definition Ioss_GetLongOpt.h:27
@ OptionalValue
Definition Ioss_GetLongOpt.h:27
Cell * table
Definition Ioss_GetLongOpt.h:44
bool options_parsed
Definition Ioss_GetLongOpt.h:49
const char * ustring
Definition Ioss_GetLongOpt.h:45
Cell * last
Definition Ioss_GetLongOpt.h:47
INT get_option_value(const char *option_txt, INT default_value)
Definition Ioss_GetLongOpt.h:79
std::string get_option_value(const char *option_txt, const std::string &default_value) const
Definition Ioss_GetLongOpt.h:100
const char * retrieve(const char *opt) const
Get a command line option object.
Definition Ioss_GetLongOpt.C:106
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
Definition Ioss_GetLongOpt.h:31
OptType type
Definition Ioss_GetLongOpt.h:38
Cell * next
Definition Ioss_GetLongOpt.h:37
const char * value
Definition Ioss_GetLongOpt.h:34
const char * opt_value
Definition Ioss_GetLongOpt.h:35
bool extra_line
Definition Ioss_GetLongOpt.h:39
const char * description
Definition Ioss_GetLongOpt.h:33
const char * option
Definition Ioss_GetLongOpt.h:32