[generator] Add capacity tag to metadata

Signed-off-by: David Martinez <47610359+dvdmrtnz@users.noreply.github.com>
This commit is contained in:
David Martinez 2023-12-30 16:49:18 +01:00 committed by Viktor Govako
parent efef98b5fb
commit 0a73e3de94
4 changed files with 11 additions and 0 deletions

View file

@ -326,6 +326,11 @@ std::string MetadataTagProcessorImpl::ValidateAndFormat_brand(std::string const
return v;
}
std::string MetadataTagProcessorImpl::ValidateAndFormat_capacity(std::string const & v)
{
return v;
}
std::string MetadataTagProcessorImpl::ValidateAndFormat_duration(std::string const & v) const
{
if (!ftypes::IsWayWithDurationChecker::Instance()(m_params.m_types))
@ -519,6 +524,7 @@ void MetadataTagProcessor::operator()(std::string const & k, std::string const &
valid = ValidateAndFormat_brand(v);
break;
case Metadata::FMD_DURATION: valid = ValidateAndFormat_duration(v); break;
case Metadata::FMD_CAPACITY: valid = ValidateAndFormat_capacity(v); break;
// Metadata types we do not get from OSM.
case Metadata::FMD_CUISINE:
case Metadata::FMD_DESCRIPTION: // processed separately

View file

@ -35,6 +35,7 @@ struct MetadataTagProcessorImpl
std::string ValidateAndFormat_airport_iata(std::string const & v) const;
static std::string ValidateAndFormat_brand(std::string const & v);
std::string ValidateAndFormat_duration(std::string const & v) const;
static std::string ValidateAndFormat_capacity(std::string const & v);
protected:
FeatureBuilderParams & m_params;

View file

@ -122,6 +122,8 @@ bool Metadata::TypeFromString(string_view k, Metadata::EType & outType)
outType = Metadata::FMD_BRAND;
else if (k == "duration")
outType = Metadata::FMD_DURATION;
else if (k == "capacity")
outType = Metadata::FMD_CAPACITY;
else
return false;
@ -237,6 +239,7 @@ string ToString(Metadata::EType type)
case Metadata::FMD_JUNCTION_REF: return "junction:ref";
case Metadata::FMD_BUILDING_MIN_LEVEL: return "building:min_level";
case Metadata::FMD_WIKIMEDIA_COMMONS: return "wikimedia_commons";
case Metadata::FMD_CAPACITY: return "capacity";
case Metadata::FMD_COUNT: CHECK(false, ("FMD_COUNT can not be used as a type."));
};

View file

@ -147,6 +147,7 @@ public:
FMD_JUNCTION_REF = 39,
FMD_BUILDING_MIN_LEVEL = 40,
FMD_WIKIMEDIA_COMMONS = 41,
FMD_CAPACITY = 42,
FMD_COUNT
};