1 #ifndef OSMIUM_OSM_TAG_HPP 2 #define OSMIUM_OSM_TAG_HPP 48 class Tag :
public osmium::memory::detail::ItemHelper {
56 template <
typename TMember>
60 return reinterpret_cast<unsigned char*
>(std::strchr(reinterpret_cast<char*>(ptr), 0) + 1);
63 static const unsigned char*
after_null(
const unsigned char* ptr) {
64 return reinterpret_cast<const unsigned char*
>(std::strchr(reinterpret_cast<const char*>(ptr), 0) + 1);
71 const unsigned char*
next()
const {
79 const char*
key() const noexcept {
80 return reinterpret_cast<const char*
>(
data());
90 return !std::strcmp(lhs.
key(), rhs.
key()) &&
95 const auto c = std::strcmp(lhs.
key(), rhs.
key());
96 return (c == 0 ? std::strcmp(lhs.
value(), rhs.
value()) : c) < 0;
102 template <
typename TChar,
typename TTraits>
103 inline std::basic_ostream<TChar, TTraits>& operator<<(std::basic_ostream<TChar, TTraits>& out,
const Tag& tag) {
104 return out << tag.
key() <<
'=' << tag.value();
110 return std::find_if(cbegin(), cend(), [
key](
const Tag& tag) {
111 return !std::strcmp(tag.
key(),
key);
129 const auto result = find_key(key);
130 return result == cend() ? default_value : result->value();
140 return get_value_by_key(
key);
150 return find_key(
key) != cend();
162 const auto result = find_key(
key);
163 return result != cend() && !std::strcmp(result->value(),
value);
171 #endif // OSMIUM_OSM_TAG_HPP
Definition: collection.hpp:47
Tag & operator=(const Tag &)=delete
bool has_key(const char *key) const noexcept
Definition: tag.hpp:148
static unsigned char * after_null(unsigned char *ptr)
Definition: tag.hpp:59
constexpr bool operator==(const Box &lhs, const Box &rhs) noexcept
Definition: box.hpp:221
item_type
Definition: item_type.hpp:43
bool has_tag(const char *key, const char *value) const noexcept
Definition: tag.hpp:159
const unsigned char * next() const
Definition: tag.hpp:71
bool operator<(const Changeset &lhs, const Changeset &rhs)
Definition: changeset.hpp:447
Namespace for everything in the Osmium library.
Definition: assembler.hpp:63
TagList()
Definition: tag.hpp:117
Definition: collection.hpp:117
unsigned char * data() const noexcept
Definition: collection.hpp:91
static constexpr item_type collection_type
Definition: tag.hpp:77
const char * key() const noexcept
Definition: tag.hpp:79
const_iterator find_key(const char *key) const noexcept
Definition: tag.hpp:109
const char * get_value_by_key(const char *key, const char *default_value=nullptr) const noexcept
Definition: tag.hpp:127
unsigned char * next()
Definition: tag.hpp:67
const char * operator[](const char *key) const noexcept
Definition: tag.hpp:139
static const unsigned char * after_null(const unsigned char *ptr)
Definition: tag.hpp:63
const char * value() const
Definition: tag.hpp:83