47 if(attribute.first.empty())
49 out <<
' ' << attribute.first
70 element.output(out, indent+2);
75 out <<
'<' <<
'/' <<
name <<
'>' <<
"\n";
81 for(
const auto ch : s)
106 out <<
"&#" << std::to_string((
unsigned char)ch) <<
';';
111 static_cast<unsigned char>(ch) >= 32u,
112 "XML does not support escaping non-printable character " +
113 std::to_string((
unsigned char)ch));
123 for(
const auto ch : s)
147 out <<
"&#" << std::to_string((
unsigned char)ch) <<
';';
152 static_cast<unsigned char>(ch) >= 32u,
153 "XML does not support escaping non-printable character " +
154 std::to_string((
unsigned char)ch));
162 for(
const auto ch : s)
164 if(ch < 0x20 && ch != 0x9 && ch != 0xA && ch != 0xD)
173 out << std::string(indent,
' ');
176xmlt::elementst::const_iterator
xmlt::find(
const std::string &key)
const
178 for(elementst::const_iterator it=
elements.begin();
189 for(elementst::iterator it=
elements.begin();
199 const std::string &attribute,
206 const std::string &attribute,
213 const std::string &attribute,
214 unsigned long long value)
220 const std::string &attribute,
221 const std::string &value)
223 if((value[0]==
'\"' && value[value.size()-1]==
'\"') ||
224 (value[0]==
'\'' && value[value.size()-1]==
'\''))
226 attributes[attribute]=value.substr(1, value.size()-2);
241 result.reserve(str.size());
243 for(std::string::const_iterator it=str.begin();
252 while(it!=str.end() && *it!=
';')
261 else if(tmp[0]==
'#' && tmp[1]!=
'x')
287 const labelt &label = entry.first;
292 output_data.
data =
data.leaf_data();
296 const auto &children =
data.children();
Thrown when failing to deserialize a value from some low level format, like JSON or raw bytes.
A way of representing nested key/value data.
static std::string unescape(const std::string &s)
takes a string and unescapes any xml style escaped symbols
void set_attribute(const std::string &attribute, unsigned value)
static bool is_printable_xml(const std::string &s)
Determine whether s does not contain any characters that cannot be escaped in XML 1....
elementst::const_iterator find(const std::string &key) const
void output(std::ostream &out, unsigned indent=0) const
static void escape(const std::string &s, std::ostream &out)
escaping for XML elements
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
static void do_indent(std::ostream &out, unsigned indent)
xmlt xml(const irep_idt &property_id, const property_infot &property_info)
ranget< iteratort > make_range(iteratort begin, iteratort end)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
int unsafe_string2int(const std::string &str, int base)
std::string kebab_case() const
xmlt to_xml(const structured_datat &data)
Convert the structured_datat into an xml object.
bool operator==(const xmlt &a, const xmlt &b)
bool operator!=(const xmlt &a, const xmlt &b)
xmlt xml_node(const std::pair< labelt, structured_data_entryt > &entry)