25 include_comments(_include_comments)
57 const std::string &sub_tree_id,
61 if(!sub_trees.empty())
64 for(
const irept &sub_tree : sub_trees)
69 parent[sub_tree_id]=sub_objects;
81 const std::string &sub_tree_id,
85 if(!sub_trees.empty())
88 for(
const auto &sub_tree : sub_trees)
91 sub_objects[
id2string(sub_tree.first)]=sub_object;
93 parent[sub_tree_id]=sub_objects;
102 std::vector<std::string> have_keys;
103 for(
const auto &keyval : in.
object)
104 have_keys.push_back(keyval.first);
105 std::sort(have_keys.begin(), have_keys.end());
106 if(have_keys!=std::vector<std::string>{
"comment",
"id",
"namedSub",
"sub"})
109 "irep JSON representation is missing one of needed keys: " 110 "'id', 'sub', 'namedSub', 'comment'");
113 irept out(in[
"id"].value);
115 for(
const auto &sub : in[
"sub"].array)
118 for(
const auto &named_sub : in[
"namedSub"].
object)
121 for(
const auto &
comment : in[
"comment"].
object)
Thrown when failing to deserialize a value from some low level format, like JSON or raw bytes...
const std::string & id2string(const irep_idt &d)
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_objectt convert_from_irep(const irept &) const
To convert to JSON from an irep structure by recursively generating JSON for the different sub trees...
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.
irept & add(const irep_namet &name)
const std::string & id_string() const
irept convert_from_json(const jsont &) const
Deserialize a JSON irep representation.