diff options
author | vng <viktor.govako@gmail.com> | 2015-12-11 17:07:34 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:03:04 +0300 |
commit | aca026daca9853ea5a629fc4ba4cc46483057cf2 (patch) | |
tree | b1559878100074e372b622a814c0b9cb29aa1b78 /indexer/feature_meta.hpp | |
parent | 4b893fbe6ab98abaedf66dc10b368be7cda8b08a (diff) |
[generator] Skip empty address data for search additional information.
Diffstat (limited to 'indexer/feature_meta.hpp')
-rw-r--r-- | indexer/feature_meta.hpp | 36 |
1 files changed, 21 insertions, 15 deletions
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); } }; } |