Skip to content
Snippets Groups Projects
Commit 5580ab1d authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[GL/IO] Remove unused XmlStnIF::rapidReadFile().

XmlStnInterface::rapidReadFile
parent 8dfd43c4
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment