CBMC
free_form_cmdlinet Class Reference

An implementation of cmdlinet to be used in tests. More...

#include <free_form_cmdline.h>

+ Inheritance diagram for free_form_cmdlinet:
+ Collaboration diagram for free_form_cmdlinet:

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< optiontoptions
 

Detailed Description

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.

Member Function Documentation

◆ add_flag()

void free_form_cmdlinet::add_flag ( std::string  flag)

Equivalent to specifying –flag for the command line.

Parameters
flagThe name of the flag to specify

Definition at line 22 of file free_form_cmdline.cpp.

◆ add_option()

void free_form_cmdlinet::add_option ( std::string  flag,
std::string  value 
)

Equivalent to specifying –flag value.

Parameters
flagThe name of the flag to specify
valueThe value to the set the command line option to

Definition at line 31 of file free_form_cmdline.cpp.

◆ create_flag()

void free_form_cmdlinet::create_flag ( const std::string &  flag_name)
private

Create a command line option that can be set.

Parameters
flag_nameThe name of the command line option to support

Definition at line 13 of file free_form_cmdline.cpp.


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