diff --git a/generator/osm_element.cpp b/generator/osm_element.cpp index 894574b6cf..36cab0bc53 100644 --- a/generator/osm_element.cpp +++ b/generator/osm_element.cpp @@ -31,13 +31,13 @@ std::string DebugPrint(OsmElement::EntityType type) UNREACHABLE(); } -void OsmElement::AddTag(std::string const & key, std::string const & value) +void OsmElement::AddTag(char const * key, char const * value) { // Seems like source osm data has empty values. They are useless for us. - if (key.empty() || value.empty()) + if (key[0] == '\0' || value[0] == '\0') return; -#define SKIP_KEY(skippedKey) if (strncmp(key.data(), skippedKey, sizeof(key)-1) == 0) return; +#define SKIP_KEY(skippedKey) if (strncmp(key, skippedKey, sizeof(skippedKey)-1) == 0) return; // OSM technical info tags SKIP_KEY("created_by"); SKIP_KEY("source"); @@ -63,9 +63,14 @@ void OsmElement::AddTag(std::string const & key, std::string const & value) SKIP_KEY("official_name"); #undef SKIP_KEY - std::string val{std::string{value}}; + std::string val{value}; strings::Trim(val); - m_tags.emplace_back(std::string{key}, std::move(val)); + m_tags.emplace_back(key, std::move(val)); +} + +void OsmElement::AddTag(std::string const & key, std::string const & value) +{ + AddTag(key.data(), value.data()); } bool OsmElement::HasTag(std::string const & key) const diff --git a/generator/osm_element.hpp b/generator/osm_element.hpp index 37f3da3c2a..8fa834c65c 100644 --- a/generator/osm_element.hpp +++ b/generator/osm_element.hpp @@ -123,6 +123,7 @@ struct OsmElement m_members.emplace_back(ref, type, role); } + void AddTag(char const * key, char const * value); void AddTag(std::string const & key, std::string const & value); bool HasTag(std::string const & key) const; bool HasTag(std::string const & key, std::string const & value) const;