CBMC
|
An implementation of cmdlinet to be used in tests. More...
#include <free_form_cmdline.h>
Public Member Functions | |
void | add_flag (std::string flag) |
Equivalent to specifying –flag for the command line. More... | |
void | add_option (std::string flag, std::string value) |
Equivalent to specifying –flag value. More... | |
Public Member Functions inherited from cmdlinet | |
virtual bool | parse (int argc, const char **argv, const char *optstring) |
Parses a commandline according to a specification given in optstring . More... | |
std::string | get_value (char option) const |
std::string | get_value (const char *option) const |
std::optional< std::string > | value_opt (char option) const |
std::optional< std::string > | value_opt (const char *option) const |
const std::list< std::string > & | get_values (const std::string &option) const |
const std::list< std::string > & | get_values (char option) const |
std::list< std::string > | get_comma_separated_values (const char *option) const |
Collect all occurrences of option option and split their values on each comma, merging them into a single list of values. More... | |
virtual bool | isset (char option) const |
virtual bool | isset (const char *option) const |
virtual void | set (const std::string &option, bool value=true) |
Set option option to value , or true if the value is omitted. More... | |
virtual void | set (const std::string &option, const std::string &value) |
virtual void | set (const std::string &option, const char *value) |
virtual void | clear () |
bool | has_option (const std::string &option) const |
option_namest | option_names () const |
Pseudo-object that can be used to iterate over options in this cmdlinet (should not outlive this) More... | |
cmdlinet () | |
virtual | ~cmdlinet () |
std::vector< std::string > | get_argument_suggestions (const std::string &unknown_argument) |
Private Member Functions | |
void | create_flag (const std::string &flag_name) |
Create a command line option that can be set. More... | |
Additional Inherited Members | |
Public Types inherited from cmdlinet | |
typedef std::vector< std::string > | argst |
Public Attributes inherited from cmdlinet | |
argst | args |
std::string | unknown_arg |
Protected Member Functions inherited from cmdlinet | |
void | parse_optstring (const char *optstring) |
Parses an optstring and writes the result to cmdlinet::options. More... | |
bool | parse_arguments (int argc, const char **argv) |
Parses a commandline according to a previously parsed optstring and writes the result to cmdlinet::options. More... | |
std::optional< std::size_t > | getoptnr (char option) const |
std::optional< std::size_t > | getoptnr (const std::string &option) const |
Protected Attributes inherited from cmdlinet | |
std::vector< optiont > | options |
An implementation of cmdlinet to be used in tests.
It does not require specifying exactly what flags are supported and instead allows setting any flag
Definition at line 17 of file free_form_cmdline.h.
void free_form_cmdlinet::add_flag | ( | std::string | flag | ) |
Equivalent to specifying –flag for the command line.
flag | The name of the flag to specify |
Definition at line 22 of file free_form_cmdline.cpp.
void free_form_cmdlinet::add_option | ( | std::string | flag, |
std::string | value | ||
) |
Equivalent to specifying –flag value.
flag | The name of the flag to specify |
value | The value to the set the command line option to |
Definition at line 31 of file free_form_cmdline.cpp.
|
private |
Create a command line option that can be set.
flag_name | The name of the command line option to support |
Definition at line 13 of file free_form_cmdline.cpp.