map: use value semantics for MapLocation

This makes memory management more simple, as not explicit deletion
is necessary.

A rather large commit, because changing QVector<> to std::vector<>
is propagated up the call chain.

Adds a new range_contains() helper function for collection
types such as std::vector<>. I didn't want to call it
contains(), since we already have a contains function
for strings and let's keep argument overloading simple.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-11 13:21:53 +02:00 committed by bstoeger
parent e39dea3d68
commit 6b835710bc
17 changed files with 84 additions and 75 deletions

View file

@ -2223,7 +2223,7 @@ void QMLManager::exportToFile(export_types type, QString dir, bool anonymize)
break;
case EX_DIVE_SITES_XML:
{
std::vector<const dive_site *> sites = getDiveSitesToExport(false);
auto sites = getDiveSitesToExport(false);
save_dive_sites_logic(qPrintable(fileName + ".xml"), sites.data(), (int)sites.size(), anonymize);
break;
}
@ -2271,7 +2271,7 @@ void QMLManager::shareViaEmail(export_types type, bool anonymize)
case EX_DIVE_SITES_XML:
fileName.replace("subsurface.log", "subsurface_divesites.xml");
{ // need a block so the compiler doesn't complain about creating the sites variable here
std::vector<const dive_site *> sites = getDiveSitesToExport(false);
auto sites = getDiveSitesToExport(false);
if (save_dive_sites_logic(qPrintable(fileName), sites.data(), (int)sites.size(), anonymize) == 0) {
// ok, we have a file, let's send it
body = "Subsurface dive site data";