24 include_comments(include_comments)
52 const std::string &sub_tree_id,
56 if(!sub_trees.empty())
59 for(
const irept &sub_tree : sub_trees)
65 parent[sub_tree_id]=sub_objects;
77 const std::string &sub_tree_id,
81 if(!sub_trees.empty())
84 for(
const auto &sub_tree : sub_trees)
88 sub_objects[
id2string(sub_tree.first)]=sub_object;
90 parent[sub_tree_id]=sub_objects;
99 std::vector<std::string> have_keys;
100 for(
const auto &keyval : in.
object)
101 have_keys.push_back(keyval.first);
102 std::sort(have_keys.begin(), have_keys.end());
103 if(have_keys!=std::vector<std::string>{
"comment",
"id",
"namedSub",
"sub"})
104 throw "irep JSON representation is missing one of needed keys: " 105 "'id', 'sub', 'namedSub', 'comment'";
107 out.
id(in[
"id"].value);
109 for(
const auto &sub : in[
"sub"].array)
115 for(
const auto &named_sub : in[
"namedSub"].
object)
118 for(
const auto &
comment : in[
"comment"].
object)
const std::string & id2string(const irep_idt &d)
void convert_from_irep(const irept &irep, jsont &json) const
To convert to JSON from an irep structure by recursively generating JSON for the different sub trees...
std::vector< irept > subt
std::string comment(const rw_set_baset::entryt &entry, bool write)
jsont & push_back(const jsont &json)
const irep_idt & id() const
void convert_named_sub_tree(const std::string &sub_tree_id, const irept::named_subt &sub_trees, json_objectt &parent) const
To convert to JSON from a map of ireps that are in a named subtree.
named_subt & get_comments()
Base class for tree-like data structures with sharing.
std::map< irep_namet, irept > named_subt
named_subt & get_named_sub()
json_irept(bool include_comments)
To convert to JSON from an irep structure by recursively generating JSON for the different sub trees...
void convert_sub_tree(const std::string &sub_tree_id, const irept::subt &sub_trees, json_objectt &parent) const
To convert to JSON from a list of ireps that are in an unlabelled subtree.
void convert_from_json(const jsont &, irept &) const
Deserialize a JSON irep representation.
irept & add(const irep_namet &name)
const std::string & id_string() const
json_objectt & make_object()
json_objectt json(const source_locationt &location)