forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxml.h
51 lines (41 loc) · 2.04 KB
/
xml.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef XML_H
#define XML_H
#include <QDomNode>
#include <QDomElement>
#include <QDomDocument>
class XmlParse {
public:
// Searches for and returns a node named sNode in the children of
// nodeHeader. Returns a null QDomNode if one is not found.
static QDomNode selectNode(const QDomNode& nodeHeader,
const QString& sNode);
// Searches for and returns an element named sNode in the children of
// nodeHeader. Returns a null QDomElement if one is not found.
static QDomElement selectElement(const QDomNode& nodeHeader,
const QString& sNode);
// Searches for an element named sNode in the children of nodeHeader and
// parses the text value of its children as an integer. Returns 0 if sNode
// is not found in nodeHeader's children.
static int selectNodeInt(const QDomNode& nodeHeader,
const QString& sNode);
// Searches for an element named sNode in the children of nodeHeader and
// parses the text value of its children as a float. Returns 0.0f if sNode
// is not found in nodeHeader's children.
static float selectNodeFloat(const QDomNode& nodeHeader,
const QString& sNode);
// Searches for an element named sNode in the children of nodeHeader and
// returns the text value of its children. Returns the empty string if sNode
// is not found in nodeHeader's children.
static QString selectNodeQString(const QDomNode& nodeHeader,
const QString& sNode);
// Open an XML file.
static QDomElement openXMLFile(const QString& path, const QString& name);
// Add an element named elementName to the provided header element with a
// child text node with the value textValue. Returns the created element.
static QDomElement addElement(QDomDocument& document, QDomElement& header,
const QString& elementName, const QString& textValue);
private:
XmlParse() {}
~XmlParse() {}
};
#endif