|
|
|
@ -9,6 +9,7 @@
|
|
|
|
|
#ifndef PROG_XML_TO_DATA_H
|
|
|
|
|
#define PROG_XML_TO_DATA_H
|
|
|
|
|
|
|
|
|
|
#include <tqdir.h>
|
|
|
|
|
#include <tqfile.h>
|
|
|
|
|
#include <tqtextstream.h>
|
|
|
|
|
#include <tqmap.h>
|
|
|
|
@ -21,8 +22,8 @@ template <class Data>
|
|
|
|
|
class ExtXmlToData : public ::XmlToData
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ExtXmlToData(const TQString &basename, const TQString &namespac)
|
|
|
|
|
: _basename(basename), _namespace(namespac) {}
|
|
|
|
|
ExtXmlToData(const TQString &folder, const TQString &basename, const TQString &namespac)
|
|
|
|
|
: ::XmlToData(folder), _basename(basename), _namespace(namespac) {}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
TQString _basename, _namespace;
|
|
|
|
@ -85,7 +86,12 @@ void ExtXmlToData<Data>::parseDevice(TQDomElement element)
|
|
|
|
|
template <class Data>
|
|
|
|
|
void ExtXmlToData<Data>::parse()
|
|
|
|
|
{
|
|
|
|
|
TQDomDocument doc = parseFile(_basename + ".xml");
|
|
|
|
|
TQDir xmlFilesDir;
|
|
|
|
|
if (!xmlFolder.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
xmlFilesDir.setPath(xmlFolder);
|
|
|
|
|
}
|
|
|
|
|
TQDomDocument doc = parseFile(xmlFilesDir.absFilePath(_basename + ".xml"));
|
|
|
|
|
TQDomElement root = doc.documentElement();
|
|
|
|
|
if ( root.nodeName()!="type" ) tqFatal("Root node should be \"type\"");
|
|
|
|
|
if ( root.attribute("name")!=_basename ) tqFatal(TQString("Root node name is not \"%1\"").arg(_basename));
|
|
|
|
@ -186,8 +192,8 @@ template <class Data>
|
|
|
|
|
class XmlToData : public ExtXmlToData<Data>
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
XmlToData(const TQString &basename, const TQString &namespac)
|
|
|
|
|
: ExtXmlToData<Data>(basename, namespac) {}
|
|
|
|
|
XmlToData(const TQString &folder, const TQString &basename, const TQString &namespac)
|
|
|
|
|
: ExtXmlToData<Data>(folder, basename, namespac) {}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void outputFunctions(TQTextStream &s) const;
|
|
|
|
|