File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ Author: Daniel Kroening, Peter Schrammel
1212#include " properties.h"
1313
1414#include < util/invariant.h>
15+ #include < util/json.h>
16+ #include < util/xml.h>
1517
1618std::string as_string (resultt result)
1719{
@@ -89,6 +91,31 @@ propertiest initialize_properties(const abstract_goto_modelt &goto_model)
8991 return properties;
9092}
9193
94+ std::string
95+ as_string (const irep_idt &property_id, const property_infot &property_info)
96+ {
97+ return " [" + id2string (property_id) + " ] " + property_info.description +
98+ " : " + as_string (property_info.status );
99+ }
100+
101+ xmlt xml (const irep_idt &property_id, const property_infot &property_info)
102+ {
103+ xmlt xml_result (" result" );
104+ xml_result.set_attribute (" property" , id2string (property_id));
105+ xml_result.set_attribute (" status" , as_string (property_info.status ));
106+ return xml_result;
107+ }
108+
109+ json_objectt
110+ json (const irep_idt &property_id, const property_infot &property_info)
111+ {
112+ json_objectt result;
113+ result[" property" ] = json_stringt (property_id);
114+ result[" description" ] = json_stringt (property_info.description );
115+ result[" status" ] = json_stringt (as_string (property_info.status ));
116+ return result;
117+ }
118+
92119std::size_t
93120count_properties (const propertiest &properties, property_statust status)
94121{
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ Author: Daniel Kroening, Peter Schrammel
1616
1717#include < goto-programs/goto_model.h>
1818
19+ class json_objectt ;
20+ class xmlt ;
21+
1922// / The status of a property
2023enum class property_statust
2124{
@@ -73,6 +76,14 @@ typedef std::unordered_map<irep_idt, property_infot> propertiest;
7376// / Returns the properties in the goto model
7477propertiest initialize_properties (const abstract_goto_modelt &);
7578
79+ std::string
80+ as_string (const irep_idt &property_id, const property_infot &property_info);
81+
82+ xmlt xml (const irep_idt &property_id, const property_infot &property_info);
83+
84+ json_objectt
85+ json (const irep_idt &property_id, const property_infot &property_info);
86+
7687// / Return the number of properties with given \p status
7788std::size_t
7889count_properties (const propertiest &, property_statust);
You can’t perform that action at this time.
0 commit comments