From aca026daca9853ea5a629fc4ba4cc46483057cf2 Mon Sep 17 00:00:00 2001 From: vng Date: Fri, 11 Dec 2015 17:07:34 +0300 Subject: [PATCH] [generator] Skip empty address data for search additional information. --- indexer/feature_data.cpp | 1 - indexer/feature_meta.hpp | 36 +++++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp index c286e4bf6f..7292dc4109 100644 --- a/indexer/feature_data.cpp +++ b/indexer/feature_data.cpp @@ -200,7 +200,6 @@ bool FeatureParams::AddHouseName(string const & s) return false; } - bool FeatureParams::AddHouseNumber(string const & ss) { if (!feature::IsHouseNumber(ss)) diff --git a/indexer/feature_meta.hpp b/indexer/feature_meta.hpp index 0faaabc571..60486ef1e9 100644 --- a/indexer/feature_meta.hpp +++ b/indexer/feature_meta.hpp @@ -14,6 +14,24 @@ namespace feature { class MetadataBase { + protected: + void Set(uint8_t type, string const & value) + { + auto found = m_metadata.find(type); + if (found == m_metadata.end()) + { + if (!value.empty()) + m_metadata[type] = value; + } + else + { + if (value.empty()) + m_metadata.erase(found); + else + found->second = value; + } + } + public: string Get(uint8_t type) const { @@ -97,22 +115,10 @@ namespace feature void Set(EType type, string const & value) { - auto found = m_metadata.find(type); - if (found == m_metadata.end()) - { - if (!value.empty()) - m_metadata[type] = value; - } - else - { - if (value.empty()) - m_metadata.erase(found); - else - found->second = value; - } + MetadataBase::Set(type, value); } - void Drop(EType type) { Set(type, ""); } + void Drop(EType type) { Set(type, string()); } string GetWikiURL() const; @@ -153,7 +159,7 @@ namespace feature void Add(Type type, string const & s) { /// @todo Probably, we need to add separator here and store multiple values. - m_metadata[type] = s; + MetadataBase::Set(type, s); } }; }