CBMC
Loading...
Searching...
No Matches
goto_cc_cmdline.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Command line interpretation for goto-cc
4
5Author: Daniel Kroening
6
7Date: April 2010
8
9\*******************************************************************/
10
13
14#ifndef CPROVER_GOTO_CC_GOTO_CC_CMDLINE_H
15#define CPROVER_GOTO_CC_GOTO_CC_CMDLINE_H
16
17#include <util/cmdline.h>
18
20{
21public:
23
24 using cmdlinet::parse;
25 virtual bool parse(int argc, const char **argv)=0;
26
27 static bool in_list(const char *option, const char **list);
28
29 // never fails, will add if not found
30 std::size_t get_optnr(const std::string &option);
31
33 void set(const std::string &opt, const char *value) override
34 {
35 set(opt, std::string{value});
36 }
37
38 void set(const std::string &opt, const std::string &value) override
39 {
40 std::size_t nr=get_optnr(opt);
41 options[nr].isset=true;
42 options[nr].values.push_back(value);
43 }
44
45 void set(const std::string &opt, bool value = true) override
46 {
47 options[get_optnr(opt)].isset = value;
48 }
49
50 // This lets you distinguish input file name arguments
51 // from others, but is otherwise identical to the
52 // original command line.
53
54 struct argt
55 {
56 public:
58 explicit argt(const std::string &_arg):is_infile_name(false), arg(_arg) { }
60 std::string arg;
61 };
62
63 typedef std::list<argt> parsed_argvt;
65
66 bool have_infile_arg() const;
67
68 std::string stdin_file;
69
70protected:
71 void add_arg(const std::string &arg)
72 {
73 parsed_argv.push_back(argt(arg));
74 }
75
76 void add_infile_arg(const std::string &arg);
77};
78
79#endif // CPROVER_GOTO_CC_GOTO_CC_CMDLINE_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
std::vector< optiont > options
Definition cmdline.h:193
virtual bool parse(int argc, const char **argv, const char *optstring)
Parses a commandline according to a specification given in optstring.
Definition cmdline.cpp:163
void set(const std::string &opt, const char *value) override
Set option option to value.
void set(const std::string &opt, const std::string &value) override
parsed_argvt parsed_argv
void add_infile_arg(const std::string &arg)
std::size_t get_optnr(const std::string &option)
std::string stdin_file
bool have_infile_arg() const
static bool in_list(const char *option, const char **list)
std::list< argt > parsed_argvt
virtual bool parse(int argc, const char **argv)=0
void set(const std::string &opt, bool value=true) override
Set option option to value, or true if the value is omitted.
void add_arg(const std::string &arg)
argt(const std::string &_arg)