Go to the documentation of this file.
47 if(attribute.first.empty())
49 out <<
' ' << attribute.first
69 for(const auto &element : elements)
70 element.output(out, indent+2);
72 do_indent(out, indent);
75 out << '<
' << '/
' << name << '>
' << "\n";
79 void xmlt::escape(const std::string &s, std::ostream &out)
81 for(const auto ch : s)
105 // � isn't allowed, but what shall we
do?
106 if((ch>=0 && ch<
' ') || ch==127)
118 for(
const auto ch : s)
140 if((ch>=0 && ch<
' ') || ch==127)
150 out << std::string(indent,
' ');
153 xmlt::elementst::const_iterator
xmlt::find(
const std::string &key)
const
155 for(elementst::const_iterator it=
elements.begin();
166 for(elementst::iterator it=
elements.begin();
176 const std::string &attribute,
183 const std::string &attribute,
190 const std::string &attribute,
191 unsigned long long value)
197 const std::string &attribute,
198 const std::string &value)
200 if((value[0]==
'\"' && value[value.size()-1]==
'\"') ||
201 (value[0]==
'\'' && value[value.size()-1]==
'\''))
203 attributes[attribute]=value.substr(1, value.size()-2);
218 result.reserve(str.size());
220 for(std::string::const_iterator it=str.begin();
229 while(it!=str.end() && *it!=
';')
238 else if(tmp[0]==
'#' && tmp[1]!=
'x')
264 const labelt &label = entry.first;
269 output_data.data =
data.leaf_data();
273 const auto &children =
data.children();
274 output_data.elements =
Thrown when failing to deserialize a value from some low level format, like JSON or raw bytes.
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
xmlt to_xml(const structured_datat &data)
Convert the structured_datat into an xml object.
xmlt xml_node(const std::pair< labelt, structured_data_entryt > &entry)
void output(std::ostream &out, unsigned indent=0) const
bool operator==(const xmlt &a, const xmlt &b)
xmlt xml(const irep_idt &property_id, const property_infot &property_info)
#define PRECONDITION(CONDITION)
static void do_indent(std::ostream &out, unsigned indent)
static void escape_attribute(const std::string &s, std::ostream &out)
escaping for XML attributes, assuming that double quotes " are used consistently, not single quotes
A way of representing nested key/value data.
elementst::const_iterator find(const std::string &key) const
void set_attribute(const std::string &attribute, unsigned value)
bool operator!=(const xmlt &a, const xmlt &b)
std::string kebab_case() const
static std::string unescape(const std::string &s)
takes a string and unescapes any xml style escaped symbols
ranget< iteratort > make_range(iteratort begin, iteratort end)
int unsafe_string2int(const std::string &str, int base)