Commit 07ac96a6 authored by Volker Krause's avatar Volker Krause
Browse files

Add Element::hasTag method

Helpful during merging elements.
parent 220cd929
......@@ -111,6 +111,11 @@ QByteArray Element::tagValue(const char *keyName, const QLocale &locale) const
return {};
bool Element::hasTag(TagKey key) const
return std::binary_search(tagsBegin(), tagsEnd(), key);
std::vector<Tag>::const_iterator OSM::Element::tagsBegin() const
switch (type()) {
......@@ -50,6 +50,8 @@ public:
template <typename K, typename ...Args> QByteArray tagValue(K key, Args... args, const QLocale &locale) const;
/** Returns whether or not this element has any tags set. */
inline bool hasTags() const { return std::distance(tagsBegin(), tagsEnd()) > 0; }
/** Returns @c true if this element has a tag with key @p key. */
bool hasTag(TagKey key) const;
std::vector<Tag>::const_iterator tagsBegin() const;
std::vector<Tag>::const_iterator tagsEnd() const;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment