summaryrefslogtreecommitdiffstats
path: root/src/xml_to_data/prog_xml_to_data.h
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2024-05-06 18:26:24 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2024-05-06 22:36:50 +0900
commitac3f0014232619edc41865f6e42e6510bdd8acc6 (patch)
tree9f851f02238781fb9ffe7f76ac446d25e9c92668 /src/xml_to_data/prog_xml_to_data.h
parent1c22ae157c39e2c1434e5ec43a05eda78dc86798 (diff)
downloadpiklab-ac3f0014232619edc41865f6e42e6510bdd8acc6.tar.gz
piklab-ac3f0014232619edc41865f6e42e6510bdd8acc6.zip
Allow generation of build time data files in out-of-source builds. Also fix generation of data file for devices/mem24 subfolder
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/xml_to_data/prog_xml_to_data.h')
-rw-r--r--src/xml_to_data/prog_xml_to_data.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/xml_to_data/prog_xml_to_data.h b/src/xml_to_data/prog_xml_to_data.h
index bcca9da..b977359 100644
--- a/src/xml_to_data/prog_xml_to_data.h
+++ b/src/xml_to_data/prog_xml_to_data.h
@@ -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;