diff --git a/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp index ba9a157c6b402ba46040a55246bbe63ea32f8c62..a34c86ffd931043f54c5e2a81df3e5e638b407dd 100644 --- a/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp +++ b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp @@ -24,6 +24,32 @@ #include "BaseLib/FileFinder.h" #include "GeoLib/Triangle.h" +namespace +{ +void deletePolylines(std::unique_ptr<std::vector<GeoLib::Polyline*>> polylines) +{ + for (GeoLib::Polyline* line : *polylines) + delete line; +} + +void deleteSurfaces(std::unique_ptr<std::vector<GeoLib::Surface*>> surfaces) +{ + for (GeoLib::Surface* line : *surfaces) + delete line; +} +void deleteGeometry(std::unique_ptr<std::vector<GeoLib::Point*>> points, + std::unique_ptr<std::vector<GeoLib::Polyline*>> + polylines, + std::unique_ptr<std::vector<GeoLib::Surface*>> + surfaces) +{ + for (GeoLib::Point* point : *points) + delete point; + deletePolylines(std::move(polylines)); + deleteSurfaces(std::move(surfaces)); +} +} + namespace GeoLib { namespace IO @@ -220,34 +246,6 @@ void XmlGmlInterface::readSurfaces( surface = surface.nextSiblingElement(); } } - -void XmlGmlInterface::deleteGeometry( - std::unique_ptr<std::vector<GeoLib::Point*>> points, - std::unique_ptr<std::vector<GeoLib::Polyline*>> - polylines, - std::unique_ptr<std::vector<GeoLib::Surface*>> - surfaces) const -{ - for (GeoLib::Point* point : *points) - delete point; - deletePolylines(std::move(polylines)); - deleteSurfaces(std::move(surfaces)); -} - -void XmlGmlInterface::deletePolylines( - std::unique_ptr<std::vector<GeoLib::Polyline*>> polylines) const -{ - for (GeoLib::Polyline* line : *polylines) - delete line; -} - -void XmlGmlInterface::deleteSurfaces( - std::unique_ptr<std::vector<GeoLib::Surface*>> surfaces) const -{ - for (GeoLib::Surface* line : *surfaces) - delete line; -} - bool XmlGmlInterface::write() { if (this->_exportName.empty()) diff --git a/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h index 22252e1e6171233a49680c62ac29b0565d5cf33a..006562392d73ec79107d6f68f6d4e7eb2ba7ea40 100644 --- a/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h +++ b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h @@ -68,21 +68,6 @@ private: const std::vector<std::size_t>& pnt_id_map, std::map<std::string, std::size_t>* sfc_names); - /// Deletes all geometry data structures - void deleteGeometry(std::unique_ptr<std::vector<GeoLib::Point*>> points, - std::unique_ptr<std::vector<GeoLib::Polyline*>> - polylines, - std::unique_ptr<std::vector<GeoLib::Surface*>> - surfaces) const; - - /// Cleans up polylines-vector as well as its content if necessary - void deletePolylines( - std::unique_ptr<std::vector<GeoLib::Polyline*>> polylines) const; - - /// Cleans up surfaces-vector as well as its content if necessary - void deleteSurfaces( - std::unique_ptr<std::vector<GeoLib::Surface*>> surfaces) const; - GeoLib::GEOObjects& _geo_objs; std::map<std::size_t, std::size_t> _idx_map; };