22 # include <vcl_msvc_warnings.h> 24 #include <vul/vul_export.h> 25 #include <vxl_config.h> 44 bool warn_about_unrecognized_arguments =
true);
62 virtual std::ostream&
print_value(std::ostream&) = 0;
80 char const*helpstring,
bool required=
false);
81 vul_arg_base(
char const* option_string,
char const*helpstring,
bool required=
false);
84 virtual int parse(
char ** argv) = 0;
121 bool warn_about_unrecognized_arguments =
true);
149 char const* helpstring =
nullptr,
150 T default_value = T()
157 char const * option_string =
nullptr,
158 char const * helpstring =
nullptr,
159 T default_value = T() )
177 char const* helpstring,
184 char const * option_string,
185 char const * helpstring,
223 void parse(
int& argc,
char **& argv,
bool warn_about_unrecognized_arguments);
void settype(vul_arg< T > &)
vul_arg(char const *option_string, char const *helpstring, required_option_type)
Dummy parameter to be passed during construction. It sets a flag as required.
static void set_help_precis(char const *str)
void set_help_description(char const *str)
Set the (possibly long) text used to document the command.
int parse(vul_arg< T > *, char **)
void print_value(std::ostream &, vul_arg< T > const &)
vul_arg_base(vul_arg_info_list &l, char const *option_string, char const *helpstring, bool required=false)
std::vector< vul_arg_base * > args_
void vul_arg_parse(int &argc, char **&argv, bool warn_about_unrecognized_arguments=true)
parse command-line arguments.
static void display_usage(char const *msg=nullptr)
static void parse_deprecated(int &argc, char **&argv, bool warn_about_unrecognized_arguments=true)
The main static method.
void add(vul_arg_base *arg)
Add an argument to the list.
bool required_
if true, this flag must be set on command line.
void include(vul_arg_info_list &l)
Append another list. The other list is not copied, just pointed to.
void vul_arg_display_usage_and_exit(char const *msg=nullptr)
Print all args, and usage messages.
void vul_arg_include(vul_arg_info_list &l)
Add an externally supplied list of args to the global list.
T & operator()()
return the arg's current value, whether the default or the one from the command line.
char const * type_
Static text describing type of option (e.g. bool or double).
vul_arg_info_list(vul_arg_info_list const &)
static void display_usage_and_exit(char const *msg=nullptr)
vul_arg(char const *option_string=nullptr, char const *helpstring=nullptr, T default_value=T())
Construct a vul_arg<T> with command-line switch and default value.
virtual int parse(char **argv)=0
vul_arg(vul_arg_info_list &l, char const *option_string, char const *helpstring, required_option_type)
As above, but add the arg to the list l, on which parse() can be called later.
static void set_help_option(char const *str)
This is the base class for the templated vul_arg<T>s.
a helper for vul_arg::parse.
std::string help_
Description of argument.
static void add_to_current(vul_arg_base *a)
~vul_arg_info_list()=default
void set_help_option(char const *str)
Change the help operator (defaults to -?).
int parse(char **argv) override
returns number of args chomped, or -1 on failure.
std::ostream & print_value(std::ostream &s) override
print.
std::string option_
Option flag including "-" or "--".
virtual ~vul_arg_base()=default
void set_help_precis(char const *str)
Set the (short) text used to describe the command.
vul_arg_info_list & operator=(vul_arg_info_list const &)
std::string command_precis_
static void set_help_description(char const *str)
void parse(int &argc, char **&argv, bool warn_about_unrecognized_arguments)
Parse the command line, using the current list of args.
void display_help(char const *progname=nullptr)
Display help about each option in the arg list.
static void include_deprecated(vul_arg_info_list &l)
Add another vul_arg_info_list to the current one.
vul_arg(vul_arg_info_list &l, char const *option_string=nullptr, char const *helpstring=nullptr, T default_value=T())
As above, but add the arg to the list l, on which parse() can be called later.
bool set() const
Returns true if arg was set on the command line.
bool set_
After parsing, true iff value was set on command line.
parse command-line arguments.
static VUL_EXPORT required_option_type is_required
virtual std::ostream & print_value(std::ostream &)=0
vul_arg_info_list(autonomy autonomy__=subset)
Construct an empty vul_arg_info_list.