mapgd  0.4
A program for the Maximum-likelihood analysis of population genomic data.
 All Data Structures Functions Variables Friends Groups Pages
Public Member Functions | Data Fields
Environment Class Reference

A class for handling options and automatically formating –help, -h, -u and -v. More...

#include <interface.h>

Public Member Functions

void set_name (const char *c)
 
void set_version (const char *c)
 
void set_author (const char *c)
 
void set_description (const char *c)
 
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.
 
template<class Type >
void optional_arg (char opt_, char *lopt_, Type &parm_, char *emsg_, char *umsg_)
 
template<class Type >
void positional_arg (char opt_, char *lopt_, Type &parm_, char *emsg_, char *umsg_)
 
template<class Type >
void positional_arg (Type &parm_, char *emsg_, char *umsg_)
 
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. More...
 
template<class Type >
void required_arg (char opt_, char *lopt_, Type &parm_, char *emsg_, char *umsg_)
 
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. More...
 
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. More...
 
bool required_set (void)
 Checks to see if all required arguments are set. More...
 
void set_footer (const char *)
 
void close (void)
 

Data Fields

const char * name
 the name of the command
 
const char * version
 the version
 
const char * author
 author(s)
 
const char * description
 a brief description of the command being executed
 
const char * footer_
 The ending text of the help menu.
 
std::list< Flagflags
 A list of flags that can be set.
 
std::list< Argumentargs
 A list of options that can be passed from the command line.
 
std::list< Commandcommands
 A list of sub-commands that can be called from the command line.
 
std::list< Argument * > required_args
 A list of options, all of which must be set.
 
std::list< Argument * > positional_args
 A list of options that are called in order.
 
std::list< Command * > required_coms
 A list of sub-commands, one of which must be run.
 

Detailed Description

A class for handling options and automatically formating –help, -h, -u and -v.

Member Function Documentation

void Environment::command ( char  opt_,
char *  lopt_,
int(*)(int, char **)  func_,
char *  emsg_,
char *  umsg_ 
)
inline

adds a function to be executed that can accept argc and argv [] arguments.

If a command is set, then an error is raised if no command is provided. Commands execute in order in which they are passed by the user. Commands only return an exit status, so no further processing of the argc and argv variables can be done by the environment in which a command is called.

void Environment::flag ( char  opt_,
char *  lopt_,
void *  parm_,
int(*)(void *)  func_,
char *  emsg_,
char *  umsg_ 
)
inline

adds a flag to the list of flags that can be accepted by the environment.

Flags can be passed either separately, or in a concatenated list if their short form is used.

void Environment::required_arg ( char  opt_,
char *  lopt_,
void *  parm_,
int(*)(int, char **, void *)  func_,
char *  emsg_,
char *  umsg_ 
)
inline

adds an required argument to the list of arguments accepted by the program.

-1 is returned by parsargs when required arguments are not provided.

bool Environment::required_set ( void  )
inline

Checks to see if all required arguments are set.

Returns 1 if all required arguments are set, 0 if they are not.


The documentation for this class was generated from the following files: