Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2015-12-11 17:07:34 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:03:04 +0300
commitaca026daca9853ea5a629fc4ba4cc46483057cf2 (patch)
treeb1559878100074e372b622a814c0b9cb29aa1b78 /indexer/feature_meta.hpp
parent4b893fbe6ab98abaedf66dc10b368be7cda8b08a (diff)
[generator] Skip empty address data for search additional information.
Diffstat (limited to 'indexer/feature_meta.hpp')
-rw-r--r--indexer/feature_meta.hpp36
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);
}
};
}