GCC Middle and Back End API Reference
xml::printer Class Reference

#include <xml-printer.h>

Public Member Functions

 printer (element &insertion_point, bool check_popped_tags=true)
void push_tag (std::string name, bool preserve_whitespace=false)
void push_tag_with_class (std::string name, std::string class_, bool preserve_whitespace=false)
void pop_tag (const char *expected_name)
void set_attr (const char *name, std::string value)
void add_text (std::string text)
void add_text_from_pp (pretty_printer &pp)
void add_raw (std::string text)
void push_element (std::unique_ptr< element > new_element)
void append (std::unique_ptr< node > new_node)
elementget_insertion_point () const
size_t get_num_open_tags () const
void DEBUG_FUNCTION dump () const

Private Attributes

std::vector< element * > m_open_tags
bool m_check_popped_tags

Detailed Description

A class for creating XML trees by appending to an insertion point, with a stack of open tags.

Constructor & Destructor Documentation

◆ printer()

xml::printer::printer ( element & insertion_point,
bool check_popped_tags = true )

References m_check_popped_tags, and m_open_tags.

Member Function Documentation

◆ add_raw()

void xml::printer::add_raw ( std::string text)

◆ add_text()

◆ add_text_from_pp()

void xml::printer::add_text_from_pp ( pretty_printer & pp)

◆ append()

void xml::printer::append ( std::unique_ptr< node > new_node)

◆ dump()

void xml::printer::dump ( ) const

◆ get_insertion_point()

element * xml::printer::get_insertion_point ( ) const

References m_open_tags.

Referenced by pop_tag().

◆ get_num_open_tags()

size_t xml::printer::get_num_open_tags ( ) const
inline

References m_open_tags.

◆ pop_tag()

void xml::printer::pop_tag ( const char * expected_name)
Pop the current topmost tag. If m_check_popped_tags, assert that the tag we're popping is EXPECTED_NAME.

References gcc_assert, get_insertion_point(), m_check_popped_tags, and m_open_tags.

Referenced by state_diagram::add_title_tr(), diagnostics::to_text::layout_printer< to_text >, state_diagram::on_node_in_table(), and state_diagram::pop_src_text().

◆ push_element()

void xml::printer::push_element ( std::unique_ptr< element > new_element)

◆ push_tag()

void xml::printer::push_tag ( std::string name,
bool preserve_whitespace = false )

◆ push_tag_with_class()

void xml::printer::push_tag_with_class ( std::string name,
std::string class_,
bool preserve_whitespace = false )

◆ set_attr()

Field Documentation

◆ m_check_popped_tags

bool xml::printer::m_check_popped_tags
private

Referenced by pop_tag(), and printer().

◆ m_open_tags


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