lib/util/domutil.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
#ifndef _DOMUTIL_H_
00014
#define _DOMUTIL_H_
00015
00016
#include <qdom.h>
00017
#include <qpair.h>
00018
#include <qstringlist.h>
00019
#include <qvaluelist.h>
00020
00021
00022 struct DomAttribute
00023 {
00024 QString name;
00025 QString value;
00026 };
00027
00028 struct DomPathElement
00029 {
00030 QString tagName;
00031 QValueList<DomAttribute> attribute;
00032 int matchNumber;
00033 };
00034
00035 typedef QValueList<DomPathElement> DomPath;
00036
00040 class DomUtil
00041 {
00042
public:
00043 typedef QPair<QString, QString> Pair;
00044 typedef QValueList<Pair> PairList;
00048
static void makeEmpty(
QDomElement& );
00052
static QString readEntry(
const QDomDocument &doc,
const QString &path,
const QString &defaultEntry = QString::null);
00056
static int readIntEntry(
const QDomDocument &doc,
const QString &path,
int defaultEntry = 0);
00061
static bool readBoolEntry(
const QDomDocument &doc,
const QString &path,
bool defaultEntry =
false);
00065
static QStringList readListEntry(
const QDomDocument &doc,
const QString &path,
const QString &tag);
00069
static PairList readPairListEntry(
const QDomDocument &doc,
const QString &path,
const QString &tag,
00070
const QString &firstAttr,
const QString &secondAttr);
00075
static QDomElement elementByPath(
const QDomDocument& doc,
const QString& path );
00079
static QDomElement createElementByPath(
QDomDocument& doc,
const QString& path );
00084
static QDomElement namedChildElement(
QDomElement& el,
const QString& name );
00097
static void writeEntry(
QDomDocument &doc,
const QString &path,
const QString &value);
00101
static void writeIntEntry(
QDomDocument &doc,
const QString &path,
int value);
00105
static void writeBoolEntry(
QDomDocument &doc,
const QString &path,
bool value);
00119
static void writeListEntry(
QDomDocument &doc,
const QString &path,
const QString &tag,
00120
const QStringList &value);
00140
static void writePairListEntry(
QDomDocument &doc,
const QString &path,
const QString &tag,
00141
const QString &firstAttr,
const QString &secondAttr,
00142
const PairList &value);
00143
00151
static DomPath resolvPathStringExt(
const QString pathstring);
00152
00181
static QDomElement elementByPathExt(
QDomDocument &doc,
const QString &pathstring);
00182
00186
static bool openDOMFile(
QDomDocument &doc,
QString filename);
00187
00191
static bool saveDOMFile(
QDomDocument &doc,
QString filename);
00192
00196
static bool removeTextNodes(
QDomDocument doc,
QString pathExt);
00197
00201
static bool appendText(
QDomDocument doc,
QString pathExt,
QString text);
00202
00206
static bool replaceText(
QDomDocument doc,
QString pathExt,
QString text);
00207
00208
private:
00209
static QString readEntryAux(
const QDomDocument &doc,
const QString &path);
00210 };
00211
00212
#endif
This file is part of the documentation for KDevelop Version 3.0.4.