cprover
xml_interface.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: XML Interface
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #include "xml_interface.h"
13 
14 #include <iostream>
15 
16 #include <util/message.h>
17 
18 #include <xmllang/xml_parser.h>
19 
22 {
23  if(cmdline.isset("xml-interface"))
24  {
26  xmlt xml;
27 
28  parse_xml(std::cin, "", message_handler, xml);
29 
30  get_xml_options(xml, cmdline);
31 
32  cmdline.set("xml-ui");
33  }
34 }
35 
38  const xmlt &xml,
39  cmdlinet &cmdline)
40 {
41  for(const auto &e : xml.elements)
42  {
43  // recursive call
44  get_xml_options(e, cmdline);
45  }
46 
47  if(xml.name=="valueOption")
48  {
49  std::string name=xml.get_attribute("name");
50  std::string value=xml.get_attribute("actual");
51 
52  if(name=="")
53  cmdline.args.push_back(value);
54  else
55  cmdline.set(name, value);
56  }
57  else if(xml.name=="flagOption")
58  {
59  if(xml.get_attribute("actual")=="on")
60  {
61  cmdline.set(xml.get_attribute("name"));
62  }
63  }
64 }
std::string name
Definition: xml.h:30
xmlt xml(const source_locationt &location)
Definition: xml_expr.cpp:25
std::string get_attribute(const std::string &attribute) const
Definition: xml.h:54
elementst elements
Definition: xml.h:33
argst args
Definition: cmdline.h:37
virtual bool isset(char option) const
Definition: cmdline.cpp:27
virtual void set(const std::string &option)
Definition: cmdline.cpp:60
void get_xml_options(cmdlinet &cmdline)
XML User Interface.
Definition: xml.h:18
bool parse_xml(std::istream &in, const std::string &filename, message_handlert &message_handler, xmlt &dest)
Definition: xml_parser.cpp:18
goto_programt coverage_criteriont message_handlert & message_handler
Definition: cover.cpp:66
XML Interface.