diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
commit | 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch) | |
tree | b95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/xml_to_data/xml_to_data.cpp | |
parent | b79a2c28534cf09987eeeba3077fff9236df182a (diff) | |
download | piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.tar.gz piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.zip |
TQt4 port piklab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/xml_to_data/xml_to_data.cpp')
-rw-r--r-- | src/xml_to_data/xml_to_data.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/xml_to_data/xml_to_data.cpp b/src/xml_to_data/xml_to_data.cpp index d31ded0..65dc463 100644 --- a/src/xml_to_data/xml_to_data.cpp +++ b/src/xml_to_data/xml_to_data.cpp @@ -8,18 +8,18 @@ ***************************************************************************/ #include "xml_to_data.h" -#include <qfile.h> -#include <qtextstream.h> +#include <tqfile.h> +#include <tqtextstream.h> -QDomElement XmlToData::findUniqueElement(QDomElement parent, const QString &tag, - const QString &attribute, const QString &value) const +TQDomElement XmlToData::findUniqueElement(TQDomElement tqparent, const TQString &tag, + const TQString &attribute, const TQString &value) const { - QDomElement element; - QDomNode child = parent.firstChild(); + TQDomElement element; + TQDomNode child = tqparent.firstChild(); while ( !child.isNull() ) { if ( child.nodeName()==tag && child.isElement() && (attribute.isEmpty() || child.toElement().attribute(attribute)==value) ) { - if ( !element.isNull() ) qFatal(QString("Duplicated element \"%1/%2\"").arg(tag).arg(value)); + if ( !element.isNull() ) qFatal(TQString("Duplicated element \"%1/%2\"").tqarg(tag).tqarg(value)); element = child.toElement(); } child = child.nextSibling(); @@ -27,36 +27,36 @@ QDomElement XmlToData::findUniqueElement(QDomElement parent, const QString &tag, return element; } -void XmlToData::checkTagNames(QDomElement element, const QString &tag, - const QStringList &names) const +void XmlToData::checkTagNames(TQDomElement element, const TQString &tag, + const TQStringList &names) const { - QDomNodeList list = element.elementsByTagName(tag); + TQDomNodeList list = element.elementsByTagName(tag); for (uint i=0; i<uint(list.count()); i++) { if ( !list.item(i).isElement() ) continue; - QString name = list.item(i).toElement().attribute("name"); - if ( names.find(name)==names.end() ) qFatal(QString("Illegal name %1 for %2 element").arg(name).arg(tag)); + TQString name = list.item(i).toElement().attribute("name"); + if ( names.tqfind(name)==names.end() ) qFatal(TQString("Illegal name %1 for %2 element").tqarg(name).tqarg(tag)); } } -QDomDocument XmlToData::parseFile(const QString &filename) const +TQDomDocument XmlToData::parseFile(const TQString &filename) const { qDebug("Parsing XML file \"%s\"...", filename.latin1()); - QFile file(filename); + TQFile file(filename); if ( !file.open(IO_ReadOnly) ) qFatal("Cannot open file!"); - QDomDocument doc; - QString error; + TQDomDocument doc; + TQString error; int errorLine, errorColumn; if ( !doc.setContent(&file, false, &error, &errorLine, &errorColumn) ) - qFatal(QString("Error parsing XML file (%1 at line %2, column %3)").arg(error).arg(errorLine).arg(errorColumn)); + qFatal(TQString("Error parsing XML file (%1 at line %2, column %3)").tqarg(error).tqarg(errorLine).tqarg(errorColumn)); return doc; } -void XmlToData::warning(const QString &message) const +void XmlToData::warning(const TQString &message) const { if ( currentDevice().isEmpty() ) ::qWarning("Warning: %s", message.latin1()); else ::qWarning("Warning [%s]: %s", currentDevice().latin1(), message.latin1()); } -void XmlToData::qFatal(const QString &message) const +void XmlToData::qFatal(const TQString &message) const { if ( currentDevice().isEmpty() ) ::qFatal("Fatal: %s", message.latin1()); else ::qFatal("Fatal [%s]: %s", currentDevice().latin1(), message.latin1()); |