34 QDomElement
top()
const {
return mTopNode;}
38 bool isValid()
const {
return !mCurrentTop.isNull(); }
39 bool hasNode(
const QString &path)
const;
41 QDomElement
node(
const QString &path)
const;
42 QString
value(
const QString &path,
const QString &defaultValue=
"")
const;
43 bool valueBool(
const QString &path,
const bool defaultValue=
false)
const;
44 double valueDouble(
const QString &path,
const double defaultValue=0.)
const;
45 int valueInt(
const QString &path,
const int defaultValue=0)
const;
50 double paramValue(
const QString ¶mName,
const double defaultValue=0.)
const;
51 QString
paramValueString(
const QString ¶mName,
const QString &defaultValue=
"")
const;
52 bool paramValueBool(
const QString ¶mName,
const bool &defaultValue=
true)
const;
54 QStringList
dump(
const QString &path,
int levels=-1);
56 void dump_rec(QDomElement c, QStringList &stack, QStringList &out);
58 QDomElement mCurrentTop;
60 QHash<const QString, QString> mParamCache;
XmlHelper wraps a XML file and provides some convenient functions to retrieve values.
Definition: xmlhelper.h:26
XmlHelper()
Definition: xmlhelper.cpp:54
QStringList dump(const QString &path, int levels=-1)
Definition: xmlhelper.cpp:253
bool isValid() const
returns true if the current (relative!) node is valid (i.e. not null).
Definition: xmlhelper.h:38
QString paramValueString(const QString ¶mName, const QString &defaultValue="") const
get value of special "parameter" space
Definition: xmlhelper.cpp:107
QDomElement node(const QString &path) const
retrieve node defined by path (see class description)
Definition: xmlhelper.cpp:176
XmlHelper(const QString &fileName)
Definition: xmlhelper.h:30
bool paramValueBool(const QString ¶mName, const bool &defaultValue=true) const
get value of special "parameter" space
Definition: xmlhelper.cpp:114
bool valueBool(const QString &path, const bool defaultValue=false) const
retrieve value (as bool) from node path.
Definition: xmlhelper.cpp:142
bool setNodeValue(QDomElement &node, const QString &value)
set value of 'node'. return true on success.
Definition: xmlhelper.cpp:208
QDomElement top() const
Definition: xmlhelper.h:34
~XmlHelper()
Definition: xmlhelper.cpp:57
void setCurrentNode(const QDomElement &node)
sets node as the current (relative) top node.
Definition: xmlhelper.h:36
int valueInt(const QString &path, const int defaultValue=0) const
retrieve value (as int) from node path.
Definition: xmlhelper.cpp:169
double valueDouble(const QString &path, const double defaultValue=0.) const
retrieve value (as double) from node path.
Definition: xmlhelper.cpp:155
double paramValue(const QString ¶mName, const double defaultValue=0.) const
get value of special "parameter" space
Definition: xmlhelper.cpp:101
QString value(const QString &path, const QString &defaultValue="") const
retrieve value (as string) from node path.
Definition: xmlhelper.cpp:129
void loadFromFile(const QString &fileName)
Definition: xmlhelper.cpp:70
void setCurrentNode(const QString &path)
sets path as the current (relative) node.
Definition: xmlhelper.h:35
bool hasNode(const QString &path) const
returns true if path exists.
Definition: xmlhelper.cpp:124