PandA-2024.02
Public Member Functions | Private Attributes
xml_document Class Reference

#include <xml_document.hpp>

Inheritance diagram for xml_document:
Inheritance graph
[legend]
Collaboration diagram for xml_document:
Collaboration graph
[legend]

Public Member Functions

 xml_document (const std::string &_version="1.0")
 constructor More...
 
void print (std::ostream &os, bool formatted, simple_indent *pp) const override
 Print the class. More...
 
xml_elementget_root_node () const
 Return the root node. More...
 
xml_elementcreate_root_node (const std::string &_name)
 Creates the root node. More...
 
void write_to_file (const std::filesystem::path &filename)
 Write the document to a file. More...
 
void write_to_file_formatted (const std::filesystem::path &filename)
 Write the document to a file. More...
 
std::string get_encoding () const
 
void set_encoding (const std::string &_encoding)
 
- Public Member Functions inherited from xml_child
 xml_child (const std::string &_name)
 constructor More...
 
void print (std::ostream &os, bool formatted, simple_indent *pp) const override
 Print the class. More...
 
xml_elementadd_child_element (const std::string &name)
 Add a child element to this node. More...
 
xml_elementadd_child_element (const xml_nodeRef &node)
 Add a child element to this node starting from a given node. More...
 
xml_text_nodeadd_child_text (const std::string &content)
 Append a new text node. More...
 
xml_text_nodeget_child_text ()
 Get the first child text content node. More...
 
const xml_text_nodeget_child_text () const
 Get the first child text content node. More...
 
xml_comment_nodeadd_child_comment (const std::string &content)
 Append a new comment node. More...
 
xml_att_decl_nodeadd_child_attribute_declaration (const std::string &name)
 Append a new attribute declaration node. More...
 
void remove_child (xml_node *el)
 Remove the child node. More...
 
node_list const & get_children ()
 Obtain the list of child nodes. More...
 
const node_listget_children () const
 Obtain the list of child nodes. More...
 
bool has_child () const
 
const CustomSet< xml_nodeRef > CGetDescendants (const std::string &path) const
 Return the set of descendants with a specific path. More...
 
- Public Member Functions inherited from xml_node
 xml_node (const std::string &_name)
 constructor More...
 
virtual ~xml_node ()=default
 destructor More...
 
std::string get_name () const
 Get the name of this node. More...
 
void set_name (const std::string &_name)
 Set the name of this node. More...
 
int get_line () const
 Discover at what line number this node occurs in the XML file. More...
 
void set_line (int _line)
 Set the line this node occurs in the XML file. More...
 

Private Attributes

xml_elementroot_node
 
std::string version
 
std::string encoding
 

Additional Inherited Members

- Public Types inherited from xml_node
using node_list = std::list< xml_nodeRef >
 type for list of xml nodes More...
 
- Static Public Member Functions inherited from xml_node
static void convert_unescaped (std::string &ioString)
 Convert unescaped characters. More...
 
static void convert_escaped (std::string &ioString)
 Convert escaped characters. More...
 

Detailed Description

Definition at line 57 of file xml_document.hpp.

Constructor & Destructor Documentation

◆ xml_document()

xml_document::xml_document ( const std::string &  _version = "1.0")
inlineexplicit

constructor

Definition at line 66 of file xml_document.hpp.

Member Function Documentation

◆ create_root_node()

xml_element* xml_document::create_root_node ( const std::string &  _name)
inline

Creates the root node.

Parameters
nameThe node's name.
Returns
A pointer to the new root node

Definition at line 103 of file xml_document.hpp.

References xml_child::add_child_element(), and root_node.

Referenced by WriteTechnology::Exec(), Evaluation::Exec(), parametric_list_based::InternalExec(), TestVectorParser::ParseXMLFile(), HLS_constraints::write_HLS_constraints_File(), write_structural_File(), Parameter::write_xml_configuration_file(), CompilerWrapper::WriteXml(), HLS_manager::xwrite(), memory::xwrite(), and RTLCharacterization::xwrite_device_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_encoding()

std::string xml_document::get_encoding ( ) const
inline
Returns
The encoding used in the source from which the document has been loaded.

Definition at line 133 of file xml_document.hpp.

References encoding.

◆ get_root_node()

xml_element* xml_document::get_root_node ( ) const
inline

Return the root node.

This function does not create a default root node if it doesn't exist.

Returns
A pointer to the root node if it exists, 0 otherwise.

Definition at line 94 of file xml_document.hpp.

References root_node.

◆ print()

void xml_document::print ( std::ostream &  os,
bool  formatted,
simple_indent pp 
) const
inlineoverridevirtual

Print the class.

Implements xml_node.

Definition at line 74 of file xml_document.hpp.

References xml_child::print().

Referenced by write_to_file(), and write_to_file_formatted().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_encoding()

void xml_document::set_encoding ( const std::string &  _encoding)
inline
Returns
The encoding used in the source from which the document has been loaded.

Definition at line 140 of file xml_document.hpp.

Referenced by BackendFlow::create_xml_scripts().

Here is the caller graph for this function:

◆ write_to_file()

void xml_document::write_to_file ( const std::filesystem::path &  filename)
inline

Write the document to a file.

Parameters
filename

Definition at line 112 of file xml_document.hpp.

References print(), and THROW_UNREACHABLE.

Here is the call graph for this function:

◆ write_to_file_formatted()

void xml_document::write_to_file_formatted ( const std::filesystem::path &  filename)
inline

Write the document to a file.

The output is formatted by inserting whitespaces, which is easier to read for a human, but may insert unwanted significant whitespaces. Use with care !

Parameters
filename

Definition at line 124 of file xml_document.hpp.

References print(), STD_CLOSING_CHAR, STD_OPENING_CHAR, and XML_TAB_SIZE.

Referenced by BackendFlow::create_xml_scripts(), WriteTechnology::Exec(), Evaluation::Exec(), parametric_list_based::InternalExec(), HLS_constraints::write_HLS_constraints_File(), write_structural_File(), Parameter::write_xml_configuration_file(), CompilerWrapper::WriteXml(), HLS_manager::xwrite(), memory::xwrite(), and RTLCharacterization::xwrite_device_file().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ encoding

std::string xml_document::encoding
private

Definition at line 61 of file xml_document.hpp.

Referenced by get_encoding().

◆ root_node

xml_element* xml_document::root_node
private

Definition at line 59 of file xml_document.hpp.

Referenced by create_root_node(), and get_root_node().

◆ version

std::string xml_document::version
private

Definition at line 60 of file xml_document.hpp.


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

Generated on Mon Feb 12 2024 13:04:11 for PandA-2024.02 by doxygen 1.8.13