LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::xml::Element Struct Reference

#include <line/util/xml.h>

Collaboration diagram for line::xml::Element:

Public Member Functions

std::string attr (const std::string &key) const
 Attribute value, or the empty string when absent (org.w3c.dom semantics).
bool has_attr (const std::string &key) const
std::vector< const Element * > by_tag (const std::string &tag) const
 Descendant-or-self search excluding self, in document order.
std::vector< const Element * > child_tags (const std::string &tag) const
 Direct children with the given tag, in document order.
Elementset_attr (const std::string &key, const std::string &value)
 setAttribute: replace the value in place when the key already exists, otherwise append.
Elementadd_child (const std::string &tag)
 createElement + appendChild in one step; the child is owned here.
Elementadd_text (const std::string &value)
 createTextNode + appendChild on an element with no child elements.
Elementadd_text_child (const std::string &tag, const std::string &value)
 The common shape <tag>value</tag>.

Public Attributes

std::string name
std::vector< std::pair< std::string, std::string > > attrs
std::vector< std::unique_ptr< Element > > children
const Elementparent = nullptr
std::string text
 Character data of a text-only element, as createTextNode supplies it.

Detailed Description

Definition at line 54 of file xml.h.

Member Function Documentation

◆ add_child()

Element & line::xml::Element::add_child ( const std::string & tag)
inline

createElement + appendChild in one step; the child is owned here.

Definition at line 107 of file xml.h.

References children.

Referenced by add_text_child(), line::io::jmt_append_distribution(), line::io::jmt_object_array(), line::io::jmt_param(), line::io::jmt_scalar(), and line::lqn::write_lqnx().

◆ add_text()

Element & line::xml::Element::add_text ( const std::string & value)
inline

createTextNode + appendChild on an element with no child elements.

Definition at line 116 of file xml.h.

References text.

Referenced by add_text_child().

◆ add_text_child()

Element & line::xml::Element::add_text_child ( const std::string & tag,
const std::string & value )
inline

The common shape <tag>value</tag>.

Definition at line 122 of file xml.h.

References add_child(), and add_text().

Referenced by line::io::jmt_param_value(), line::io::jmt_ref_class(), and line::io::jmt_scalar().

◆ attr()

std::string line::xml::Element::attr ( const std::string & key) const
inline

Attribute value, or the empty string when absent (org.w3c.dom semantics).

Definition at line 63 of file xml.h.

References attrs.

Referenced by line::jmt::jmt_parse_measures(), line::io::pnml_load(), and line::lqn::read_lqnx_model().

◆ by_tag()

std::vector< const Element * > line::xml::Element::by_tag ( const std::string & tag) const
inline

Descendant-or-self search excluding self, in document order.

Definition at line 76 of file xml.h.

Referenced by line::io::pnml_load(), and line::lqn::read_lqnx_model().

◆ child_tags()

std::vector< const Element * > line::xml::Element::child_tags ( const std::string & tag) const
inline

Direct children with the given tag, in document order.

Definition at line 83 of file xml.h.

References children.

Referenced by line::io::pnml_load(), and line::lqn::read_lqnx_model().

◆ has_attr()

bool line::xml::Element::has_attr ( const std::string & key) const
inline

Definition at line 69 of file xml.h.

References attrs.

Referenced by line::jmt::jmt_parse_measures().

◆ set_attr()

Element & line::xml::Element::set_attr ( const std::string & key,
const std::string & value )
inline

setAttribute: replace the value in place when the key already exists, otherwise append.

Replacing in place is what keeps attribute order stable across a writer that sets className twice – the JSIM writer sets the LINE section name first and overwrites it with the JMT one.

Definition at line 96 of file xml.h.

References attrs.

Referenced by line::io::jmt_append_distribution(), line::io::jmt_object_array(), line::io::jmt_param(), line::io::jmt_scalar(), and line::lqn::write_lqnx().

Member Data Documentation

◆ attrs

std::vector<std::pair<std::string, std::string> > line::xml::Element::attrs

Definition at line 56 of file xml.h.

Referenced by attr(), has_attr(), line::xml::parse(), and set_attr().

◆ children

std::vector<std::unique_ptr<Element> > line::xml::Element::children

Definition at line 57 of file xml.h.

Referenced by add_child(), and child_tags().

◆ name

std::string line::xml::Element::name

Definition at line 55 of file xml.h.

Referenced by line::xml::parse(), and line::lqn::write_lqnx().

◆ parent

const Element* line::xml::Element::parent = nullptr

Definition at line 58 of file xml.h.

Referenced by line::xml::parse().

◆ text

std::string line::xml::Element::text

Character data of a text-only element, as createTextNode supplies it.

Definition at line 60 of file xml.h.

Referenced by add_text().


The documentation for this struct was generated from the following file:
  • include/line/util/xml.h