mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-07 21:13:55 +00:00
switch to boost::regex and only construct regex once
Signed-off-by: map-per <map-per@gmx.de>
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
#include "base/timer.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <regex>
|
||||
#include <boost/regex.hpp>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
@@ -712,20 +712,21 @@ void XMLFeature::OSMBusinessReplacement(uint32_t old_type, uint32_t new_type)
|
||||
std::string name = GetTagValue("name");
|
||||
|
||||
// Remove OSM tags using the list from keys_to_remove.hpp
|
||||
std::string regexPattern;
|
||||
static const boost::regex regex([] {
|
||||
std::string regexPattern;
|
||||
|
||||
for (auto const & key : kKeysToRemove)
|
||||
for (auto const & key : kKeysToRemove)
|
||||
{
|
||||
if (!regexPattern.empty())
|
||||
regexPattern.append("|");
|
||||
regexPattern.append(key);
|
||||
}
|
||||
return regexPattern;
|
||||
}());
|
||||
|
||||
ForEachTag([this](std::string_view key, std::string_view /*value*/)
|
||||
{
|
||||
if (!regexPattern.empty())
|
||||
regexPattern.append("|");
|
||||
regexPattern.append(key);
|
||||
}
|
||||
|
||||
std::regex regex(regexPattern);
|
||||
|
||||
ForEachTag([& regex, this](std::string_view key, std::string_view /*value*/)
|
||||
{
|
||||
if (std::regex_match(key.begin(), key.end(), regex))
|
||||
if (boost::regex_match(key.begin(), key.end(), regex))
|
||||
RemoveTag(key);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user