From d6f8bbb45b267065a6907e71ff9c98bb6d161241 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:56:07 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- lib/util/domutil.cpp | 156 +++++++++++++++++++++++++-------------------------- 1 file changed, 78 insertions(+), 78 deletions(-) (limited to 'lib/util/domutil.cpp') diff --git a/lib/util/domutil.cpp b/lib/util/domutil.cpp index b183717f..9f5d40c9 100644 --- a/lib/util/domutil.cpp +++ b/lib/util/domutil.cpp @@ -15,23 +15,23 @@ #include "domutil.h" #include -#include -#include +#include +#include -void DomUtil::makeEmpty( QDomElement& e ) +void DomUtil::makeEmpty( TQDomElement& e ) { while( !e.firstChild().isNull() ) e.removeChild( e.firstChild() ); } -QDomElement DomUtil::elementByPath(const QDomDocument &doc, const QString &path) +TQDomElement DomUtil::elementByPath(const TQDomDocument &doc, const TQString &path) { - QStringList l = QStringList::split('/', path); + TQStringList l = TQStringList::split('/', path); - QDomElement el; + TQDomElement el; if(&doc) el = doc.documentElement(); - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for (it = l.begin(); it != l.end(); ++it) { el = el.namedItem(*it).toElement(); } @@ -40,9 +40,9 @@ QDomElement DomUtil::elementByPath(const QDomDocument &doc, const QString &path) } -QString DomUtil::readEntry(const QDomDocument &doc, const QString &path, const QString &defaultEntry) +TQString DomUtil::readEntry(const TQDomDocument &doc, const TQString &path, const TQString &defaultEntry) { - QDomElement el = elementByPath(doc, path); + TQDomElement el = elementByPath(doc, path); if (el.isNull()) return defaultEntry; else @@ -51,20 +51,20 @@ QString DomUtil::readEntry(const QDomDocument &doc, const QString &path, const Q /// @todo consider whether it's okay to accept empty string == default value /// if not use the below type -///typedef pair EltInfo; +///typedef pair EltInfo; -QString DomUtil::readEntryAux(const QDomDocument &doc, const QString &path) +TQString DomUtil::readEntryAux(const TQDomDocument &doc, const TQString &path) { - QDomElement el = elementByPath(doc, path); + TQDomElement el = elementByPath(doc, path); if (el.isNull()) - return QString::null; + return TQString::null; else return el.firstChild().toText().data(); } -int DomUtil::readIntEntry(const QDomDocument &doc, const QString &path, int defaultEntry) +int DomUtil::readIntEntry(const TQDomDocument &doc, const TQString &path, int defaultEntry) { - QString entry = readEntryAux(doc, path); + TQString entry = readEntryAux(doc, path); if (entry.isNull()) return defaultEntry; else @@ -72,9 +72,9 @@ int DomUtil::readIntEntry(const QDomDocument &doc, const QString &path, int defa } -bool DomUtil::readBoolEntry(const QDomDocument &doc, const QString &path, bool defaultEntry) +bool DomUtil::readBoolEntry(const TQDomDocument &doc, const TQString &path, bool defaultEntry) { - QString entry = readEntryAux(doc, path); + TQString entry = readEntryAux(doc, path); if (entry.isNull()) return defaultEntry; else @@ -82,12 +82,12 @@ bool DomUtil::readBoolEntry(const QDomDocument &doc, const QString &path, bool d } -QStringList DomUtil::readListEntry(const QDomDocument &doc, const QString &path, const QString &tag) +TQStringList DomUtil::readListEntry(const TQDomDocument &doc, const TQString &path, const TQString &tag) { - QStringList list; + TQStringList list; - QDomElement el = elementByPath(doc, path); - QDomElement subEl = el.firstChild().toElement(); + TQDomElement el = elementByPath(doc, path); + TQDomElement subEl = el.firstChild().toElement(); while (!subEl.isNull()) { if (subEl.tagName() == tag) list << subEl.firstChild().toText().data(); @@ -98,17 +98,17 @@ QStringList DomUtil::readListEntry(const QDomDocument &doc, const QString &path, } -DomUtil::PairList DomUtil::readPairListEntry(const QDomDocument &doc, const QString &path, const QString &tag, - const QString &firstAttr, const QString &secondAttr) +DomUtil::PairList DomUtil::readPairListEntry(const TQDomDocument &doc, const TQString &path, const TQString &tag, + const TQString &firstAttr, const TQString &secondAttr) { PairList list; - QDomElement el = elementByPath(doc, path); - QDomElement subEl = el.firstChild().toElement(); + TQDomElement el = elementByPath(doc, path); + TQDomElement subEl = el.firstChild().toElement(); while (!subEl.isNull()) { if (subEl.tagName() == tag) { - QString first = subEl.attribute(firstAttr); - QString second = subEl.attribute(secondAttr); + TQString first = subEl.attribute(firstAttr); + TQString second = subEl.attribute(secondAttr); list << Pair(first, second); } subEl = subEl.nextSibling().toElement(); @@ -117,12 +117,12 @@ DomUtil::PairList DomUtil::readPairListEntry(const QDomDocument &doc, const QStr return list; } -QMap DomUtil::readMapEntry(const QDomDocument &doc, const QString& path) +TQMap DomUtil::readMapEntry(const TQDomDocument &doc, const TQString& path) { - QMap map; + TQMap map; - QDomElement el = elementByPath(doc, path); - QDomElement subEl = el.firstChild().toElement(); + TQDomElement el = elementByPath(doc, path); + TQDomElement subEl = el.firstChild().toElement(); while (!subEl.isNull()) { map[subEl.tagName()] = subEl.firstChild().toText().data(); subEl = subEl.nextSibling().toElement(); @@ -131,9 +131,9 @@ QMap DomUtil::readMapEntry(const QDomDocument &doc, const QStr return map; } -QDomElement DomUtil::namedChildElement( QDomElement& el, const QString& name ) +TQDomElement DomUtil::namedChildElement( TQDomElement& el, const TQString& name ) { - QDomElement child = el.namedItem( name ).toElement(); + TQDomElement child = el.namedItem( name ).toElement(); if (child.isNull()) { child = el.ownerDocument().createElement( name ); el.appendChild(child); @@ -142,13 +142,13 @@ QDomElement DomUtil::namedChildElement( QDomElement& el, const QString& name ) } -QDomElement DomUtil::createElementByPath(QDomDocument &doc, const QString &path) +TQDomElement DomUtil::createElementByPath(TQDomDocument &doc, const TQString &path) { - QStringList l = QStringList::split('/', path); + TQStringList l = TQStringList::split('/', path); - QDomElement el; + TQDomElement el; if(&doc) el = doc.documentElement(); - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for (it = l.begin(); it != l.end(); ++it) el = DomUtil::namedChildElement( el, *it ); @@ -159,16 +159,16 @@ QDomElement DomUtil::createElementByPath(QDomDocument &doc, const QString &path) } -void DomUtil::writeEntry(QDomDocument &doc, const QString &path, const QString &value) +void DomUtil::writeEntry(TQDomDocument &doc, const TQString &path, const TQString &value) { - QDomElement el = createElementByPath(doc, path); + TQDomElement el = createElementByPath(doc, path); el.appendChild(doc.createTextNode(value)); } -void DomUtil::writeMapEntry(QDomDocument &doc, const QString &path, const QMap &map) +void DomUtil::writeMapEntry(TQDomDocument &doc, const TQString &path, const TQMap &map) { - QString basePath( path + "/" ); - QMap::ConstIterator it; + TQString basePath( path + "/" ); + TQMap::ConstIterator it; for (it = map.begin(); it != map.end(); ++it) { kdDebug( 9010 ) << "writing " << basePath << ";" << it.key() << ";" << it.data() << endl; @@ -177,65 +177,65 @@ void DomUtil::writeMapEntry(QDomDocument &doc, const QString &path, const QMap1) { // handle attributes - QStringList attrParts = QStringList::split(';',pathElemParts[1]); + TQStringList attrParts = TQStringList::split(';',pathElemParts[1]); for (unsigned int j=0; j