From f3bf2bb4f4209c01b72a63efb775601555c8307b Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Mon, 17 Apr 2017 14:53:20 +0200 Subject: [PATCH] [GL/IO] XML; remove delete functions from intf. This makes the libGeoLib.a by almost 2KiB and the DataExplorer executable by 498B smaller. --- GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp | 54 +++++++++++++------------- GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h | 15 ------- 2 files changed, 26 insertions(+), 43 deletions(-) diff --git a/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp index ba9a157c6b4..a34c86ffd93 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 22252e1e617..006562392d7 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; }; -- GitLab