3 #ifndef __hds_parameter_xml_parser_hpp
4 #define __hds_parameter_xml_parser_hpp
8 #include <QDomDocument>
10 #include <hds_batch/hds_batch_module_parameter.hpp>
22 static const char par[];
23 static const char par_name[];
24 static const char par_type[];
25 static const char par_comment[];
26 static const char param_strlist_elem[];
27 static const char param_strlist_elem_id[];
35 QDomDocument &doc)
const;
45 template <
typename IT>
46 static void xml2list_of_items(
const QDomNode &node, QList<IT> &list,
47 const QString &i_xml_param_elem,
48 const QString &i_xml_param_elem_id)
51 QMap<int, IT> items_map;
52 const QDomNodeList &list_nodes = node.childNodes();
53 for (
int i=0; i<list_nodes.size(); i++)
56 if (list_nodes.item(i).nodeName() != i_xml_param_elem)
60 QString id_str = list_nodes.item(i).toElement().attribute(i_xml_param_elem_id);
61 if (id_str.isEmpty() || id_str.isNull())
63 qDebug(
"hds::ParameterXMLParser::xml2list_of_items: error: "
64 "can't get id tag for item[%d], skipping.", i);
70 int id = id_str.toInt(&ok);
73 qDebug(
"ParameterXMLParser::xml2list_of_items: error: "
74 "incorrect id=%s of item[%d], skipping.",
75 id_str.toAscii().constData(), i);
80 if (items_map.contains(
id))
82 qDebug(
"ParameterXMLParser::xml2list_of_items: error: "
83 "id=%d is presents in the list of items, skipping.",
id);
88 IT value = list_nodes.item(i).toElement().text();
90 items_map[id] = value;
94 list = items_map.values();
Definition: hds_parameter_xml_parser.hpp:15
Type
Definition: hds_batch_module_parameter.hpp:18
Definition: hds_batch_module_parameter.hpp:13