OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
dealii::ParameterGui::XMLParameterReader Class Reference

The XMLParameterReader class provides an interface to parse parameters from XML files to a QTreeWidget. More...

#include <xml_parameter_reader.h>

Public Member Functions

 XMLParameterReader (QTreeWidget *tree_widget)
 Constructor. More...
 
bool read_xml_file (QIODevice *device)
 This function reads the parameters from device into the tree_widget. More...
 
QString error_string () const
 This function returns an error message. More...
 

Private Member Functions

void parse_parameters ()
 This function implements a loop over the XML file and parses XML elements. More...
 
void read_subsection_element (QTreeWidgetItem *parent)
 This functions parses a subsection. More...
 
void read_parameter_element (QTreeWidgetItem *parent)
 This function parses a parameter and and adds it as a child to parent. More...
 
QString demangle (const QString &s)
 Reimplemented from the ParameterHandler class. More...
 
QTreeWidgetItem * create_child_item (QTreeWidgetItem *item)
 This helper function creates a new child of item in the tree. More...
 

Private Attributes

QXmlStreamReader xml
 The QXmlStreamReader object for reading XML elements. More...
 
QTreeWidget * tree_widget
 A pointer to the tree structure. More...
 
QIcon subsection_icon
 An icon for subsections in the tree structure. More...
 
QIcon parameter_icon
 An icon for parameters in the tree structure. More...
 

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

Constructor & Destructor Documentation

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

Constructor.

The parameter values will be stored in tree_widget.

Member Function Documentation

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

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

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

Reimplemented from the ParameterHandler class.

Unmangle a string s into its original form.

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_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.

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.

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.

Member Data Documentation

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

An icon for parameters in the tree structure.

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

An icon for subsections in the tree structure.

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

A pointer to the tree structure.

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

The QXmlStreamReader object for reading XML elements.


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