CBMC
xmlt Class Reference

#include <xml.h>

+ Collaboration diagram for xmlt:

Public Types

typedef std::list< xmltelementst
 
typedef std::map< std::string, std::string > attributest
 

Public Member Functions

 xmlt ()
 
 xmlt (const std::string &_name)
 
 xmlt (std::string &&_name, attributest &&_attributes, elementst &&_elements)
 
elementst::const_iterator find (const std::string &key) const
 
elementst::iterator find (const std::string &key)
 
void set_attribute (const std::string &attribute, unsigned value)
 
void set_attribute (const std::string &attribute, unsigned long value)
 
void set_attribute (const std::string &attribute, unsigned long long value)
 
void set_attribute (const std::string &attribute, const std::string &value)
 
std::string get_attribute (const std::string &attribute) const
 
void set_attribute_bool (const std::string &attribute, bool value)
 
bool get_attribute_bool (const std::string &attribute) const
 
std::string get_element (const std::string &element) const
 
xmltnew_element (const std::string &key)
 
xmltnew_element (const xmlt &xml)
 
xmltnew_element ()
 
void swap (xmlt &xml)
 
void clear ()
 
void output (std::ostream &out, unsigned indent=0) const
 

Static Public Member Functions

static void escape (const std::string &s, std::ostream &out)
 escaping for XML elements More...
 
static std::string unescape (const std::string &s)
 takes a string and unescapes any xml style escaped symbols More...
 
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 More...
 
static bool is_printable_xml (const std::string &s)
 Determine whether s does not contain any characters that cannot be escaped in XML 1.0. More...
 

Public Attributes

std::string name
 
std::string data
 
attributest attributes
 
elementst elements
 

Static Protected Member Functions

static void do_indent (std::ostream &out, unsigned indent)
 

Detailed Description

Definition at line 20 of file xml.h.

Member Typedef Documentation

◆ attributest

typedef std::map<std::string, std::string> xmlt::attributest

Definition at line 30 of file xml.h.

◆ elementst

typedef std::list<xmlt> xmlt::elementst

Definition at line 29 of file xml.h.

Constructor & Destructor Documentation

◆ xmlt() [1/3]

xmlt::xmlt ( )
inline

Definition at line 23 of file xml.h.

◆ xmlt() [2/3]

xmlt::xmlt ( const std::string &  _name)
inlineexplicit

Definition at line 26 of file xml.h.

◆ xmlt() [3/3]

xmlt::xmlt ( std::string &&  _name,
attributest &&  _attributes,
elementst &&  _elements 
)
inline

Definition at line 32 of file xml.h.

Member Function Documentation

◆ clear()

void xmlt::clear ( void  )

Definition at line 17 of file xml.cpp.

◆ do_indent()

void xmlt::do_indent ( std::ostream &  out,
unsigned  indent 
)
staticprotected

Definition at line 171 of file xml.cpp.

◆ escape()

void xmlt::escape ( const std::string &  s,
std::ostream &  out 
)
static

escaping for XML elements

Definition at line 79 of file xml.cpp.

◆ escape_attribute()

void xmlt::escape_attribute ( const std::string &  s,
std::ostream &  out 
)
static

escaping for XML attributes, assuming that double quotes " are used consistently, not single quotes

Definition at line 121 of file xml.cpp.

◆ find() [1/2]

xmlt::elementst::iterator xmlt::find ( const std::string &  key)

Definition at line 187 of file xml.cpp.

◆ find() [2/2]

xmlt::elementst::const_iterator xmlt::find ( const std::string &  key) const

Definition at line 176 of file xml.cpp.

◆ get_attribute()

std::string xmlt::get_attribute ( const std::string &  attribute) const
inline

Definition at line 63 of file xml.h.

◆ get_attribute_bool()

bool xmlt::get_attribute_bool ( const std::string &  attribute) const
inline

Definition at line 79 of file xml.h.

◆ get_element()

std::string xmlt::get_element ( const std::string &  element) const
inline

Definition at line 87 of file xml.h.

◆ is_printable_xml()

bool xmlt::is_printable_xml ( const std::string &  s)
static

Determine whether s does not contain any characters that cannot be escaped in XML 1.0.

See https://www.w3.org/TR/xml/#charsets for details.

Parameters
sstring to verify
Returns
True if, and only if, all characters in s are taken from the charset permitted in XML 1.0.

Definition at line 160 of file xml.cpp.

◆ new_element() [1/3]

xmlt& xmlt::new_element ( )
inline

Definition at line 108 of file xml.h.

◆ new_element() [2/3]

xmlt& xmlt::new_element ( const std::string &  key)
inline

Definition at line 95 of file xml.h.

◆ new_element() [3/3]

xmlt& xmlt::new_element ( const xmlt xml)
inline

Definition at line 102 of file xml.h.

◆ output()

void xmlt::output ( std::ostream &  out,
unsigned  indent = 0 
) const

Definition at line 33 of file xml.cpp.

◆ set_attribute() [1/4]

void xmlt::set_attribute ( const std::string &  attribute,
const std::string &  value 
)

Definition at line 219 of file xml.cpp.

◆ set_attribute() [2/4]

void xmlt::set_attribute ( const std::string &  attribute,
unsigned long long  value 
)

Definition at line 212 of file xml.cpp.

◆ set_attribute() [3/4]

void xmlt::set_attribute ( const std::string &  attribute,
unsigned long  value 
)

Definition at line 205 of file xml.cpp.

◆ set_attribute() [4/4]

void xmlt::set_attribute ( const std::string &  attribute,
unsigned  value 
)

Definition at line 198 of file xml.cpp.

◆ set_attribute_bool()

void xmlt::set_attribute_bool ( const std::string &  attribute,
bool  value 
)
inline

Definition at line 72 of file xml.h.

◆ swap()

void xmlt::swap ( xmlt xml)

Definition at line 25 of file xml.cpp.

◆ unescape()

std::string xmlt::unescape ( const std::string &  str)
static

takes a string and unescapes any xml style escaped symbols

parameters: a string
Returns
the unescaped string

Definition at line 237 of file xml.cpp.

Member Data Documentation

◆ attributes

attributest xmlt::attributes

Definition at line 41 of file xml.h.

◆ data

std::string xmlt::data

Definition at line 39 of file xml.h.

◆ elements

elementst xmlt::elements

Definition at line 42 of file xml.h.

◆ name

std::string xmlt::name

Definition at line 39 of file xml.h.


The documentation for this class was generated from the following files: