27 int arg_set_vector_str(
int,
char **,
void *);
28 inline int arg_set(
int a,
char **b, std::vector<std::string> &c){
return arg_set_vector_str(a,b, &c); }
32 int arg_set_region(
int,
char **,
void *);
33 inline int arg_set(
int a,
char **b,
Region &c){
return arg_set_region(a,b, &c); }
37 int arg_set_vector_uli(
int,
char **,
void *);
38 inline int arg_set(
int a,
char **b, std::vector<unsigned long int> &c){
return arg_set_vector_uli(a,b, &c); }
40 int arg_set_vector_ulli(
int,
char **,
void *);
41 inline int arg_set(
int a,
char **b, std::vector<unsigned long long int> &c){
return arg_set_vector_ulli(a,b, &c); }
45 int arg_set_vector_ui(
int,
char **,
void *);
46 inline int arg_set(
int a,
char **b, std::vector<unsigned int> &c){
return arg_set_vector_ui(a,b, &c); }
50 int arg_set_int(
int,
char **,
void *);
51 inline int arg_set(
int a,
char **b,
int &c){
return arg_set_int(a,b, &c); }
55 int arg_set_vector_usi(
int,
char **,
void *);
56 inline int arg_set(
int a,
char **b, std::vector<unsigned short int> &c){
return arg_set_vector_usi(a,b, &c); }
59 int arg_set_str(
int,
char **,
void *);
60 inline int arg_set(
int a,
char **b, std::string &c){
return arg_set_str(a,b, &c); }
63 int arg_set_char(
int,
char **,
void *);
64 inline int arg_set(
int a,
char **b,
char &c){
return arg_set_char(a,b, &c); }
67 int arg_set_float(
int,
char **,
void *);
68 inline int arg_set(
int a,
char **b,
float &c){
return arg_set_float(a,b, &c); }
71 int arg_set_double(
int,
char **,
void *);
72 inline int arg_set(
int a,
char **b,
double &c){
return arg_set_double(a,b, &c); }
75 int arg_set_long_double(
int,
char **,
void *);
76 inline int arg_set(
int a,
char **b,
long double &c){
return arg_set_long_double(a,b, &c); }
87 int flag_usage(
void *);
89 int flag_version(
void *);
91 int flag_help(
void *);
93 int flag_commands(
void *);
95 int flag_options(
void *);
98 int arg_error(
int,
char **,
void *);
100 int flag_error(
void *);
102 int command_error(
int,
char **);
118 Flag (
char opt_,
char* lopt_,
void *parm_,
int (*func_)(
void *),
char *emsg_,
char *umsg_){
163 int (*func_)(
int,
char **,
void *),
177 template <
class Type>
185 parm=(
void *)(&parm_);
186 func=(int (*)(int,
char **,
void*) )( (int (*)(int,
char **, Type &) )&arg_set);
199 int (*
func)(int,
char **,
void *);
221 Command(
char opt_,
char* lopt_,
int (*func_)(
int,
char **),
char *emsg_,
char*umsg_){
244 void set_name(
const char *c)
249 void set_version(
const char *c)
254 void set_author(
const char *c){
258 void set_description(
const char *c){
277 name=
"Unnamed program";
285 void optional_arg (
char opt_,
char* lopt_,
void * parm_,
int (*func_)(
int,
char **,
void *),
char *emsg_,
char*umsg_)
287 args.push_back(
Argument(opt_, lopt_, parm_, func_, emsg_, umsg_) );
290 template <
class Type>
291 inline void optional_arg (
char opt_,
char* lopt_, Type &parm_,
char *emsg_,
char*umsg_)
293 args.push_back(
Argument(opt_, lopt_, parm_, emsg_, umsg_) );
296 template <
class Type>
297 void positional_arg (
char opt_,
char* lopt_, Type &parm_,
char *emsg_,
char*umsg_)
299 args.push_back(
Argument(opt_, lopt_, parm_, emsg_, umsg_) );
303 template <
class Type>
304 void positional_arg (Type &parm_,
char *emsg_,
char*umsg_)
315 void required_arg (
char opt_,
char* lopt_,
void * parm_,
int (*func_)(
int,
char **,
void *),
char *emsg_,
char*umsg_)
317 args.push_back(
Argument(opt_, lopt_, parm_, func_, emsg_, umsg_) );
318 args.back().required=
true;
323 template <
class Type>
324 void required_arg (
char opt_,
char* lopt_, Type &parm_,
char *emsg_,
char*umsg_)
326 args.push_back(
Argument(opt_, lopt_, parm_, emsg_, umsg_) );
327 args.back().required=
true;
339 void command (
char opt_,
char* lopt_,
int (*func_)(
int,
char **),
char *emsg_,
char*umsg_)
348 void flag (
char opt_,
char* lopt_,
void * parm_,
int (*func_)(
void *),
char *emsg_,
char*umsg_)
350 flags.push_back(
Flag(opt_, lopt_, parm_, func_, emsg_, umsg_) );
362 if(!(*rarg)->set) {std::cerr << (*rarg)->emsg << std::endl;
return false;}
367 void set_footer(
const char *);
376 int parsargs(
int argc,
char *argv[],
Environment &env);
A command line argument. See the interface tutorial for a demonstration of usage. ...
Definition: interface.h:139
std::list< Command > commands
A list of sub-commands that can be called from the command line.
Definition: interface.h:269
std::list< Argument > args
A list of options that can be passed from the command line.
Definition: interface.h:268
void optional_arg(char opt_, char *lopt_, void *parm_, int(*func_)(int, char **, void *), char *emsg_, char *umsg_)
adds an optional argument to the list of arguments accepted by the program.
Definition: interface.h:284
bool required
flag toggles whether option is required.
Definition: interface.h:194
int(* func)(int, char **, void *)
the function to set the parameters.
Definition: interface.h:198
char * lopt
the long option name.
Definition: interface.h:196
A class that passes command line flags. It takes no arguments and chews only a single letter...
Definition: interface.h:106
char * emsg
A short error message to display when the proper parameters aren't passed to this option...
Definition: interface.h:131
const char * author
author(s)
Definition: interface.h:263
int(* func)(void *)
the function to set the parameters.
Definition: interface.h:130
std::list< Argument * > required_args
A list of options, all of which must be set.
Definition: interface.h:271
char * umsg
A short description of this command to be displayed in the usage and help message.
Definition: interface.h:233
bool set
flag toggles whether option has been set
Definition: interface.h:227
void command(char opt_, char *lopt_, int(*func_)(int, char **), char *emsg_, char *umsg_)
adds a function to be executed that can accept argc and argv [] arguments.
Definition: interface.h:338
int(* func)(int, char **)
the function to set the parameters
Definition: interface.h:231
char opt
the option name.
Definition: interface.h:195
char * umsg
Definition: interface.h:200
void * parm
pointer to the parameter to be set.
Definition: interface.h:129
char opt
the option name
Definition: interface.h:229
const char * version
the version
Definition: interface.h:262
const char * description
a brief description of the command being executed
Definition: interface.h:264
void required_arg(char opt_, char *lopt_, void *parm_, int(*func_)(int, char **, void *), char *emsg_, char *umsg_)
adds an required argument to the list of arguments accepted by the program.
Definition: interface.h:314
void flag(char opt_, char *lopt_, void *parm_, int(*func_)(void *), char *emsg_, char *umsg_)
adds a flag to the list of flags that can be accepted by the environment.
Definition: interface.h:347
std::list< Command * > required_coms
A list of sub-commands, one of which must be run.
Definition: interface.h:273
void * parm
pointer to the parameter to be set.
Definition: interface.h:197
bool set
flag toggles whether option has been set.
Definition: interface.h:124
const char * footer_
The ending text of the help menu.
Definition: interface.h:265
A sub-command of mapgd.
Definition: interface.h:209
bool set
flag toggles whether option has been set.
Definition: interface.h:193
char * emsg
A short error message to display when the proper parameters aren't passed to this option...
Definition: interface.h:232
const char * name
the name of the command
Definition: interface.h:259
A class for handling options and automatically formating –help, -h, -u and -v.
Definition: interface.h:240
char opt
the option name.
Definition: interface.h:127
std::list< Argument * > positional_args
A list of options that are called in order.
Definition: interface.h:272
char * lopt
the long option name.
Definition: interface.h:128
char * operand_type
A short description of this option to be displayed in the usage message.
Definition: interface.h:202
char * umsg
A short description of this option to be displayed in the usage message.
Definition: interface.h:132
char * lopt
the long option name
Definition: interface.h:230
bool required_set(void)
Checks to see if all required arguments are set.
Definition: interface.h:356
std::list< Flag > flags
A list of flags that can be set.
Definition: interface.h:267
char * emsg
A short error message to display when the proper parameters aren't passed to this option...
Definition: interface.h:199