10 #ifndef CPROVER_UTIL_CMDLINE_H
11 #define CPROVER_UTIL_CMDLINE_H
74 virtual bool parse(
int argc,
const char **argv,
const char *optstring);
77 std::string
get_value(
const char *option)
const;
79 std::optional<std::string>
value_opt(
char option)
const;
80 std::optional<std::string>
value_opt(
const char *option)
const;
82 const std::list<std::string> &
get_values(
const std::string &option)
const;
83 const std::list<std::string> &
get_values(
char option)
const;
89 virtual bool isset(
char option)
const;
90 virtual bool isset(
const char *option)
const;
92 virtual void set(
const std::string &option,
bool value =
true);
93 virtual void set(
const std::string &option,
const std::string &value);
94 virtual void set(
const std::string &option,
const char *value)
96 set(option, std::string{value});
103 return getoptnr(option).has_value();
138 std::size_t
index = std::numeric_limits<std::size_t>::max();
153 typedef std::vector<std::string>
argst;
160 std::vector<std::string>
195 std::optional<std::size_t>
getoptnr(
char option)
const;
196 std::optional<std::size_t>
getoptnr(
const std::string &option)
const;
std::string get_value(char option) const
virtual void set(const std::string &option, const char *value)
virtual bool isset(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 si...
std::optional< std::size_t > getoptnr(char option) const
bool has_option(const std::string &option) const
std::optional< std::string > value_opt(char option) const
bool parse_arguments(int argc, const char **argv)
Parses a commandline according to a previously parsed optstring and writes the result to cmdlinet::op...
std::vector< optiont > options
virtual void set(const std::string &option, bool value=true)
Set option option to value, or true if the value is omitted.
virtual bool parse(int argc, const char **argv, const char *optstring)
Parses a commandline according to a specification given in optstring.
std::vector< std::string > get_argument_suggestions(const std::string &unknown_argument)
void parse_optstring(const char *optstring)
Parses an optstring and writes the result to cmdlinet::options.
option_namest option_names() const
Pseudo-object that can be used to iterate over options in this cmdlinet (should not outlive this)
std::vector< std::string > argst
const std::list< std::string > & get_values(const std::string &option) const
const std::string & reference
const std::string * pointer
bool is_valid_index() const
option_names_iteratort(option_names_iteratort &&other)=default
std::ptrdiff_t difference_type
option_names_iteratort & operator=(option_names_iteratort &&)=default
option_names_iteratort & operator=(const option_names_iteratort &)=default
const std::string & operator*()
const cmdlinet * command_line
bool operator==(const option_names_iteratort &other)
void goto_next_valid_index()
option_names_iteratort(const option_names_iteratort &other)=default
std::forward_iterator_tag iterator_category
bool operator!=(const option_names_iteratort &other)
option_names_iteratort()=default
option_names_iteratort & operator++()
option_names_iteratort end()
option_names_iteratort begin()
option_namest(const cmdlinet &command_line)
const cmdlinet & command_line
std::list< std::string > values