Reference documentation for deal.II version 8.4.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
dealii::ParameterGui::XMLParameterReader Class Reference

#include </build/deal.ii-pdtiAo/deal.ii-8.4.2/contrib/parameter_gui/xml_parameter_reader.h>

Public Member Functions

 XMLParameterReader (QTreeWidget *tree_widget)
 
bool read_xml_file (QIODevice *device)
 
QString error_string () const
 

Private Member Functions

void parse_parameters ()
 
void read_subsection_element (QTreeWidgetItem *parent)
 
void read_parameter_element (QTreeWidgetItem *parent)
 
QString demangle (const QString &s)
 
QTreeWidgetItem * create_child_item (QTreeWidgetItem *item)
 

Private Attributes

QXmlStreamReader xml
 
QTreeWidget * tree_widget
 
QIcon subsection_icon
 
QIcon parameter_icon
 

Detailed Description

The XMLParameterReader class provides an interface to parse parameters from XML files to a QTreeWidget. This class makes extensive use of the QXmlStreamReader class, which implements the basic functionalities for parsing XML files.

Note
This class is used in the graphical user interface for the ParameterHandler class. It is not compiled into the deal.II libraries and can not be used by applications using deal.II.
Author
Martin Steigemann, Wolfgang Bangerth, 2010

Definition at line 44 of file xml_parameter_reader.h.

Constructor & Destructor Documentation

§ XMLParameterReader()

dealii::ParameterGui::XMLParameterReader::XMLParameterReader ( QTreeWidget *  tree_widget)

Constructor. The parameter values will be stored in tree_widget.

Definition at line 26 of file xml_parameter_reader.cpp.

Member Function Documentation

§ read_xml_file()

bool dealii::ParameterGui::XMLParameterReader::read_xml_file ( QIODevice *  device)

This function reads the parameters from device into the tree_widget. We use the QXmlStreamReader class for this. There must be a start element <ParameterHandler> and an end element </ParameterHandler> otherwise an exception is thrown.

Definition at line 39 of file xml_parameter_reader.cpp.

§ error_string()

QString dealii::ParameterGui::XMLParameterReader::error_string ( ) const

This function returns an error message.

Definition at line 69 of file xml_parameter_reader.cpp.

§ parse_parameters()

void dealii::ParameterGui::XMLParameterReader::parse_parameters ( )
private

This function implements a loop over the XML file and parses XML elements. It calls read_subsection_element till the </ParameterHandler> element is found or the end of the file is reached. In this case, an exception is thrown.

Definition at line 79 of file xml_parameter_reader.cpp.

§ read_subsection_element()

void dealii::ParameterGui::XMLParameterReader::read_subsection_element ( QTreeWidgetItem *  parent)
private

This functions parses a subsection. and adds it as a child to parent. If the next element is <value>, this functions calls read_parameter_element otherwise the function itself recursively.

Definition at line 95 of file xml_parameter_reader.cpp.

§ read_parameter_element()

void dealii::ParameterGui::XMLParameterReader::read_parameter_element ( QTreeWidgetItem *  parent)
private

This function parses a parameter and and adds it as a child to parent. A parameter description consists of five elements:

<value>value</value>
<default_value>default_value</default_value>
<documentation>documentation</documentation>
<pattern>pattern</pattern>
<pattern_description>[pattern_description]</pattern_description>

If a parameter description is incomplete, an exception is thrown.

Definition at line 158 of file xml_parameter_reader.cpp.

§ demangle()

QString dealii::ParameterGui::XMLParameterReader::demangle ( const QString &  s)
private

Reimplemented from the ParameterHandler class. Unmangle a string s into its original form.

Definition at line 298 of file xml_parameter_reader.cpp.

§ create_child_item()

QTreeWidgetItem * dealii::ParameterGui::XMLParameterReader::create_child_item ( QTreeWidgetItem *  item)
private

This helper function creates a new child of item in the tree.

Definition at line 280 of file xml_parameter_reader.cpp.

Member Data Documentation

§ xml

QXmlStreamReader dealii::ParameterGui::XMLParameterReader::xml
private

The QXmlStreamReader object for reading XML elements.

Definition at line 109 of file xml_parameter_reader.h.

§ tree_widget

QTreeWidget* dealii::ParameterGui::XMLParameterReader::tree_widget
private

A pointer to the tree structure.

Definition at line 113 of file xml_parameter_reader.h.

§ subsection_icon

QIcon dealii::ParameterGui::XMLParameterReader::subsection_icon
private

An icon for subsections in the tree structure.

Definition at line 117 of file xml_parameter_reader.h.

§ parameter_icon

QIcon dealii::ParameterGui::XMLParameterReader::parameter_icon
private

An icon for parameters in the tree structure.

Definition at line 121 of file xml_parameter_reader.h.


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