mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-31 10:03:46 +00:00
[generator] Add support of Panoramax tag
Signed-off-by: Jean-Baptiste Charron <jeanbaptiste.charron@outlook.fr> Co-authored by: Harry Bond <me@hbond.xyz>
This commit is contained in:
committed by
Konstantin Pastbin
parent
495167c11f
commit
6a10cffe51
@@ -17,6 +17,7 @@
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <optional>
|
||||
#include <regex>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
@@ -309,6 +310,22 @@ std::string MetadataTagProcessorImpl::ValidateAndFormat_wikimedia_commons(std::s
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string MetadataTagProcessorImpl::ValidateAndFormat_panoramax(std::string v)
|
||||
{
|
||||
static auto const s_panoramaxRegex = std::regex(R"(^([a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12})$)");
|
||||
|
||||
if (std::regex_match(v, s_panoramaxRegex))
|
||||
return v;
|
||||
url::Url const parsedUrl = url::Url::FromString(v);
|
||||
if (const std::string* paramValue = parsedUrl.GetParamValue("pic"))
|
||||
{
|
||||
if (std::regex_match(*paramValue, s_panoramaxRegex))
|
||||
return v;
|
||||
}
|
||||
LOG(LDEBUG, ("Invalid Panoramax tag value:", v));
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string MetadataTagProcessorImpl::ValidateAndFormat_airport_iata(std::string const & v) const
|
||||
{
|
||||
if (!ftypes::IsAirportChecker::Instance()(m_params.m_types))
|
||||
@@ -548,6 +565,7 @@ void MetadataTagProcessor::operator()(std::string const & k, std::string const &
|
||||
case Metadata::FMD_POSTCODE: valid = ValidateAndFormat_postcode(v); break;
|
||||
case Metadata::FMD_WIKIPEDIA: valid = ValidateAndFormat_wikipedia(v); break;
|
||||
case Metadata::FMD_WIKIMEDIA_COMMONS: valid = ValidateAndFormat_wikimedia_commons(v); break;
|
||||
case Metadata::FMD_PANORAMAX: valid = ValidateAndFormat_panoramax(v); break;
|
||||
case Metadata::FMD_FLATS: valid = ValidateAndFormat_flats(v); break;
|
||||
case Metadata::FMD_MIN_HEIGHT: // The same validator as for height.
|
||||
case Metadata::FMD_HEIGHT: valid = ValidateAndFormat_height(v); break;
|
||||
|
||||
Reference in New Issue
Block a user