summaryrefslogtreecommitdiffstats
path: root/src/xml_to_data
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
commit0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch)
treeb95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/xml_to_data
parentb79a2c28534cf09987eeeba3077fff9236df182a (diff)
downloadpiklab-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')
-rw-r--r--src/xml_to_data/device_xml_to_data.cpp120
-rw-r--r--src/xml_to_data/device_xml_to_data.h38
-rw-r--r--src/xml_to_data/prog_xml_to_data.h86
-rw-r--r--src/xml_to_data/xml_to_data.cpp38
-rw-r--r--src/xml_to_data/xml_to_data.h22
5 files changed, 150 insertions, 154 deletions
diff --git a/src/xml_to_data/device_xml_to_data.cpp b/src/xml_to_data/device_xml_to_data.cpp
index 9ad1940..515c6c9 100644
--- a/src/xml_to_data/device_xml_to_data.cpp
+++ b/src/xml_to_data/device_xml_to_data.cpp
@@ -8,15 +8,15 @@
***************************************************************************/
#include "device_xml_to_data.h"
-#include <qdir.h>
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qregexp.h>
+#include <tqdir.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqregexp.h>
-bool Device::XmlToDataBase::getFrequencyRange(OperatingCondition oc, Special special, QDomElement element)
+bool Device::XmlToDataBase::getFrequencyRange(OperatingCondition oc, Special special, TQDomElement element)
{
- QDomElement range;
- for (QDomNode child=element.firstChild(); !child.isNull(); child=child.nextSibling()) {
+ TQDomElement range;
+ for (TQDomNode child=element.firstChild(); !child.isNull(); child=child.nextSibling()) {
if ( child.nodeName()!="frequency_range" ) continue;
if ( !child.isElement() ) qFatal("\"frequency_range\" should be an element");
if ( child.toElement().attribute("name")!=oc.key() ) continue;
@@ -30,10 +30,10 @@ bool Device::XmlToDataBase::getFrequencyRange(OperatingCondition oc, Special spe
FrequencyRange frange;
frange.operatingCondition = oc;
frange.special = special;
- for (QDomNode child=range.firstChild(); !child.isNull(); child=child.nextSibling()) {
+ for (TQDomNode child=range.firstChild(); !child.isNull(); child=child.nextSibling()) {
if ( child.nodeName()=="frequency" ) {
if ( !child.isElement() ) qFatal("Frequency is not an element");
- QDomElement frequency = child.toElement();
+ TQDomElement frequency = child.toElement();
bool ok1, ok2, ok3, ok4;
RangeBox box;
box.start.x = frequency.attribute("start").toDouble(&ok1);
@@ -71,45 +71,45 @@ bool Device::XmlToDataBase::getFrequencyRange(OperatingCondition oc, Special spe
return true;
}
-bool Device::XmlToDataBase::getMemoryTechnology(QDomElement element)
+bool Device::XmlToDataBase::getMemoryTechnology(TQDomElement element)
{
- QString s = element.attribute("memory_technology");
+ TQString s = element.attribute("memory_technology");
_data->_memoryTechnology = MemoryTechnology::fromKey(s);
if ( _data->_memoryTechnology!=MemoryTechnology::Nb_Types ) return true;
if ( !s.isNull() ) qFatal("Unrecognized memory technology");
return false;
}
-void Device::XmlToDataBase::processDevice(QDomElement device)
+void Device::XmlToDataBase::processDevice(TQDomElement device)
{
- QString name = device.attribute("name").upper();
+ TQString name = device.attribute("name").upper();
if ( name.isEmpty() ) qFatal("Device has no name");
- if ( _map.contains(name) ) qFatal(QString("Device \"%1\" already defined").arg(name));
+ if ( _map.tqcontains(name) ) qFatal(TQString("Device \"%1\" already defined").tqarg(name));
_data = createData();
_map[name] = _data;
_data->_name = name;
- _data->_alternatives = QStringList::split(' ', device.attribute("alternative"));
+ _data->_alternatives = TQStringList::split(' ', device.attribute("alternative"));
if ( _data->_alternatives.count() ) _alternatives[name] = _data->_alternatives;
- _data->_status = Status::fromKey(device.attribute("status"));
+ _data->_status = tqStatus::fromKey(device.attribute("status"));
switch (_data->_status.type()) {
- case Status::Nb_Types:
+ case tqStatus::Nb_Types:
qFatal("Unrecognized or absent device status");
break;
- case Status::Future:
+ case tqStatus::Future:
if ( _data->_alternatives.count() ) qFatal("Future device has alternative");
break;
- case Status::NotRecommended:
- case Status::Mature:
+ case tqStatus::NotRecommended:
+ case tqStatus::Mature:
if ( _data->_alternatives.count()==0 ) warning("Not-recommended/mature device has no alternative");
break;
- case Status::InProduction:
- case Status::EOL:
- case Status::Unknown: break;
+ case tqStatus::InProduction:
+ case tqStatus::EOL:
+ case tqStatus::Unknown: break;
}
// document
_data->_documents.webpage = device.attribute("document"); // ### REMOVE ME
- QDomElement documents = findUniqueElement(device, "documents", QString::null, QString::null);
+ TQDomElement documents = findUniqueElement(device, "documents", TQString(), TQString());
if ( documents.isNull() ) {
if ( _data->_documents.webpage.isEmpty() ) qFatal("Missing \"documents\" element");
} else {
@@ -117,33 +117,33 @@ void Device::XmlToDataBase::processDevice(QDomElement device)
_data->_documents.webpage = documents.attribute("webpage");
if ( _data->_documents.webpage.isEmpty() ) qFatal("Missing webpage");
_data->_documents.datasheet = documents.attribute("datasheet");
- QRegExp rexp("\\d{5}");
+ TQRegExp rexp("\\d{5}");
if ( _data->_documents.datasheet=="?" ) warning("No datasheet specified");
- if ( !rexp.exactMatch(_data->_documents.datasheet) ) qFatal(QString("Malformed datasheet \"%1\" (5 digits)").arg(_data->_documents.datasheet));
+ if ( !rexp.exactMatch(_data->_documents.datasheet) ) qFatal(TQString("Malformed datasheet \"%1\" (5 digits)").tqarg(_data->_documents.datasheet));
_data->_documents.progsheet = documents.attribute("progsheet");
if ( _data->_documents.progsheet=="?" ) warning("No progsheet specified");
- if ( !rexp.exactMatch(_data->_documents.datasheet) ) qFatal(QString("Malformed progsheet \"%1\" (5 digits)").arg(_data->_documents.progsheet));
- _data->_documents.erratas = QStringList::split(" ", documents.attribute("erratas"));
+ if ( !rexp.exactMatch(_data->_documents.datasheet) ) qFatal(TQString("Malformed progsheet \"%1\" (5 digits)").tqarg(_data->_documents.progsheet));
+ _data->_documents.erratas = TQStringList::split(" ", documents.attribute("erratas"));
for (uint i=0; i<uint(_data->_documents.erratas.count()); i++) {
- QString errata = _data->_documents.erratas[i];
+ TQString errata = _data->_documents.erratas[i];
if ( !rexp.exactMatch(errata) ) {
- QRegExp rexp2("\\d{5}e\\d");
+ TQRegExp rexp2("\\d{5}e\\d");
if ( !rexp2.exactMatch(errata) && !errata.startsWith("er") && errata.mid(2)!=_data->_name.lower() )
- qFatal(QString("Malformed erratas \"%1\" (5 digits or 5 digits + e + 1 digit or \"er\" + name)").arg(errata));
+ qFatal(TQString("Malformed erratas \"%1\" (5 digits or 5 digits + e + 1 digit or \"er\" + name)").tqarg(errata));
}
}
}
if ( _data->_documents.webpage=="?" ) warning("No webpage specified");
else {
- QRegExp rexp("\\d{6}");
- if ( !rexp.exactMatch(_data->_documents.webpage) ) qFatal(QString("Malformed webpage \"%1\" (6 digits)").arg(_data->_documents.webpage));
- if ( _documents.contains(_data->_documents.webpage) )
- qFatal(QString("webpage duplicated (already used for %1)").arg(_documents[_data->_documents.webpage]));
+ TQRegExp rexp("\\d{6}");
+ if ( !rexp.exactMatch(_data->_documents.webpage) ) qFatal(TQString("Malformed webpage \"%1\" (6 digits)").tqarg(_data->_documents.webpage));
+ if ( _documents.tqcontains(_data->_documents.webpage) )
+ qFatal(TQString("webpage duplicated (already used for %1)").tqarg(_documents[_data->_documents.webpage]));
_documents[_data->_documents.webpage] = name;
}
// frequency ranges
- QStringList names;
+ TQStringList names;
bool ok = false;
FOR_EACH(OperatingCondition, oc) {
names += oc.key();
@@ -157,15 +157,15 @@ void Device::XmlToDataBase::processDevice(QDomElement device)
if ( !getMemoryTechnology(device) ) qFatal("Memory technology not defined");
// packages
- for (QDomNode child=device.firstChild(); !child.isNull(); child=child.nextSibling()) {
+ for (TQDomNode child=device.firstChild(); !child.isNull(); child=child.nextSibling()) {
if ( !child.isElement() || child.nodeName()!="package" ) continue;
Package p = processPackage(child.toElement());
- QMap<QString, uint> pinLabels;
+ TQMap<TQString, uint> pinLabels;
for (uint i=0; i<uint(p.pins.count()); i++) {
if ( p.pins[i].isEmpty() || p.pins[i]=="N/C" ) continue;
- QStringList labels = QStringList::split("/", p.pins[i]);
+ TQStringList labels = TQStringList::split("/", p.pins[i]);
for(uint k=0; k<uint(labels.count()); k++) {
- if ( pinLabels.contains(labels[k]) ) pinLabels[labels[k]]++;
+ if ( pinLabels.tqcontains(labels[k]) ) pinLabels[labels[k]]++;
else pinLabels[labels[k]] = 1;
}
}
@@ -178,7 +178,7 @@ void Device::XmlToDataBase::processDevice(QDomElement device)
}
}
-Device::Package Device::XmlToDataBase::processPackage(QDomElement element)
+Device::Package Device::XmlToDataBase::processPackage(TQDomElement element)
{
Package package;
// nb pins
@@ -187,45 +187,45 @@ Device::Package Device::XmlToDataBase::processPackage(QDomElement element)
if ( !ok || nb==0 ) qFatal("Malformed \"nb_pins\"");
package.pins.resize(nb);
// types
- QStringList types = QStringList::split(" ", element.attribute("types"));
+ TQStringList types = TQStringList::split(" ", element.attribute("types"));
if ( types.isEmpty() ) qFatal("No package types specified");
for (uint k=0; k<uint(types.count()); k++) {
uint i = 0;
for (; Package::TYPE_DATA[i].name; i++) {
if ( types[k]!=Package::TYPE_DATA[i].name ) continue;
for (uint j=0; j<uint(package.types.count()); j++)
- if ( package.types[j]==i ) qFatal(QString("Duplicated package type %1").arg(types[k]));
+ if ( package.types[j]==i ) qFatal(TQString("Duplicated package type %1").tqarg(types[k]));
uint j = 0;
for (; j<Package::MAX_NB; j++)
if ( nb==Package::TYPE_DATA[i].nbPins[j] ) break;
- if ( j==Package::MAX_NB ) qFatal(QString("Package %1 does not have the correct number of pins %2 (%3)").arg(types[k]).arg(nb).arg(Package::TYPE_DATA[i].nbPins[0]));
+ if ( j==Package::MAX_NB ) qFatal(TQString("Package %1 does not have the correct number of pins %2 (%3)").tqarg(types[k]).tqarg(nb).tqarg(Package::TYPE_DATA[i].nbPins[0]));
package.types.append(i);
break;
}
- if ( Package::TYPE_DATA[i].name==0 ) qFatal(QString("Unknown package type \"%1\"").arg(types[k]));
+ if ( Package::TYPE_DATA[i].name==0 ) qFatal(TQString("Unknown package type \"%1\"").tqarg(types[k]));
}
// pins
- QString name = Package::TYPE_DATA[package.types[0]].name;
+ TQString name = Package::TYPE_DATA[package.types[0]].name;
if ( name=="sot23" ) {
if ( package.types.count()!=1 ) qFatal("SOT23 should be a specific package");
- } else if ( (nb%2)!=0 ) qFatal(QString("\"nb_pins\" should be even for package \"%1\"").arg(name));
+ } else if ( (nb%2)!=0 ) qFatal(TQString("\"nb_pins\" should be even for package \"%1\"").tqarg(name));
uint have_pins = false;
- QMemArray<bool> found(nb);
+ TQMemArray<bool> found(nb);
found.fill(false);
- QDomNode child = element.firstChild();
+ TQDomNode child = element.firstChild();
while ( !child.isNull() ) {
if ( child.nodeName()=="pin" ) {
if ( !child.isElement() ) qFatal("\"pin\" is not an element");
- QDomElement pin = child.toElement();
+ TQDomElement pin = child.toElement();
bool ok;
uint i = pin.attribute("index").toUInt(&ok);
if ( !ok || i==0 || i>nb ) qFatal("Malformed pin index");
if (found[i-1]) qFatal("Duplicated pin index");
found[i-1] = true;
- QString name = pin.attribute("name");
+ TQString name = pin.attribute("name");
if ( !name.isEmpty() && name!="N/C" ) {
- QStringList labels = QStringList::split("/", name);
- if ( name.contains(" ") || labels.count()==0 ) qFatal("Malformed pin name");
+ TQStringList labels = TQStringList::split("/", name);
+ if ( name.tqcontains(" ") || labels.count()==0 ) qFatal("Malformed pin name");
if ( name!=name.upper() ) qFatal("Pin name should be uppercase");
}
package.pins[i-1] = name;
@@ -234,27 +234,27 @@ Device::Package Device::XmlToDataBase::processPackage(QDomElement element)
child = child.nextSibling();
}
if ( !have_pins ) ;//warning("Pins not specified"); // #### REMOVE ME !!
- else for (uint i=0; i<nb; i++) if ( !found[i] ) qFatal(QString("Pin #%1 not specified").arg(i+1));
+ else for (uint i=0; i<nb; i++) if ( !found[i] ) qFatal(TQString("Pin #%1 not specified").tqarg(i+1));
return package;
}
void Device::XmlToDataBase::parse()
{
// process device files
- QStringList files = QDir::current().entryList("*.xml");
+ TQStringList files = TQDir::current().entryList("*.xml");
for (uint i=0; i<uint(files.count()); i++) {
_data = 0;
- QDomDocument doc = parseFile(files[i]);
- QDomElement root = doc.documentElement();
+ TQDomDocument doc = parseFile(files[i]);
+ TQDomElement root = doc.documentElement();
if ( root.nodeName()!="device" ) qFatal("root node should be \"device\"");
processDevice(root);
}
// check alternatives
- QMap<QString, QStringList>::const_iterator ait = _alternatives.begin();
+ TQMap<TQString, TQStringList>::const_iterator ait = _alternatives.begin();
for (; ait!=_alternatives.end(); ++ait) {
- QStringList::const_iterator lit = ait.data().begin();
+ TQStringList::const_iterator lit = ait.data().begin();
for (; lit!=ait.data().end(); ++lit)
- if ( !_map.contains(*lit) ) qFatal(QString("Unknown alternative %1 for device %2").arg((*lit)).arg(ait.key()));
+ if ( !_map.tqcontains(*lit) ) qFatal(TQString("Unknown alternative %1 for device %2").tqarg((*lit)).tqarg(ait.key()));
}
}
diff --git a/src/xml_to_data/device_xml_to_data.h b/src/xml_to_data/device_xml_to_data.h
index a1d0529..f9874e4 100644
--- a/src/xml_to_data/device_xml_to_data.h
+++ b/src/xml_to_data/device_xml_to_data.h
@@ -9,9 +9,9 @@
#ifndef DEVICE_XML_TO_DATA_H
#define DEVICE_XML_TO_DATA_H
-#include <qmap.h>
-#include <qfile.h>
-#include <qtextstream.h>
+#include <tqmap.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
#include "common/common/misc.h"
#include "common/common/streamer.h"
@@ -27,22 +27,22 @@ public:
protected:
mutable Data *_data;
- QMap<QString, Data *> _map; // device -> data
+ TQMap<TQString, Data *> _map; // device -> data
virtual void parse();
- virtual QString currentDevice() const { return (_data ? _data->name() : QString::null); }
- virtual QString namespaceName() const = 0;
+ virtual TQString currentDevice() const { return (_data ? _data->name() : TQString()); }
+ virtual TQString namespaceName() const = 0;
virtual Data *createData() const = 0;
- virtual void processDevice(QDomElement device);
- virtual void checkPins(const QMap<QString, uint> &pinLabels) const = 0;
+ virtual void processDevice(TQDomElement device);
+ virtual void checkPins(const TQMap<TQString, uint> &pinLabels) const = 0;
private:
- QMap<QString, QString> _documents; // document -> device
- QMap<QString, QStringList> _alternatives; // device -> alternatives
+ TQMap<TQString, TQString> _documents; // document -> device
+ TQMap<TQString, TQStringList> _alternatives; // device -> alternatives
- bool getFrequencyRange(OperatingCondition oc, Special special, QDomElement element);
- bool getMemoryTechnology(QDomElement element);
- Device::Package processPackage(QDomElement element);
+ bool getFrequencyRange(OperatingCondition oc, Special special, TQDomElement element);
+ bool getMemoryTechnology(TQDomElement element);
+ Device::Package processPackage(TQDomElement element);
};
template <class DataType>
@@ -53,12 +53,12 @@ public:
DataType *data() { return static_cast<DataType *>(_data); }
const DataType *data() const { return static_cast<DataType *>(_data); }
virtual void output() {
- QFile dfile("deps.mak");
+ TQFile dfile("deps.mak");
if ( !dfile.open(IO_WriteOnly) ) return;
- QTextStream dts(&dfile);
+ TQTextStream dts(&dfile);
dts << "noinst_DATA = ";
uint i = 0;
- QMap<QString, Data *>::const_iterator it;
+ TQMap<TQString, Data *>::const_iterator it;
for (it=_map.begin(); it!=_map.end(); ++it) {
if ( (i%10)==0 ) dts << "\\" << endl << " ";
dts << " " << it.key() << ".xml";
@@ -67,13 +67,13 @@ public:
dts << endl;
dfile.close();
- QFile file(namespaceName().lower() + "_data.cpp");
+ TQFile file(namespaceName().lower() + "_data.cpp");
if ( !file.open(IO_WriteOnly) ) return;
- QTextStream ts(&file);
+ TQTextStream ts(&file);
ts << "#include \"devices/" << namespaceName().lower() << "/"
<< namespaceName().lower() << "/" << namespaceName().lower() << "_group.h\"" << endl << endl;
ts << "const char *" << namespaceName() << "::DATA_STREAM =" << endl;
- QValueList<DataType *> list;
+ TQValueList<DataType *> list;
for (it=_map.begin(); it!=_map.end(); ++it)
list.append(static_cast<const DataType *>(it.data()));
uint size = toCppString(list, ts);
diff --git a/src/xml_to_data/prog_xml_to_data.h b/src/xml_to_data/prog_xml_to_data.h
index f4e820b..6eea337 100644
--- a/src/xml_to_data/prog_xml_to_data.h
+++ b/src/xml_to_data/prog_xml_to_data.h
@@ -9,9 +9,9 @@
#ifndef PROG_XML_TO_DATA_H
#define PROG_XML_TO_DATA_H
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qmap.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqmap.h>
#include "xml_to_data.h"
#include "devices/list/device_list.h"
@@ -21,40 +21,40 @@ template <class Data>
class ExtXmlToData : public ::XmlToData
{
public:
- ExtXmlToData(const QString &basename, const QString &namespac)
+ ExtXmlToData(const TQString &basename, const TQString &namespac)
: _basename(basename), _namespace(namespac) {}
protected:
- QString _basename, _namespace;
+ TQString _basename, _namespace;
virtual bool hasFamilies() const { return true; }
- const QStringList &families() const { return _families; }
- virtual uint familyIndex(const QString &family) const { return _families.findIndex(family); }
- virtual void parseData(QDomElement, Data &) = 0;
- virtual void includes(QTextStream &) const {}
- virtual void outputData(const Data &, QTextStream &) const {}
- virtual void outputFunctions(QTextStream &) const {}
- virtual QString currentDevice() const { return _current; }
- virtual void parseDevice(QDomElement element);
- ::Group::Support extractSupport(const QString &s) const;
- bool hasDevice(const QString &device) const { return _map.contains(device); }
+ const TQStringList &families() const { return _families; }
+ virtual uint familyIndex(const TQString &family) const { return _families.tqfindIndex(family); }
+ virtual void parseData(TQDomElement, Data &) = 0;
+ virtual void includes(TQTextStream &) const {}
+ virtual void outputData(const Data &, TQTextStream &) const {}
+ virtual void outputFunctions(TQTextStream &) const {}
+ virtual TQString currentDevice() const { return _current; }
+ virtual void parseDevice(TQDomElement element);
+ ::Group::Support extractSupport(const TQString &s) const;
+ bool hasDevice(const TQString &device) const { return _map.tqcontains(device); }
virtual void parse();
protected:
- QString _current;
+ TQString _current;
class PData {
public:
uint family;
::Group::Support support;
Data data;
};
- QMap<QString, PData> _map;
- QStringList _families;
+ TQMap<TQString, PData> _map;
+ TQStringList _families;
virtual void output();
};
template <class Data>
-Group::Support ExtXmlToData<Data>::extractSupport(const QString &s) const
+Group::Support ExtXmlToData<Data>::extractSupport(const TQString &s) const
{
if ( s.isEmpty() ) return Group::Support::Untested;
Group::Support support = Group::Support::fromKey(s);
@@ -64,17 +64,17 @@ Group::Support ExtXmlToData<Data>::extractSupport(const QString &s) const
}
template <class Data>
-void ExtXmlToData<Data>::parseDevice(QDomElement element)
+void ExtXmlToData<Data>::parseDevice(TQDomElement element)
{
if ( element.nodeName()!="device" ) qFatal("Root node child should be named \"device\"");
_current = element.attribute("name").upper();
- if ( Device::lister().data(_current)==0 ) qFatal(QString("Device name \"%1\" unknown").arg(_current));
- if ( _map.contains(_current) ) qFatal(QString("Device \"%1\" already parsed").arg(_current));
+ if ( Device::lister().data(_current)==0 ) qFatal(TQString("Device name \"%1\" unknown").tqarg(_current));
+ if ( _map.tqcontains(_current) ) qFatal(TQString("Device \"%1\" already parsed").tqarg(_current));
PData data;
if ( hasFamilies() ) {
- QString family = element.attribute("family");
- if ( family.isEmpty() ) qFatal(QString("Family is empty").arg(family));
- if ( _families.find(family)==_families.end() ) _families.append(family);
+ TQString family = element.attribute("family");
+ if ( family.isEmpty() ) qFatal(TQString("Family is empty").tqarg(family));
+ if ( _families.tqfind(family)==_families.end() ) _families.append(family);
data.family = familyIndex(family);
}
data.support = extractSupport(element.attribute("support_type"));
@@ -85,11 +85,11 @@ void ExtXmlToData<Data>::parseDevice(QDomElement element)
template <class Data>
void ExtXmlToData<Data>::parse()
{
- QDomDocument doc = parseFile(_basename + ".xml");
- QDomElement root = doc.documentElement();
+ TQDomDocument doc = parseFile(_basename + ".xml");
+ TQDomElement root = doc.documentElement();
if ( root.nodeName()!="type" ) qFatal("Root node should be \"type\"");
- if ( root.attribute("name")!=_basename ) qFatal(QString("Root node name is not \"%1\"").arg(_basename));
- QDomNode child = root.firstChild();
+ if ( root.attribute("name")!=_basename ) qFatal(TQString("Root node name is not \"%1\"").tqarg(_basename));
+ TQDomNode child = root.firstChild();
while ( !child.isNull() ) {
if ( child.isComment() ) qDebug("comment: %s", child.toComment().data().latin1());
else {
@@ -104,9 +104,9 @@ template <class Data>
void ExtXmlToData<Data>::output()
{
// write .cpp file
- QFile file(_basename + "_data.cpp");
- if ( !file.open(IO_WriteOnly) ) qFatal(QString("Cannot open output file \"%1\"").arg(file.name()));
- QTextStream s(&file);
+ TQFile file(_basename + "_data.cpp");
+ if ( !file.open(IO_WriteOnly) ) qFatal(TQString("Cannot open output file \"%1\"").tqarg(file.name()));
+ TQTextStream s(&file);
s << "// #### Do not edit: this file is autogenerated !!!" << endl << endl;
s << "#include \"devices/list/device_list.h\"" << endl;
s << "#include \"" + _basename + ".h\"" << endl;
@@ -124,7 +124,7 @@ void ExtXmlToData<Data>::output()
s << endl;
// data list
- typename QMap<QString, PData>::const_iterator it = _map.begin();
+ typename TQMap<TQString, PData>::const_iterator it = _map.begin();
for (; it!=_map.end(); ++it) {
s << "const CData PIC" << it.key() << "_DATA = {";
s << " \"" << it.key() << "\", ";
@@ -149,27 +149,27 @@ void ExtXmlToData<Data>::output()
// functions
s << endl;
- s << "const CData *cdata(const QString &device)" << endl;
+ s << "const CData *cdata(const TQString &device)" << endl;
s << "{" << endl;
s << " for(uint i=0; DATA_LIST[i]; i++)" << endl;
s << " if ( device==DATA_LIST[i]->name ) return DATA_LIST[i];" << endl;
s << " return 0;" << endl;
s << "}" << endl;
- s << "bool isSupported(const QString &device)" << endl;
+ s << "bool isSupported(const TQString &device)" << endl;
s << "{" << endl;
s << " return cdata(device);" << endl;
s << "}" << endl;
if ( hasFamilies() ) {
- s << "uint family(const QString &device)" << endl;
+ s << "uint family(const TQString &device)" << endl;
s << "{" << endl;
s << " return cdata(device)->family;" << endl;
s << "}" << endl;
}
- s << "::Group::Support support(const QString &device)" << endl;
+ s << "::Group::Support support(const TQString &device)" << endl;
s << "{" << endl;
s << " return ::Group::Support::Type(cdata(device)->support);" << endl;
s << "}" << endl;
- s << "const Data &data(const QString &device)" << endl;
+ s << "const Data &data(const TQString &device)" << endl;
s << "{" << endl;
s << " return cdata(device)->data;" << endl;
s << "}" << endl;
@@ -186,16 +186,16 @@ template <class Data>
class XmlToData : public ExtXmlToData<Data>
{
public:
- XmlToData(const QString &basename, const QString &namespac)
+ XmlToData(const TQString &basename, const TQString &namespac)
: ExtXmlToData<Data>(basename, namespac) {}
protected:
- virtual void outputFunctions(QTextStream &s) const;
- virtual void includes(QTextStream &) const;
+ virtual void outputFunctions(TQTextStream &s) const;
+ virtual void includes(TQTextStream &) const;
};
template <class Data>
-void Programmer::XmlToData<Data>::outputFunctions(QTextStream &s) const
+void Programmer::XmlToData<Data>::outputFunctions(TQTextStream &s) const
{
s << "void Group::initSupported()" << endl;
s << "{" << endl;
@@ -208,7 +208,7 @@ void Programmer::XmlToData<Data>::outputFunctions(QTextStream &s) const
}
template <class Data>
-void Programmer::XmlToData<Data>::includes(QTextStream &s) const
+void Programmer::XmlToData<Data>::includes(TQTextStream &s) const
{
s << "#include \"" << ExtXmlToData<Data>::_basename << "_prog.h\"" << endl;
}
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());
diff --git a/src/xml_to_data/xml_to_data.h b/src/xml_to_data/xml_to_data.h
index bd7e166..5ba4290 100644
--- a/src/xml_to_data/xml_to_data.h
+++ b/src/xml_to_data/xml_to_data.h
@@ -10,12 +10,8 @@
#define XML_TO_DATA_H
#include "common/global/global.h"
-#if QT_VERSION<0x040000
-# include <qdom.h>
-#else
-# include <QtXml/QDomDocument>
-#endif
-#include <qstringlist.h>
+# include <tqdom.h>
+#include <tqstringlist.h>
class XmlToData
{
@@ -27,13 +23,13 @@ public:
protected:
virtual void parse() = 0;
virtual void output() = 0;
- virtual QString currentDevice() const = 0;
- virtual void warning(const QString &message) const;
- virtual void qFatal(const QString &message) const;
- QDomElement findUniqueElement(QDomElement parent, const QString &nodeName,
- const QString &attribute, const QString &value) const;
- void checkTagNames(QDomElement element, const QString &tag, const QStringList &names) const;
- QDomDocument parseFile(const QString &filename) const;
+ virtual TQString currentDevice() const = 0;
+ virtual void warning(const TQString &message) const;
+ virtual void qFatal(const TQString &message) const;
+ TQDomElement findUniqueElement(TQDomElement tqparent, const TQString &nodeName,
+ const TQString &attribute, const TQString &value) const;
+ void checkTagNames(TQDomElement element, const TQString &tag, const TQStringList &names) const;
+ TQDomDocument parseFile(const TQString &filename) const;
};
#define XML_MAIN(_type) \