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
21
void
xml_interfacet::get_xml_options
(
cmdlinet
&cmdline)
22
{
23
if
(cmdline.
isset
(
"xml-interface"
))
24
{
25
null_message_handlert
message_handler;
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
37
void
xml_interfacet::get_xml_options
(
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
}
cmdlinet::args
argst args
Definition:
cmdline.h:44
xmlt::elements
elementst elements
Definition:
xml.h:33
cmdlinet::isset
virtual bool isset(char option) const
Definition:
cmdline.cpp:27
cmdlinet::set
virtual void set(const std::string &option)
Definition:
cmdline.cpp:60
xml
xmlt xml(const source_locationt &location)
Definition:
xml_expr.cpp:26
cmdlinet
Definition:
cmdline.h:19
xmlt::name
std::string name
Definition:
xml.h:30
parse_xml
bool parse_xml(std::istream &in, const std::string &filename, message_handlert &message_handler, xmlt &dest)
Definition:
xml_parser.cpp:18
xmlt
Definition:
xml.h:18
null_message_handlert
Definition:
message.h:71
xmlt::get_attribute
std::string get_attribute(const std::string &attribute) const
Definition:
xml.h:54
xml_interfacet::get_xml_options
void get_xml_options(cmdlinet &cmdline)
XML User Interface.
Definition:
xml_interface.cpp:21
xml_interface.h
message.h
xml_parser.h
cbmc
xml_interface.cpp
Generated by
1.8.17