KDevelop API Documentation

lib/util/domutil.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2001 by Bernd Gehrmann * 00003 * bernd@kdevelop.org * 00004 * jakob@simon-gaarde.dk * 00005 * * 00006 * This program is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 2 of the License, or * 00009 * (at your option) any later version. * 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; // for use when more than one element matches the path 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
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:48 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003