From 5580ab1debe4b9da2e95ada7ae96d8f529c7dea8 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Wed, 27 Nov 2019 15:24:18 +0100 Subject: [PATCH] [GL/IO] Remove unused XmlStnIF::rapidReadFile(). XmlStnInterface::rapidReadFile --- GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp | 68 +------------------------- GeoLib/IO/XmlIO/Qt/XmlStnInterface.h | 3 -- 2 files changed, 2 insertions(+), 69 deletions(-) diff --git a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp index 44ed39d79e2..89d1e21f728 100644 --- a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp +++ b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp @@ -513,69 +513,5 @@ void XmlStnInterface::writeBoreholeData(QDomDocument &doc, } } } - -int XmlStnInterface::rapidReadFile(const std::string &fileName) -{ - std::ifstream in(fileName.c_str()); - if (in.fail()) - { - ERR("XmlStnInterface::rapidReadFile(): Can't open xml-file %s.", fileName.c_str()); - return 0; - } - - // buffer file - in.seekg(0, std::ios::end); - std::size_t length = in.tellg(); - in.seekg(0, std::ios::beg); - auto* buffer = new char[length + 1]; - in.read(buffer, length); - buffer[in.gcount()] = '\0'; - in.close(); - - // build DOM tree - rapidxml::xml_document<> doc; - doc.parse<0>(buffer); - - // parse content - if (std::string(doc.first_node()->name()) != "OpenGeoSysSTN") - { - ERR("XmlStnInterface::readFile() - Unexpected XML root."); - return 0; - } - - // iterate over all station lists - for (rapidxml::xml_node<>* station_list = doc.first_node()->first_node(); station_list; - station_list = station_list->next_sibling()) - { - auto stations = std::make_unique<std::vector<GeoLib::Point*>>(); - std::string stnName("[NN]"); - - stnName = station_list->first_node("name")->value(); - for (rapidxml::xml_node<>* list_item = station_list->first_node(); list_item; - list_item = list_item->next_sibling()) - { - std::string b(list_item->name()); - if (b == "stations") - { - rapidReadStations(list_item, stations.get(), fileName); - } - if (b == "boreholes") - { - rapidReadStations(list_item, stations.get(), fileName); - } - } - - if (!stations->empty()) - { - _geo_objs.addStationVec(std::move(stations), stnName); - } - } - - doc.clear(); - delete [] buffer; - - return 1; -} - -} // end namespace IO -} // end namespace GeoLib +} // namespace IO +} // namespace GeoLib diff --git a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.h b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.h index 24f66094086..e4a0021d07e 100644 --- a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.h +++ b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.h @@ -44,9 +44,6 @@ public: return readFile(QString(fname.c_str())) != 0; } - /// Reads an xml-file using the RapidXML parser integrated in the source code (i.e. this function is usable without Qt) - int rapidReadFile(const std::string &fileName); - protected: bool write() override; -- GitLab