16#include "ioss_export.h"
27 enum OptType { NoValue, OptionalValue, MandatoryValue };
32 const char *option{
nullptr};
33 const char *description{
nullptr};
34 const char *value{
nullptr};
35 const char *opt_value{
39 bool extra_line{
false};
45 const char *ustring{
"[valid options and arguments]"};
49 bool options_parsed{
false};
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;
76 void usage(
const char *str) { ustring = str; }
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
void usage(const char *str)
Set the program usage string.
Definition Ioss_GetLongOpt.h:76
OptType
Definition Ioss_GetLongOpt.h:27
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
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
Definition Ioss_GetLongOpt.h:31