From 569b0ca7d93902bcfa9494f19dbafd72b156e18e Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Mon, 14 Oct 2013 09:51:15 +0200
Subject: [PATCH] Moved managing of ProjectData one level deeper in the
 inheritance hierarchy of XMLInterface.

---
 FileIO/XmlIO/XMLInterface.cpp    | 4 ++--
 FileIO/XmlIO/XMLInterface.h      | 5 +----
 FileIO/XmlIO/XmlCndInterface.cpp | 2 +-
 FileIO/XmlIO/XmlCndInterface.h   | 2 ++
 FileIO/XmlIO/XmlGmlInterface.cpp | 2 +-
 FileIO/XmlIO/XmlGmlInterface.h   | 1 +
 FileIO/XmlIO/XmlGspInterface.cpp | 2 +-
 FileIO/XmlIO/XmlGspInterface.h   | 2 ++
 FileIO/XmlIO/XmlStnInterface.cpp | 2 +-
 FileIO/XmlIO/XmlStnInterface.h   | 3 +++
 10 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/FileIO/XmlIO/XMLInterface.cpp b/FileIO/XmlIO/XMLInterface.cpp
index 7b2200bbbda..467cd801ffb 100644
--- a/FileIO/XmlIO/XMLInterface.cpp
+++ b/FileIO/XmlIO/XMLInterface.cpp
@@ -29,8 +29,8 @@
 
 namespace FileIO
 {
-XMLInterface::XMLInterface(ProjectData* project, const std::string &schemaFile) :
-	_project(project), _exportName(""), _schemaName(schemaFile)
+XMLInterface::XMLInterface(const std::string &schemaFile) :
+	_exportName(""), _schemaName(schemaFile)
 {
 }
 
diff --git a/FileIO/XmlIO/XMLInterface.h b/FileIO/XmlIO/XMLInterface.h
index 2c673adda43..e621a460a48 100644
--- a/FileIO/XmlIO/XMLInterface.h
+++ b/FileIO/XmlIO/XMLInterface.h
@@ -37,10 +37,9 @@ class XMLInterface : public Writer
 public:
 	/**
 	 * Constructor
-	 * \param project Project data.
 	 * \param schemaFile An XML schema file (*.xsd) that defines the structure of a valid data file.
 	 */
-	XMLInterface(ProjectData* project, const std::string &schemaFile);
+	XMLInterface(const std::string &schemaFile);
 
 	virtual ~XMLInterface() {}
 
@@ -70,8 +69,6 @@ protected:
 	/// Checks if the given file is conform to the given hash.
 	bool hashIsGood(const QString &fileName, const QByteArray &hash) const;
 
-	ProjectData* _project;
-
 	std::string _exportName;
 	std::string _schemaName;
 	std::map<std::size_t, std::size_t> _idx_map;
diff --git a/FileIO/XmlIO/XmlCndInterface.cpp b/FileIO/XmlIO/XmlCndInterface.cpp
index a6d4579b79e..6eaf315dfc0 100644
--- a/FileIO/XmlIO/XmlCndInterface.cpp
+++ b/FileIO/XmlIO/XmlCndInterface.cpp
@@ -23,7 +23,7 @@
 namespace FileIO
 {
 XmlCndInterface::XmlCndInterface(ProjectData* project, const std::string &schemaFile)
-	: XMLInterface(project, schemaFile), _type(FEMCondition::UNSPECIFIED)
+	: XMLInterface(schemaFile), _type(FEMCondition::UNSPECIFIED), _project(project)
 {
 }
 
diff --git a/FileIO/XmlIO/XmlCndInterface.h b/FileIO/XmlIO/XmlCndInterface.h
index 4ff06c5906d..de5a7e1e76a 100644
--- a/FileIO/XmlIO/XmlCndInterface.h
+++ b/FileIO/XmlIO/XmlCndInterface.h
@@ -67,6 +67,8 @@ private:
 	                    const QString &condText, const QString &geoName) const;
 
 	FEMCondition::CondType _type;
+
+	ProjectData* _project;
 };
 }
 
diff --git a/FileIO/XmlIO/XmlGmlInterface.cpp b/FileIO/XmlIO/XmlGmlInterface.cpp
index 8572333f6eb..809c5681462 100644
--- a/FileIO/XmlIO/XmlGmlInterface.cpp
+++ b/FileIO/XmlIO/XmlGmlInterface.cpp
@@ -24,7 +24,7 @@
 namespace FileIO
 {
 XmlGmlInterface::XmlGmlInterface(ProjectData* project, const std::string &schemaFile) :
-	XMLInterface(project, schemaFile)
+	XMLInterface(schemaFile), _project(project)
 {
 }
 
diff --git a/FileIO/XmlIO/XmlGmlInterface.h b/FileIO/XmlIO/XmlGmlInterface.h
index cc849800d5b..7d6a9e27382 100644
--- a/FileIO/XmlIO/XmlGmlInterface.h
+++ b/FileIO/XmlIO/XmlGmlInterface.h
@@ -61,6 +61,7 @@ private:
 	                     const std::vector<std::size_t> &pnt_id_map,
 	                     std::map<std::string, std::size_t>* sfc_names );
 
+	ProjectData* _project;
 };
 
 }
diff --git a/FileIO/XmlIO/XmlGspInterface.cpp b/FileIO/XmlIO/XmlGspInterface.cpp
index f384e61706f..73d1706d907 100644
--- a/FileIO/XmlIO/XmlGspInterface.cpp
+++ b/FileIO/XmlIO/XmlGspInterface.cpp
@@ -31,7 +31,7 @@
 namespace FileIO
 {
 XmlGspInterface::XmlGspInterface(ProjectData* project, const std::string &schemaFile) :
-	XMLInterface(project, schemaFile)
+	XMLInterface(schemaFile), _project(project)
 {
 }
 
diff --git a/FileIO/XmlIO/XmlGspInterface.h b/FileIO/XmlIO/XmlGspInterface.h
index 580fb8e8c3c..0c2ebedfe6f 100644
--- a/FileIO/XmlIO/XmlGspInterface.h
+++ b/FileIO/XmlIO/XmlGspInterface.h
@@ -46,6 +46,8 @@ protected:
 
 private:
 	std::string _filename;
+
+	ProjectData* _project;
 };
 
 }
diff --git a/FileIO/XmlIO/XmlStnInterface.cpp b/FileIO/XmlIO/XmlStnInterface.cpp
index 54174af4b9d..6fe9876b195 100644
--- a/FileIO/XmlIO/XmlStnInterface.cpp
+++ b/FileIO/XmlIO/XmlStnInterface.cpp
@@ -31,7 +31,7 @@
 namespace FileIO
 {
 XmlStnInterface::XmlStnInterface(ProjectData* project, const std::string &schemaFile) :
-	XMLInterface(project, schemaFile)
+	XMLInterface(schemaFile), _project(project)
 {
 }
 
diff --git a/FileIO/XmlIO/XmlStnInterface.h b/FileIO/XmlIO/XmlStnInterface.h
index 0cd920960f2..6da678799ad 100644
--- a/FileIO/XmlIO/XmlStnInterface.h
+++ b/FileIO/XmlIO/XmlStnInterface.h
@@ -65,6 +65,9 @@ private:
 
 	/// Reads the stratigraphy of a borehole from an xml-file using the RapidXML parser
 	void rapidReadStratigraphy(const rapidxml::xml_node<>* strat_root, GeoLib::StationBorehole* borehole);
+
+
+	ProjectData* _project;
 };
 
 }
-- 
GitLab