|
|
@ -9,6 +9,7 @@
|
|
|
|
#ifndef PROG_XML_TO_DATA_H
|
|
|
|
#ifndef PROG_XML_TO_DATA_H
|
|
|
|
#define PROG_XML_TO_DATA_H
|
|
|
|
#define PROG_XML_TO_DATA_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <tqdir.h>
|
|
|
|
#include <tqfile.h>
|
|
|
|
#include <tqfile.h>
|
|
|
|
#include <tqtextstream.h>
|
|
|
|
#include <tqtextstream.h>
|
|
|
|
#include <tqmap.h>
|
|
|
|
#include <tqmap.h>
|
|
|
@ -21,8 +22,8 @@ template <class Data>
|
|
|
|
class ExtXmlToData : public ::XmlToData
|
|
|
|
class ExtXmlToData : public ::XmlToData
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
ExtXmlToData(const TQString &basename, const TQString &namespac)
|
|
|
|
ExtXmlToData(const TQString &folder, const TQString &basename, const TQString &namespac)
|
|
|
|
: _basename(basename), _namespace(namespac) {}
|
|
|
|
: ::XmlToData(folder), _basename(basename), _namespace(namespac) {}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
TQString _basename, _namespace;
|
|
|
|
TQString _basename, _namespace;
|
|
|
@ -85,7 +86,12 @@ void ExtXmlToData<Data>::parseDevice(TQDomElement element)
|
|
|
|
template <class Data>
|
|
|
|
template <class Data>
|
|
|
|
void ExtXmlToData<Data>::parse()
|
|
|
|
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();
|
|
|
|
TQDomElement root = doc.documentElement();
|
|
|
|
if ( root.nodeName()!="type" ) tqFatal("Root node should be \"type\"");
|
|
|
|
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));
|
|
|
|
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>
|
|
|
|
class XmlToData : public ExtXmlToData<Data>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
XmlToData(const TQString &basename, const TQString &namespac)
|
|
|
|
XmlToData(const TQString &folder, const TQString &basename, const TQString &namespac)
|
|
|
|
: ExtXmlToData<Data>(basename, namespac) {}
|
|
|
|
: ExtXmlToData<Data>(folder, basename, namespac) {}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
virtual void outputFunctions(TQTextStream &s) const;
|
|
|
|
virtual void outputFunctions(TQTextStream &s) const;
|
|
|
|