19 return !component.empty() &&
20 std::none_of(component.begin(), component.end(), ::isupper);
26 std::ostringstream output;
35 std::ostringstream output;
42 std::ostringstream output;
49 std::ostringstream output;
78 : data(std::move(data))
83 std::map<labelt, structured_data_entryt> children)
84 : _children(std::move(children))
97 const std::map<labelt, structured_data_entryt> &
109 std::map<labelt, structured_data_entryt> data)
110 : _data(std::move(data))
114 std::vector<std::string>
115 pretty_node(
const std::pair<labelt, structured_data_entryt> &entry)
117 const labelt &label = entry.first;
121 std::ostringstream line;
127 const auto indent = [](
const std::string &line) {
return "\t" + line; };
129 const auto &children = data.
children();
130 std::vector<std::vector<std::string>> lines =
133 .map([&](std::vector<std::string> sub_lines) {
136 .collect<std::vector<std::string>>();
138 .collect<std::vector<std::vector<std::string>>>();
140 std::vector<std::string> result;
141 for(
const auto &sub_lines : lines)
143 result.insert(result.end(), sub_lines.begin(), sub_lines.end());
151 if(data.
data().empty())
154 std::vector<std::vector<std::string>> lines =
157 .collect<std::vector<std::vector<std::string>>>();
158 std::vector<std::string> flattened_lines;
159 for(
const auto &line_section : lines)
161 flattened_lines.insert(
162 flattened_lines.end(), line_section.begin(), line_section.end());
164 std::ostringstream output;
165 join_strings(output, flattened_lines.begin(), flattened_lines.end(),
"\n");
A way of representing nested key/value data.
const std::map< labelt, structured_data_entryt > & data() const
structured_datat(std::map< labelt, structured_data_entryt > data)
std::map< labelt, structured_data_entryt > _data
Ranges: pair of begin and end iterators, which can be initialized from containers,...
ranget< iteratort > make_range(iteratort begin, iteratort end)
#define PRECONDITION(CONDITION)
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
std::string capitalize(const std::string &str)
Stream & join_strings(Stream &&os, const It b, const It e, const Delimiter &delimiter, TransformFunc &&transform_func)
Prints items to an stream, separated by a constant delimiter.
std::string camel_case() const
labelt(std::vector< std::string > components)
std::string kebab_case() const
std::vector< std::string > components
std::string snake_case() const
std::string pretty() const
bool operator<(const labelt &other) const
static structured_data_entryt data_node(const jsont &data)
std::string leaf_data() const
std::map< labelt, structured_data_entryt > _children
const std::map< labelt, structured_data_entryt > & children() const
jsont leaf_object() const
static structured_data_entryt entry(std::map< labelt, structured_data_entryt > children)
structured_data_entryt(jsont data)
std::vector< std::string > pretty_node(const std::pair< labelt, structured_data_entryt > &entry)
std::string to_pretty(const structured_datat &data)
Convert the structured_data into plain text.