24 os <<
" id=\"" << Escape(
name()) <<
'"';
28 for (
const auto &[key, value] : _attributes) {
29 os <<
' ' << key <<
"=\"" << Escape(value) <<
'"';
39 for (
const auto &child :
children()) {
42 os <<
"</" <<
tag() <<
'>';
52 if (
const auto p = child.insert(path,
tag)) {
57 auto &node =
children().emplace_back(path.size() > 1 ?
"namespace" :
tag, path.front());
59 auto p = node.insert_inplace(path,
tag);
69 if (path.empty() || path.front() !=
name()) {
std::vector< std::pair< std::string, std::string > > & attributes()
Gets attributes of node.
std::string & name()
Gets a name of node.
Node * insert_inplace(std::deque< std::string > &path, const std::string &tag)
Inserts new node in-place at given path (first element of path is not id of this node)
Node * insert(std::deque< std::string > &path, const std::string &tag)
Inserts new node at given path (first element of path is id of this node)
std::string & tag()
Gets a tag of node.
void print(llvm::raw_ostream &os) const
Serialize subtree as XML to stream.
std::vector< Node > & children()
Gets children of node.
Node(std::string tag, std::string name)
Creates new node.