Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
dealii::ParameterGui::XMLParameterReader Class Reference

#include <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 45 of file xml_parameter_reader.h.

Constructor & Destructor Documentation

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

Constructor. The parameter values will be stored in tree_widget.

Member Function Documentation

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

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

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

This function returns an error message.

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.

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.

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.

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

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

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

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

Member Data Documentation

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

The QXmlStreamReader object for reading XML elements.

Definition at line 110 of file xml_parameter_reader.h.

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

A pointer to the tree structure.

Definition at line 114 of file xml_parameter_reader.h.

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

An icon for subsections in the tree structure.

Definition at line 118 of file xml_parameter_reader.h.

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

An icon for parameters in the tree structure.

Definition at line 122 of file xml_parameter_reader.h.


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